-
-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty matches appearing unnecessarily when repeating empty rules ambiguously #1312
Comments
This isn't a problem with brackets. It might be an issue with ambiguous repetition. Note that this grammar produces the same result: program: instruction*
instruction: pneumonic parameter*
pneumonic: CNAME
parameter: [ESCAPED_STRING | INT] And this grammar produces a similar result:
Which means that repeating empty rules is probably creating this pattern. |
Probably a duplicate of #1283. The solution is to make sure that you don't have ambiguites, and ideally you always want to use |
@MegaIng I tried disabling ChildFilterLALR and the ForestToParseTree cache, as that issue suggests, but this artifact still persists. |
I'm writing a simple assembly-like language and I'm using Lark to parse it's AST, but I'm having trouble with ambiguity. Here's a boiled-down MinRe:
The above produces this output, which shows there's some phantom parameter between the pneumonic and the explicit strings and ints:
At first, I thought this was the parser matching the whitespace between the pneumonic and the first parameter, but removing this whitespace doesn't seem to help (especially since this whitespace is seemingly ignored anyway):
What did work however was to remove the brackets within the
instruction
rule:which resolves the ambiguity:
From what I understand the brackets indicate an "expected value" and the parser supplies
None
when nothing is found, but what is the parser actually matching in-between the pneumonic and the first parameter in this case?The text was updated successfully, but these errors were encountered: