Parsing Problem: Colon and negative number [message #1760653] |
Sun, 30 April 2017 06:02  |
Eclipse User |
|
|
|
Hi together,
I am relatively new to xtext and try to integrate JSONPath syntax elements into an existing grammar.
At the moment, the only problem is that expressions like array[0:-1] (which will return all the elements except the last one) are not parsed correctly. It seems like the parser always uses :- as a token, although only the colon should be one token. The following rules are involved:
Attribute:
...
{IndexAttribute} '[' indices+=AttributeIndex (',' indices+=AttributeIndex)* ']';
AttributeIndex:
{WildcardIndex} '*' |
{NumberIndex} index=JSONNUMBER (':' to=JSONNUMBER (':' step=JSONNUMBER)?)? |
{ExpressionIndex} '(' expression=Expression ')' |
{ConditionIndex} '?' '(' expression=Expression ')';
terminal JSONNUMBER returns ecore::EFloat: // Definition according to JSON standard
'-'? ('0' | ('1'..'9') DIGIT*) ('.' DIGIT+)? (('E' | 'e') ('+' | '-')? DIGIT+)?;
terminal fragment DIGIT:
('0'..'9');
Does anybody have an idea what I am doing wrong here? This would really help me.
Many thanks in advance
Philipp
|
|
|
|
Powered by
FUDForum. Page generated in 0.03672 seconds