Conflicting keywords and ID rules [message #1119573] |
Sat, 28 September 2013 12:45  |
Eclipse User |
|
|
|
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 01:00   |
Eclipse User |
|
|
|
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..
|
|
|
Re: Conflicting keywords and ID rules [message #1120090 is a reply to message #1120026] |
Sun, 29 September 2013 02:45  |
Eclipse User |
|
|
|
ahuja, you have not answered my question:
what other workaround you are looking for?
As long as you can not answer this question, one can not help you.
It may be helpful to be more detailed about "the old legacy cases"
|
|
|
Powered by
FUDForum. Page generated in 0.04060 seconds