blob: a8c57ca94e03a959c662f86d0f0b3c81ae959a54 [file] [log] [blame]
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:
XDataType | XAssignment | XEnumeration
;
XDataType:
DTKey name = ID '{'
(attributes += Property)*
'}'
;
DTKey:
'DataType' | 'CommObject'
;
// visible copy of the SL comment (documentation not clear about how to access comments)
// TODO: causes error during generation - which can apparently be ignored.
terminal VSL_COMMENT : '//' !('\n'|'\r')* ('\r'? '\n')?;
Property:
'attribute' name=ID (':' (type=TypeRule | typeUndefined?="<Undefined>"))?
(multiplicity = MultiplicityRule)?
('=' value = Value)?
(comment = VSL_COMMENT)?
;
XAssignment:
name = ID '=' expression = ExpressionString';';
ExpressionString: (ID|'['|']'|'-'|','|INT|DOUBLE)*;
Value:
(str = STRING) |
(ival = INT) |
(dval = DOUBLE)
;
terminal DOUBLE returns ecore::EDouble:
('0'..'9')+ '.' ('0'..'9')+
;
XEnumeration:
'Enumeration' name = ID '{'
(literals += XEnumLiteral)*
'}'
;
XEnumLiteral:
name=ID
('=' value = Value)?
(comment = VSL_COMMENT)?
;