You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From revision 1ccf846 onward (the fix to #350), if the default whitespace characters are removed, for example, if there are no default whitespace characters, pp.White(ws) appears to skip over characters in " \t\n\r" to consume ws even if those characters are not in ws and not in the default whitespace characters.
importpyparsingaspppp.ParserElement.setDefaultWhitespaceChars("")
("a"+pp.White(" ") +"c").parseString("a\n c") # Matches, should not.#[Out]# ParseResults(['a', ' ', 'c'], {})
("a"+pp.White("\n") +"c").parseString("a\nc") # Matches, should.#[Out]# ParseResults(['a', '\n', 'c'], {})
("a"+pp.White("\n") +"c").parseString("a \nc") # Matches, should not.#[Out]# ParseResults(['a', '\n', 'c'], {})
("a"+pp.White("\n") +"c").parseString("a \n c") # Does not match, should not.
("a"+pp.White("\n") +"c").parseString("a\n c") # Does not match, should not.
(This is with Python 3.10.2, pyparsing 1ccf846 up to 938f59d)
The text was updated successfully, but these errors were encountered:
cgevans
changed the title
pp.White skips preceding whitespace characters even if characters removed from default (from issue #350 resolution)
pp.White skips preceding whitespace characters even if characters removed from default, matches only some characters (from issue #350 resolution)
Jan 26, 2022
cgevans
added a commit
to cgevans/qslib
that referenced
this issue
Jan 26, 2022
cgevans
changed the title
pp.White skips preceding whitespace characters even if characters removed from default, matches only some characters (from issue #350 resolution)
pp.White skips preceding whitespace characters even if characters removed from default (from issue #350 resolution)
Jan 26, 2022
Thanks for posting, will take me a bit to sift through. The White class has always been an oddity in pyparsing, given that it has to look for spaces that are ignored by most of the rest of the package.
From revision 1ccf846 onward (the fix to #350), if the default whitespace characters are removed, for example, if there are no default whitespace characters,
pp.White(ws)
appears to skip over characters in " \t\n\r" to consumews
even if those characters are not inws
and not in the default whitespace characters.(This is with Python 3.10.2, pyparsing 1ccf846 up to 938f59d)
The text was updated successfully, but these errors were encountered: