Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-ocl.dev] Including OCL grammar into an Xtext based DSL

Dear all,

Looking at the OCLinEcore project, I'm trying to replicate this OCL grammar integration into my Xtext based DSL grammar. The idea is to allow to include the OCL constraint as a String too:



// automatically generated by Xtext
grammar gotten.dsls.Gotten with org.eclipse.ocl.xtext.essentialocl.EssentialOCL

...


SpecificationCS returns essentialocl::ExpSpecificationCS:
{essentialocl::ExpSpecificationCS}
ownedExpression=ExpCS | exprString=UNQUOTED_STRING
;

Constraint returns Constraint:
{Constraint}
'=:' _expression_=SpecificationCS | '=' rule=EString
;

Feature returns Feature:
{Feature}
('context' type=[ecore::EClass|ID] 'def' ':')? name=EString ':' dataType=DataType (constraint=Constraint)?
;

...

terminal UNQUOTED_STRING: // Never forward parsed;
'£$%^£$%^'
;


I've managed to generate the Xtext artifacts with this grammar and at least the generated Xtext editor is working well with the DSL elements not belonging to OCL. But what is not working yet is the OCL grammar, when the parser reaches the ExpCS element it only shows a few keywords, but neither types nor features are shown.

How can I proceed? I appreciate very much any help with this issue.

Best wishes from Madrid,
Pablo Gómez-Abajo




Back to the top