|How to refer to two rules at the same time [message #908249]
||Wed, 05 September 2012 02:43
| Tu Do
Registered: August 2012
Here is the sample rule (Just replace it in MyDsl grammar):|
elem += (integer)*
properties += (property)* 'int' (name += integer ('=' values += INT)?) (',' name+=integer ('=' values += INT)?)* ';'
/* I have to put the rule name as "integer", so when users hover
* on variable names, they see exactly type "integer". This is a bit
* adhoc, but it's acceptable for the time being. However, using this method
* If some other rules refer to "integer", it can only either retrieve the name
* in this "integer" rule or its
name = ID
* Example: assignment like static final num1 = 2, num2 = 3.... the variable name of type integer can't be referred, since I have to either refer to "int_rule" rule to retrieve its value and its properties or "integer" to retrieve its name. I can't get both.
name = [integer] // or name = [int_rule]
'final' | 'static' | 'public' | 'private'
I explained in the comments. Basically, the rule for integer is made up of two rules: int_rule and integer and I want to use both in assignment rule. However, Xtext can only let me refer to one rule, and the name feature can just refer to one name instance of the rule, but not multiple name instances in the same rule like in the example. I really need both the informations from both rules, yet I can only refer to one of them.
[Updated on: Wed, 05 September 2012 03:10]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02467 seconds