Closed Gu-f closed 1 month ago
I found the stop_on
, it satisfies.
content_pos = pp.OneOrMore(content, stop_on=from_).set_name("contents")
Glad you were able to find this solution for yourself - stop_on is definitely the correct solution for this.
There is a note in the wiki on Common Pitfalls when Writing Parsers, and I also just wrote up a blog post that goes into more detail on just what is going on in pyparsing.
Also, I saw that stop_on did not correctly represent its negative lookahead element in the railroad diagrams, so this will be fixed in the next release.
I got an error
pyparsing.exceptions.ParseException: Expected Keyword 'from', found ';' (at char 18), (line:1, col:19)
from
is matched bycontent_pos
But I want
from
as a keyword to be matched byfrom_
How should I fix it, thanks