|Terminal rule named INT not awaiting an Integer [message #982862]
||Tue, 13 November 2012 08:31
| Franck Malartic
Registered: September 2012
Just to let you know that I run into a problem by using a grammar with terminal rule defined like this :
terminal fragment SIGN : '+' | '-' ;
terminal fragment DIGIT : ('0'..'9');
terminal INT returns ecore::ELong : SIGN? DIGIT+;
Note that my grammar is not using common terminals (org.eclipse.xtext.common.Terminals).
The problem when parsing is a conversion exception : "java.lang.Integer cannot be cast to java.lang.Long".
With the debugger, it appears that org.eclipse.xtext.conversion.impl.AbstractDeclarativeValueConverterService#getConverter(String lexerRule) returns an instance of org.eclipse.xtext.conversion.impl.INTValueConverter instead of the DefaultTerminalConverter.
By changing the terminal rule name to LONG (or anything else) it works fine (so that is not a issue for me anymore).
I am not sure if this is bug or if INT is a some kind of reserved terminal rule name.
Hope that can help,
PS: using eclipse Indigo with xtext 2.2.1.
Powered by FUDForum
. Page generated in 0.01629 seconds