Implementing infix dot operator [message #667891] |
Mon, 02 May 2011 15:50 |
Rafael Angarita Messages: 94 Registered: November 2010 |
Member |
|
|
Hello everybody,
I have to implement the infix dot operator to access inner members of objects. For example, I have this grammar:
Domain:
'Name:' name=ID
numericEnumeratedValues=NumericEnumeratedValues
;
NumericEnumeratedValues :
('Values:' '{' enumeratedvalues+=NumericEnumeratedValue (',' enumeratedvalues+=NumericEnumeratedValue)* '}')
;
NumericEnumeratedValue :
value=NUMBER name=ID
;
, so I could write something like:
Name: testDomain
Values: {
0 MyTrueValue
1 MyFalseValue
}
Now I would like to access any of those values from different objects:
For now, is it not really important if the possible values (MyTrueValue and MyFalseValue) are shown automatically after writing the dot. I can work with the Ctrl-space autocompletion.
I was thinking of writing something like:
ConstantReference :
DomainReference ({Point.left = current} '.' right=ValueReference)
;
DomainReference:
dom=[domainRef::Domain]
;
ValueReference:
val=[ecore::EObject] //I dont know what to write here
;
and somehow filter the content shown at the right side of the dot operator, but first, I think the NumericEnumeratedValue of the Domain is not being exported, even though it has a name feature, and second if they were exportend and shown in the ValueReference, I would be able to get and filter by NumericEnumeratedValue type, but I will need to get only the NumericEnumeratedValue belonging to the Domain I wrote at the right side of the dot operator and I don't know how to do it.
I think I maybe going on the wrong path here.
Any advise?
Thank you very much for your help.
|
|
|
|
Powered by
FUDForum. Page generated in 0.01843 seconds