Hi,
I'm trying to implement an editor for Osek-vdx Oil grammar using xtext.
The language contains two main sections, the first one is used to describe the list of attributes and valid values of the second one.
For example, in the first part we say that a TASK is composed by
- an Integer, named "PRIORTY"
- a reference to an EVENT, named "EVENT"
- an enumerate named "SCHEDULE" with values NON and FULL
here is how express it through oil syntax
TASK { // inside the first section
UINT32 PRIORITY; // handled as ValueType
EVENT_TYPE EVENT[]; // handled as VariantType
ENUM [NON, FULL] SCHEDULE; // handled as ReferenceType
};
then, we instantiate a task "t1" with following values using the oil syntax:
TASK t1 { // inside the second section
EVENT=ev1;
PRIORITY=1;
SCHEDULE=NON;
};
what happens is that the only way to understand what should be expected after the "=" is to resolve the link the ID (EVENT, PRIORITY, SCHEDULE) to the corresponding element in the first section
There is a way to handle this three different kind of attribute with three different classes in the model? i.e. writing something like
Attribute returns Attribute:
Value | Reference | Enumerator;
Value returns Value:
{Value}
Type=[ValueType|ID]
'=' Value=INT
";"
;
Enumerator returns Enumerator:
{Enumerator}
Type=[ParameterType|ID]
"=" Value=[EnumeratorType|ID]
";"
;
Reference returns Reference:
{Reference}
Type=[ReferenceType|ID]
'=' Value=[OilObject|ID]
";"
;