Skip to content

what's wrong with this grammar? (newbie) #1729

Answered by msujew
VladimirAlexiev asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @VladimirAlexiev,

So there are a few issues with the terminal NOQUOTE; In no particular order:

  1. NOQUOTE does not have an end delimiter. Once the lexer starts tokenizing it, it will not stop until it encounters a " character (which isn't possible if you are in a Transition rule, so it consumes the rest of the input stream).
  2. The langium token builder optimizes the order of terminals by moving terminals "to the front" (i.e. they are tried first when tokenizing), if they can match a single whitespace character. This is the case for NOQUOTE, which is why it shadows everything.
  3. Something that could be a NOQUOTE terminal can also be lexed as an ID. I.e. they are ambiguous. This means that in…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@VladimirAlexiev
Comment options

Answer selected by VladimirAlexiev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants