i was trying to parse a string with pyparsing so all the words were separated from the punctuation signs, i was using this expression to do it:
OneOrMore(Word(alphanums)) + OneOrMore(Char(printables))
But when i parse the following string with this expression:
return abc(1, ULLONG_MAX)
All the words inside the parentheses get split:
['return', 'abc', '(', '1', ',', 'U', 'L', 'L', 'O', 'N', '_', 'M', 'A', 'X', ')', ';']
But if i use this expression:
OneOrMore(Word(alphanums)) + OneOrMore(Char(string.punctuation))
Only a part of the string gets parsed:
['return', 'abc', '(']
What is wrong with those expressions?
You must log in or register to comment.