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
When my error recovery consumes more than one token through recoverWhile, I get a second misleading error message. For example with the following grammar.
Unfortunately, this solution has the problem that some errors are reported twice. For the same input as above, we get the first error two times. The first time, the error is reported at (2, 2) (after kw), the second time the error is reported at (3, 10) (the first occurrence of invalid).
Am I doing something wrong or is there a better way? Is this considered to be a bug of Grammar-Kit? I think ideally, both cases should not report more than one error. I pushed a project to reproduce the issue to this branch. A "working" solution seems to be making content optional. However, this will obviously no longer report an error when the content is missing. Should recoverWhile only be used on rules which are always optional?
The text was updated successfully, but these errors were encountered:
JojOatXGME
changed the title
Misleading second error when recovery consumes more then one token
Misleading second error when recovery consumes more than one token
Apr 5, 2021
When my error recovery consumes more than one token through
recoverWhile
, I get a second misleading error message. For example with the following grammar.And the following input.
I get two errors.
invalid
:This does not happen when there is only one invalid token. For the following input, only the first error is reported.
A workaround for this issue is to use
recoverWhile
with rules which do never fail (i.e. empty rules).Unfortunately, this solution has the problem that some errors are reported twice. For the same input as above, we get the first error two times. The first time, the error is reported at (2, 2) (after
kw
), the second time the error is reported at (3, 10) (the first occurrence ofinvalid
).Am I doing something wrong or is there a better way? Is this considered to be a bug of Grammar-Kit? I think ideally, both cases should not report more than one error. I pushed a project to reproduce the issue to this branch. A "working" solution seems to be making content optional. However, this will obviously no longer report an error when the content is missing. Should
recoverWhile
only be used on rules which are always optional?The text was updated successfully, but these errors were encountered: