| grammar org.eclipse.papyrus.robotics.xtext.datatypes.DTML |
| with org.eclipse.papyrus.uml.textedit.common.xtext.UmlCommon |
| // org.eclipse.xtext.common.Terminals |
| |
| import "http://www.eclipse.org/emf/2002/Ecore" as ecore |
| // import "http://www.eclipse.org/uml2/5.0.0/UML" as uml |
| import "http://www.eclipse.org/papyrus/uml/textedit/common/xtext/UmlCommon" as common |
| |
| |
| generate dTML "http://www.eclipse.org/papyrus/robotics/xtext/datatypes/DTML" |
| |
| Model: |
| DTModel | Assignment |
| ; |
| |
| DTModel: |
| DTKey name = ID '{' |
| (attributes += Property)* |
| '}' |
| ; |
| |
| DTKey: |
| 'DataType' | 'CommObject' |
| ; |
| |
| // visible copy of the SL comment (documentation not clear about how to access comments) |
| terminal VSL_COMMENT : '//' !('\n'|'\r')* ('\r'? '\n')?; |
| |
| Property: |
| 'attribute' name=ID (':' (type=TypeRule | typeUndefined?="<Undefined>"))? |
| (multiplicity = MultiplicityRule)? |
| ('=' value = Value)? |
| (comment = VSL_COMMENT)? |
| ; |
| |
| Assignment: |
| name = ID '=' expression = ExpressionString';'; |
| |
| ExpressionString: (ID|'['|']'|'-'|','|INT|DOUBLE)*; |
| |
| Value: |
| (str = STRING) | |
| (ival = INT) | |
| (dval = DOUBLE) |
| ; |
| |
| terminal DOUBLE returns ecore::EDouble: |
| ('0'..'9')+ '.' ('0'..'9')+ |
| ; |