On Sunday, December 26, Paul Procacci wrote: 
> 
> use Grammar::Tracer;
> 
> and
> 
> use Grammar::Tracer::Compact;
> 
> Both I've found helpful, though obviously not fool proof.  It'd be nice if
> it show'd why it failed (i.e. what it encountered vs what it expected )
> rather than just a 'failed'.

For what it's worth, you may also like Grammar::PrettyErrors --

Adding this to the definition :

    grammar myTest does Grammar::PrettyErrors {

and then trying to parse the input, yields

        --errors--
                2 │ {
                3 │         a = "bi";
                4 │▶        b = "hi";
                                                                                
                        ^
                5 │ }

        Uh oh, something went wrong around line 4.
        Unable to parse object.

                in block <unit> at grammar.raku line 40

So -- you get the position, and the rule where
it failed ("object").

Brian

Reply via email to