Replies: 3 comments 7 replies
-
There is no such action currently. What's an example of an input you're parsing? |
Beta Was this translation helpful? Give feedback.
-
Ah I see. This doesn't look like a problem that should be solved by the stateful lexer, it looks like a parser issue. The stateful aspects of the lexer should only really be used if you have nested languages with the same token used to terminate and end a nesting, such that they can't be disambiguated any other way. The classic example of this is interpolation such as That said, I'm not sure how you'd express this in the parser. I think what you'll need to do is implement a lexer that wraps the existing one, and synthesises the missing closing |
Beta Was this translation helpful? Give feedback.
-
This is not uncommon BTW, lexers for languages with semantic indentation do something similar, as do some lexers for languages that have optional statement ending |
Beta Was this translation helpful? Give feedback.
-
In my stateful lexer I can enter new groups with
{
, and exit them with}
. Groups can be multiple levels deep.The special character
/
allows you to exit all groups (Returns to root).How would I solve this in particle?
Attempts so far was to introduce a PopToRoot action, but the
lexer.stack
is private.Hopefully there is another approach?
Beta Was this translation helpful? Give feedback.
All reactions