I have a DSL that treats anything that follows the last recognized keyword token as a comment. I am having trouble creating a grammar for this.
Simplified example file:
B KEYWORD this
C KEYWORD this is an error
Grammar thus far:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl ... (cannot post the real link since I'm such a newbie)
(name=ID) 'KEYWORD' ANY_OTHER*;
The first two lines are error free - no comment and a single word comment.
For the third line, these errors are given:
Multiple markers at this line
- mismatched input '<EOF>' expecting 'KEYWORD'
- missing 'KEYWORD' at 'is'
- extraneous input 'C' expecting 'KEYWORD'
- missing 'KEYWORD' at 'error'
- missing 'KEYWORD' at 'an'
I am new to Xtext so hope that I have overlooked a simple solution.
The <EOF> message appears if I have pressed newline after the last line, but there is no <EOF> message if I do not press newline. I assume that when the file is ultimately parsed there will be an <EOF> so have to solve that issue too.