I am using pyparser to handle the output of a hex converter. It prints 16 characters per line, separated by spaces. If the hexadecimal value is an ASCII print character, this character is printed; otherwise, the converter returns a period (.)
Basically the output is as follows:
. a . valid . string . . another . string . . etc . . . . . . . . . . . .
My pyparsing code to describe this line:
dump_line = 16 * Word(printables, exact=1)
This works fine until the hex converter reaches the hex value 0x20, which causes it to exit.
line . w . a . space .
In this case, pyparsing ignores the displayed space and captures the characters from the next line to make a "quota" of 16 characters.
Can anyone suggest, how can I say that pyparsing expects 16 characters, each of which is separated by a space, where space can also be a valid character?
Thanks in advance. J
JS.
source share