Conflicting keywords and ID rules [message #1119573] |
Sat, 28 September 2013 16:45 |
rohit ahuja Messages: 27 Registered: February 2013 |
Junior Member |
|
|
Hi All,
I am unable to use the keyword used in some rule, as the value of another,
For e.g.
Consider the below grammar
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Field:
'name' '=' name=ID ',' 'type' '=' type=ID ';'
;
Now if i try something like,
name = john , type = type;
we get error as mismatched input 'type' expecting RULE_ID, is there any way to allow this?
I saw that we can use the ^symbol, but i am looking for some other way if it exists.
name = john , type = ^type;
Any help would be great.
Thanks in Advance,
Rohit
|
|
|
|
|
Re: Conflicting keywords and ID rules [message #1120026 is a reply to message #1119584] |
Sun, 29 September 2013 05:00 |
rohit ahuja Messages: 27 Registered: February 2013 |
Junior Member |
|
|
Christian, Thanks for the reply, it works like a charm!!!
Merkel, i am looking for some other way, as the grammar that i am writing has some legacy cases wherein we need to support this, i understand that it is a keyword, and the ^ symbol is an ex excellent way, but there's no way i can edit the old legacy cases, so i just reproduced the same with a small sample above, and looked for some other workaround..
|
|
|
|
Powered by
FUDForum. Page generated in 0.02701 seconds