Problem with ID Terminal Rule [message #1782074] |
Fri, 16 February 2018 13:44  |
Eclipse User |
|
|
|
I have a problem identical to the one described in this thread:
https://www.eclipse.org/forums/index.php/t/166300/
I have solved it in exactly the way that Sven prescribed, however the solution creates another problem: the ID terminal seems to be treated as a generic string, allowing characters that my grammar considers illegal. Here is a relevant snippet from my grammar:
Variable_Primary returns PrimaryVariable:
name=Variable_Name
;
Variable_Name:
ID | 'E' | 'e'
;
Real_Value returns ecore::EDouble:
Signed_Int '.' UNSIGNED_INT ('E' Signed_Int)?
;
terminal UNSIGNED_INT returns ecore::ELong:
DIGIT ('_'? DIGIT)*
;
terminal fragment LETTER: 'a'..'z' | 'A'..'Z' | '_';
terminal fragment DIGIT: '0'..'9';
terminal ID:
DIGIT? LETTER (LETTER | DIGIT)*
;
The requirements for the grammar are as follows:
1. The name feature of Variable_Primary cannot include parentheses
2. The name feature of Variable_Primary can be the string literal 'E'
3. The value 1.23E-1 should match the Real_Value data type rule.
With the grammar stated above, requirement #1 is not satisfied, but requirements 2 and 3 are satisfied. Can anyone recommend a way to fulfill all three requirements?
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.49218 seconds