AzureMarker / intellij-lalrpop

Jetbrains plugin for the LALRPOP parser-generator
MIT License
16 stars 2 forks source link

Give the lexer more tolerance while reading a CODE token #40

Open dnbln opened 3 years ago

dnbln commented 3 years ago

I got tired of seeing something like this while editing action code:

https://user-images.githubusercontent.com/39565527/104943592-a44b7900-59be-11eb-8844-55d119c641b2.mp4

Might have been overkill to implement but it also fails if I put a (, [ or { inside a string literal and don't close it:

https://user-images.githubusercontent.com/39565527/104946250-67818100-59c2-11eb-8f88-36674337c601.mp4

So here are a few thoughts to improve it at least:

AzureMarker commented 3 years ago

I was just noticing this again today, though mostly when adding a new nonterminal or modifying its grammar. Parsing fails when you have a partial definition (MyNonterminal: MyTyp^ or MyNonterminal: MyType = <name:^).

dnbln commented 3 years ago

In those cases the tokens are correct, just the parser doesn't know how to recover from them. With the CODE it's a different issue, where the lexer thinks the token ends at EOF or too soon (typed one )/]/} too many)