Closed mingodad closed 2 years ago
@mingodad, I think it's possible to make links for definition rules in expecting
lists. (By the way, in your examples, 'construct', 'static', ...
are not rules, but tokens. So they cannot be links.)
Yes I know that they are tokens, but to show then probably the parser used the known failed rule.
There is no way to report line no and column offset if a parser isn't made from a grammar, but constructed with parser combinators. I'll close it for now since I am not planning to implement it.
Just for an working example of this feature on a related project (base on your playground) see https://mingodad.github.io/CocoR-Typescript/playground , for example select the Json
parser (using the select
at the upper middle screen) and edit the Input
example to make it invalid the click parse to see the error message and when clicking see that both grammar/input editor show the the offending rule/input.
Trying to develop/debug grammars using the playground would be easier if when there is an error in the input/source and we click the error message it also jumped to the definition/rule in the grammar. If the parser knows the rule that failed somehow this info could be encoded in the error message to allow jump to it.
Attached is a grammar and input file that actually gives this error message on input:
It seems clear that the failing rule is known due to the
expecting
list provided, so if that rule could also be shown on the grammar editor when clicking the error message that would be nice.Maybe something like this pseudo code:
jancy.peg.zip