Strange StringStart().scanString behaviour
Brought to you by:
ptmcg
Here is a log from an interactive session of mine (pyparsing 2.1.5):
>>> from pyparsing import StringStart >>> StringStart().parseString("") ([], {}) >>> StringStart().parseString(" ") ([], {}) >>> StringStart().parseString("text") ([], {}) >>> StringStart().parseString(" text") ([], {}) >>> list(StringStart().scanString("")) [] >>> list(StringStart().scanString(" ")) [(([], {}), 1, 1)] >>> list(StringStart().scanString("text")) [] >>> list(StringStart().scanString(" text")) [(([], {}), 1, 1)]
It seems that something very strange is going on in the interaction with StringStart and scanString. For some reason, StringStart only finds a match when the string starts with whitespace, but only when using scanString, not parseString.
Is this intended behaviour? It causes StringStart to be basically useless when used with scanString, since it does not actually always match the start of the string.