|Re: Terminal Rule Error [message #899973 is a reply to message #899938]
||Fri, 03 August 2012 05:44
| Sebastian Zarnekow
Registered: July 2009
Did you try to use something like|
terminal IdWithHash: '#' ID;
and a value converter that strips the # from that token?
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 03.08.12 07:54, schrieb Kevin Sun:
> I meet a problem about the terminal rule. The grammar I used is following
> grammar org.xtext.example.mydsl.MyDsl with
> org.eclipse.xtext.common.Terminals hidden(CONDITIONAL_COMPILE_BEGIN)
> generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
> '#' name=ID '!' ;
> terminal INCLUDE:
> '#' ('include'|'INCLUDE') WS ID;
> And the following case should be accepted by the grammer
> But I got the error message as following
> Multiple markers at this line
> - missing EOF at 'ut'
> - mismatched character 'p' expecting 'c'
> I tried to find the reason. And, I found that the lexer using an DFA to
> predict which terminal rule should be used. When it find the letter '#'
> followed by the 'i', it decide to use the terminal rule "INCLUDE". But
> it fail to recognize the token, because the input is "#input" not
> Beside using backtrack of Lexer, what can I do to solve this problem?
Powered by FUDForum
. Page generated in 0.03696 seconds