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
{{ message }}
Repository navigation
Is it possible to get a report on which production was being handled when an error arose? #419
Here's an error message I encountered while using participle to parse a value change dump (VCD) file. See: filmil/go-vcd-parser#2.
unexpected token "V" (expected <kwend>)
Now participle is of course correct. But it is not exactly helpful. It does not tell me which production was parsed when the error occurred. I have multiple productions that may end with keyword $end. And one of the issues may be that my grammar has started parsing a wrong production somehow.
As follow-up: #463 (merged into the parser now) improves this case — the error now includes the token type, e.g. unexpected token "V" of type Ident (expected <kwend>), which helps distinguish "wrong production started" from "wrong token type". A full production-stack report would require threading production context through the error path; that's a bigger change, but with #463 a good chunk of the confusion is addressed. Suggest closing this as partially addressed by #265/#463.
Activity
alecthomas commentedon Jan 7, 2025
No, this is not possible. Errors don't currently track the production that triggered them.
Pastalikek65 commentedon Aug 9, 2026
As follow-up: #463 (merged into the parser now) improves this case — the error now includes the token type, e.g.
unexpected token "V" of type Ident (expected <kwend>), which helps distinguish "wrong production started" from "wrong token type". A full production-stack report would require threading production context through the error path; that's a bigger change, but with #463 a good chunk of the confusion is addressed. Suggest closing this as partially addressed by #265/#463.