What you want to do is "external lexing".  When the event triggers you can
write custom code to deliver only the lexeme you want the parser to set,
then resume the Marpa parser.

Sometimes you can accomplish the same thing more easily using lexeme
priorities, however:
https://metacpan.org/pod/release/JKEGL/Marpa-R2-4.000000/pod/Scanless/DSL.pod#priority


Hope this helps, jeffrey

On Sat, Aug 11, 2018 at 1:08 AM, Thomas Weigert <weigert.tho...@gmail.com>
wrote:

> Sorry for the following beginner's question....
>
> I have an ambiguous grammar which I would like to resolve during parsing.
>
> I arranged for an event to be triggered when I have seen enough so that I
> can make a decision whether the current production will be the right one
> (by considering context). I would like to in the event handler either
> accept this lexeme (when I determine that this production is the correct
> one) or reject this lexeme (when I determine that this production is the
> wrong one). If I reject this lexeme, I hope that marpa will go on to try
> the other production which will now be the correct one.
>
> Is this something reasonable to want to accomplish? If so, is there any
> example I could emulate for this behavior. It is easy to accept the lexeme,
> but I am having a hard time figuring out how to reject it and continue
> trying.
>
> Thanks for any suggestions.
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to marpa-parser+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to