Docs Question - Optional Prefix to Regular Expressions
Closed this issue · 5 comments
Snip from https://softdevteam.github.io/grmtools/latest_release/book/lexcompatibility.html
Both Lex and grmtools lex files support start conditions as an optional prefix to regular expressions, listing necessary states for the input expression to be considered for matching against the input. Lex uses a special action expression BEGIN(state) to switch to the named state. grmtools lex files use a token name prefix.
Could someone point me at an example of this? I'm very curious, and think it might fix an issue that i've been wrestling with.
The example in the repo that uses this is the lrpar/examples/start_states
:
https://github.com/softdevteam/grmtools/blob/master/lrpar/examples/start_states/src/comment.l
When the left hand side matches the current state of the lexer (which starts out in the INITIAL
state)
it tries to apply the regex, if that then matches the state operation
on the right hand side is applied, modifying the current state and a token is produced.
Thank you for the clarification. I'm not quite sure that I follow, but I will give it some more thought before I ask follow-on questions.
I tried to update that hopefully making it a bit clearer.
Thank you for that, but the real issue is that I was reading it in the grocery store checkout line :)
Hey all. Thanks for the help here. Life has gotten in between me and Rust lately, but I've got my head around this now and I suppose we can close the issue.