SlideShare ist ein Scribd-Unternehmen logo
1 von 79
Downloaden Sie, um offline zu lesen
modelsUsing
with
Holger Schill
Generated model
Generated model
Generated model
You will come to the point…
Where you want to take control…
Problem
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Model:
elements+=AbstractElement*;
AbstractElement:
Element | SecondElement | ThirdElement
;
Element:
'Element' name=ID ref=[AbstractElement]
;
SecondElement:
'SecondElement' name=ID
;
ThirdElement:
'ThirdElement' name=ID
;
Example
Problem
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Model:
elements+=AbstractElement*;
AbstractElement:
Element | SecondElement | ThirdElement
;
Element:
'Element' name=ID ref=[AbstractElement]
;
SecondElement:
'SecondElement' name=ID
;
ThirdElement:
'ThirdElement' name=ID
;
Example
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Model:
elements+=AbstractElement*;
AbstractElement:
Element | SecondElement | ThirdElement
;
Element:
'Element' name=ID ref=[Referenceable]
;
SecondElement:
'SecondElement' name=ID
;
ThirdElement:
'ThirdElement' name=ID
;
Referenceable:
SecondElement | ThirdElement
;
Never invoked by the parser
Example
Fake Rules to influence EMF Generator
For rapid prototyping the generated model is fine
When to stay with the generated model
For rapid prototyping the generated model is fine
Automatic synchronisation from grammar to model
When to stay with the generated model
For rapid prototyping the generated model is fine
Automatic synchronisation from grammar to model
If you do not need to introduce fake rules
When to stay with the generated model
But what if…
DSL DSL DSL
Order for generating DSLs is important
But what if…
DSL DSL DSL
Order for generating DSLs is important
Eagerly loaded
DSL DSL
DSLs reference each other
But what if…
Imported Model
Imported Model
Imported Model
Xtext Nature !
Still that tree editor…
Still that tree editor…
Merging can be difficult
Generation Gap Pattern…
What is Xcore?
The MyDSL example in Xcore
Derives ecore and genmodel
Put code directly in the model
Put code directly in the model
Load Xcore file
No Registration needed
Workflow configuration
Don’t forget the Xcore dependency
Don’t forget the Xcore dependency
Caused by: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/org.xtext.example.mydsl.model/model/MyDsl.xcore; systemId:
platform:/resource/org.xtext.example.mydsl.model/model/MyDsl.xcore; lineNumber: 1; columnNumber: 1; Content is not allowed in
prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
Invokes XcoreStandaloneSetup to register *.xcore
There is a wizard for that…
More complex setups
Ecore
model
Xcore
model
Xtext DSL
Xcore imports another ecore model
Xtext DSL imports Xcore
Ecore
model
Xcore
model
Ecore
model
Xcore
model
Xtext DSL
Caused by: java.lang.IllegalStateException: Problem parsing 'classpath:/org/xtext/example/
mydsl/MyDsl.xtext':
TransformationDiagnostic: null:9 Cannot find compatible feature name in sealed EClass
Greeting from imported package http://www.xtext.org/example/mydsl/MyDsl: The type 'Greeting'
does not have a feature 'name'. (ErrorCode: CannotCreateTypeInSealedMetamodel)
at org.eclipse.xtext.generator.LanguageConfig.setUri(LanguageConfig.java:247)
... 42 more
You will face that Exception
Caused by: java.lang.IllegalStateException: Problem parsing 'classpath:/org/xtext/example/
mydsl/MyDsl.xtext':
TransformationDiagnostic: null:9 Cannot find compatible feature name in sealed EClass
Greeting from imported package http://www.xtext.org/example/mydsl/MyDsl: The type 'Greeting'
does not have a feature 'name'. (ErrorCode: CannotCreateTypeInSealedMetamodel)
at org.eclipse.xtext.generator.LanguageConfig.setUri(LanguageConfig.java:247)
... 42 more
You will face that Exception
Ecore
model
Xcore
model
Proxy not resolvable
Index is not aware of genmodel
that the Xcore model links against
Proxy
But I added that stuff in the StandaloneSetup…?
But I added that stuff in the StandaloneSetup…?
ResourceSet
Resource
Resource
Resource
Resource
ResourceSet
Resource
Resource
Ecore
model
Xcore
model
Proxy
What’s happening?
ResourceSet
Grammar
Xcore resource
Ecore model
Genmodel
Index
ResourceDescription
ResourceDescription
ResourceDescription
ResourceDescription
Ecore
model
Xcore
model
Proxy
What’s happening?
Name
Index
ResourceDescription
ResourceDescription
ResourceDescription
ResourceDescription
Ecore
model
Xcore
model
Proxy
What’s happening?
URI
Index
ResourceDescription
ResourceDescription
ResourceDescription
ResourceDescription
Ecore
model
Xcore
model
What’s happening?
resolved
Index
ResourceDescription
ResourceDescription
ResourceDescription
ResourceDescription
Force same ResourceSet
More elegant
More complex example
Xtext DSL Xtext DSL
Languages referencing each other
More complex example
Xtext DSL Xtext DSL
Languages referencing each other
Plugin
Xtext
DSL 1
Plugin
Xtext
DSL 1
Problem
Circular dependency
Buddypolicy
Introduce a Ecore model as a protocol
Xtext DSL Xtext DSL
Ecore
model
Generated
Model
Generated
Model
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
import "http://www.xtext.org/common/model" as common
PackageDeclaration returns common::PackageDeclaration:
'package' name=FQN
content+=Element
;
Element returns common::NamedElement:
{Element}
'element' name=ID '{'
ref=[common::Referenceable | FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
Introduce a Ecore model as a protocol
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
import "http://www.xtext.org/common/model" as common
PackageDeclaration returns common::PackageDeclaration:
'package' name=FQN
content+=Element
;
Element returns common::NamedElement:
{Element}
'element' name=ID '{'
ref=[common::Referenceable | FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
Introduce a Ecore model as a protocol
More complex example
Xtext DSL Xtext DSL
Xcore
model
Xcore
model
Imported
Model
Imported
Model
More complex example
Xtext DSL Xtext DSL
Xcore
model
Xcore
model
Imported
Model
Imported
Model
Same Plugin
More complex example
Xtext DSL Xtext DSL
Xcore
model
Xcore
model
Imported
Model
Imported
Model
Different plugins
More complex example
Xtext DSL Xtext DSL
Ecore
model
Xcore
model
Xcore
model
Imported
Model
Imported
Model
Ecore
model
Xcore
model
Xcore
model
grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals
import "org.xtext.example.myfirstdsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.xtext.org/common/model" as common
import "org.xtext.example.myseconddsl" as second
PackageDeclaration returns common::PackageDeclaration :
'package' name=FQN
content+=FirstElement*
;
FirstElement :
'element' name=ID '{'
ref=[second::SecondElement| FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
A lot of imports…
grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals
import "org.xtext.example.myfirstdsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.xtext.org/common/model" as common
import "org.xtext.example.myseconddsl" as second
PackageDeclaration returns common::PackageDeclaration :
'package' name=FQN
content+=FirstElement*
;
FirstElement :
'element' name=ID '{'
ref=[second::SecondElement| FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
Have same root node…
grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals
import "org.xtext.example.myfirstdsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.xtext.org/common/model" as common
import "org.xtext.example.myseconddsl" as second
PackageDeclaration returns common::PackageDeclaration :
'package' name=FQN
content+=FirstElement*
;
FirstElement :
'element' name=ID '{'
ref=[second::SecondElement| FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
Use implicitly imported classifier
MWE2 configuration
Same for both languages
grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals
import "org.xtext.example.myfirstdsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.xtext.org/common/model" as common
import "org.xtext.example.myseconddsl" as second
PackageDeclaration returns common::PackageDeclaration :
'package' name=FQN
content+=FirstElement*
;
FirstElement :
'element' name=ID '{'
ref=[second::SecondElement| FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
But there is a small problem
grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals
import "org.xtext.example.myfirstdsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.xtext.org/common/model" as common
import "org.xtext.example.myseconddsl" as second
PackageDeclaration returns common::PackageDeclaration :
'package' name=FQN
content+=FirstElement*
;
FirstElement :
'element' name=ID '{'
ref=[second::SecondElement| FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
CA is showing both elements?
grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals
import "org.xtext.example.myfirstdsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.xtext.org/common/model" as common
import "org.xtext.example.myseconddsl" as second
PackageDeclaration returns common::PackageDeclaration :
'package' name=FQN
content+=FirstElement*
;
FirstElement :
'element' name=ID '{'
ref=[second::SecondElement| FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
CA is showing both elements?
Xtext DSL Xtext DSL
Ecore
model
Xcore
model
Xcore
model
generated
Model
generated
Model
One way to solve that…
One way to solve that…
One way to solve that…
grammar org.xtext.example.seconddsl.Lang with org.eclipse.xtext.common.Terminals
generate generatedSecondModel "http://www.xtext.org/generatedSecondModel"
import "org.xtext.example.myseconddsl"
import "http://www.xtext.org/common/model" as common
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "org.xtext.example.myfirstdsl" as first
PackageDeclaration returns common::PackageDeclaration :
'package' name=FQN
content+=SecondElement*
;
SecondElement returns SecondElement:
{CustomSecondElement}
'element' name=ID '{'
ref=[first::FirstElement | FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
One way to solve that…
grammar org.xtext.example.seconddsl.Lang with org.eclipse.xtext.common.Terminals
generate generatedSecondModel "http://www.xtext.org/generatedSecondModel"
import "org.xtext.example.myseconddsl"
import "http://www.xtext.org/common/model" as common
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "org.xtext.example.myfirstdsl" as first
PackageDeclaration returns common::PackageDeclaration :
'package' name=FQN
content+=SecondElement*
;
SecondElement returns SecondElement:
{CustomSecondElement}
'element' name=ID '{'
ref=[first::FirstElement | FQN]?
'}'
;
FQN:
ID ('.' ID)*
;
But when I run it….
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: Generator)
java.lang.RuntimeException: Could not find a GenModel for EPackage 'http://www.xtext.org/
generatedSecondModel' from http://www.xtext.org/generatedSecondModel
If the missing GenModel has been generated via EMFGeneratorFragment or EcoreGeneratorFragment make
sure to run it first in the workflow.
If you have a *.genmodel-file, make sure to register it via
StandaloneSetup.registerGenModelFile(String)
at org.eclipse.xtext.generator.GenModelAccess.getGenModelResource(GenModelAccess.java:137)
at org.eclipse.xtext.generator.GenModelAccess.getGenPackage(GenModelAccess.java:85)
But when I run it….
// generates Java API for the generated EPackages
fragment = ecore.EMFGeneratorFragment auto-inject {}
Don’t forget the EMFGeneratorFragment
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: Generator)
java.lang.RuntimeException: Could not find a GenModel for EPackage 'http://www.xtext.org/
generatedSecondModel' from http://www.xtext.org/generatedSecondModel
If the missing GenModel has been generated via EMFGeneratorFragment or EcoreGeneratorFragment make
sure to run it first in the workflow.
If you have a *.genmodel-file, make sure to register it via
StandaloneSetup.registerGenModelFile(String)
at org.eclipse.xtext.generator.GenModelAccess.getGenModelResource(GenModelAccess.java:137)
at org.eclipse.xtext.generator.GenModelAccess.getGenPackage(GenModelAccess.java:85)
There was nothing about Xbase so far…
Using Xbase
Wizard does crazy things…// automatically generated by Xtext
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
import "http://www.xtext.org/example/xbase"
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types
import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
MyClass returns MyClass:
{MyClass}
'MyClass'
'{'
('ref' ref=JvmTypeReference)?
('body' body=XBlockExpression)?
'}';
JvmTypeReference returns types::JvmTypeReference:
JvmParameterizedTypeReference_Impl | JvmGenericArrayTypeReference | JvmWildcardTypeReference | JvmAnyTypeReference | JvmMultiTypeReference | JvmDelegateTypeReference | JvmSynonymTypeReference | JvmUnknownTypeReference | JvmInnerTypeReference;
XExpression returns xbase::XExpression:
XIfExpression | XSwitchExpression | XBlockExpression | XVariableDeclaration | XMemberFeatureCall | XFeatureCall | XConstructorCall | XBooleanLiteral | XNullLiteral | XNumberLiteral | XStringLiteral | XListLiteral | XSetLiteral | XClosure | XCastedExpression | XBinaryOperation | XUnaryOperation | XPostfixOperation | XForLoopExpression | XBasicForLoopExpression | XDoWhileExpression | XWhileExpression | XTypeLiteral | XInstanceOfExpression | XThrowExpression | XTryCatchFinallyExpression | XAssignment | XReturnExpression | XSynchronizedExpression;
JvmType returns types::JvmType:
JvmVoid | JvmPrimitiveType | JvmArrayType | JvmTypeParameter | JvmAnnotationType | JvmEnumerationType | JvmGenericType;
JvmTypeConstraint returns types::JvmTypeConstraint:
JvmUpperBound | JvmLowerBound;
JvmParameterizedTypeReference returns types::JvmParameterizedTypeReference:
JvmParameterizedTypeReference_Impl | JvmInnerTypeReference;
JvmMember returns types::JvmMember:
JvmAnnotationType | JvmEnumerationType | JvmEnumerationLiteral | JvmGenericType | JvmField_Impl | JvmConstructor | JvmOperation;
JvmAnnotationValue returns types::JvmAnnotationValue:
JvmIntAnnotationValue | JvmBooleanAnnotationValue | JvmByteAnnotationValue | JvmShortAnnotationValue | JvmLongAnnotationValue | JvmDoubleAnnotationValue | JvmFloatAnnotationValue | JvmCharAnnotationValue | JvmStringAnnotationValue | JvmTypeAnnotationValue | JvmAnnotationAnnotationValue | JvmEnumAnnotationValue | JvmCustomAnnotationValue;
JvmIdentifiableElement returns types::JvmIdentifiableElement:
JvmVoid | JvmPrimitiveType | JvmArrayType | JvmTypeParameter | JvmAnnotationType | JvmEnumerationType | JvmEnumerationLiteral | JvmGenericType | JvmField_Impl | JvmConstructor | JvmOperation | JvmFormalParameter;
XBlockExpression returns xbase::XBlockExpression:
{xbase::XBlockExpression}
'XBlockExpression'
'{'
('expressions' '{' expressions+=XExpression ( "," expressions+=XExpression)* '}' )?
'}';
JvmParameterizedTypeReference_Impl returns types::JvmParameterizedTypeReference:
{types::JvmParameterizedTypeReference}
'JvmParameterizedTypeReference'
'{'
('type' type=[types::JvmType|EString])?
('arguments' '{' arguments+=JvmTypeReference ( "," arguments+=JvmTypeReference)* '}' )?
'}';
JvmGenericArrayTypeReference returns types::JvmGenericArrayTypeReference:
{types::JvmGenericArrayTypeReference}
'JvmGenericArrayTypeReference'
'{'
('componentType' componentType=JvmTypeReference)?
'}';
JvmWildcardTypeReference returns types::JvmWildcardTypeReference:
{types::JvmWildcardTypeReference}
'JvmWildcardTypeReference'
'{'
('constraints' '{' constraints+=JvmTypeConstraint ( "," constraints+=JvmTypeConstraint)* '}' )?
'}';
JvmAnyTypeReference returns types::JvmAnyTypeReference:
{types::JvmAnyTypeReference}
'JvmAnyTypeReference'
'{'
('type' type=[types::JvmType|EString])?
'}';
JvmMultiTypeReference returns types::JvmMultiTypeReference:
{types::JvmMultiTypeReference}
'JvmMultiTypeReference'
'{'
('type' type=[types::JvmType|EString])?
('references' '{' references+=JvmTypeReference ( "," references+=JvmTypeReference)* '}' )?
'}';
JvmDelegateTypeReference returns types::JvmDelegateTypeReference:
{types::JvmDelegateTypeReference}
'JvmDelegateTypeReference'
'{'
('delegate' delegate=[types::JvmTypeReference|EString])?
'}';
JvmSynonymTypeReference returns types::JvmSynonymTypeReference:
{types::JvmSynonymTypeReference}
'JvmSynonymTypeReference'
'{'
('type' type=[types::JvmType|EString])?
('references' '{' references+=JvmTypeReference ( "," references+=JvmTypeReference)* '}' )?
'}';
JvmUnknownTypeReference returns types::JvmUnknownTypeReference:
{types::JvmUnknownTypeReference}
'JvmUnknownTypeReference'
;
JvmInnerTypeReference returns types::JvmInnerTypeReference:
{types::JvmInnerTypeReference}
'JvmInnerTypeReference'
'{'
('type' type=[types::JvmType|EString])?
('arguments' '{' arguments+=JvmTypeReference ( "," arguments+=JvmTypeReference)* '}' )?
('outer' outer=JvmParameterizedTypeReference)?
'}';
JvmVoid returns types::JvmVoid:
{types::JvmVoid}
'JvmVoid'
;
JvmPrimitiveType returns types::JvmPrimitiveType:
{types::JvmPrimitiveType}
'JvmPrimitiveType'
'{'
('simpleName' simpleName=EString)?
('arrayType' arrayType=JvmArrayType)?
'}';
JvmArrayType returns types::JvmArrayType:
{types::JvmArrayType}
'JvmArrayType'
'{'
('arrayType' arrayType=JvmArrayType)?
'}';
JvmTypeParameter returns types::JvmTypeParameter:
{types::JvmTypeParameter}
'JvmTypeParameter'
name=EString
'{'
('arrayType' arrayType=JvmArrayType)?
('constraints' '{' constraints+=JvmTypeConstraint ( "," constraints+=JvmTypeConstraint)* '}' )?
'}';
JvmAnnotationType returns types::JvmAnnotationType:
{types::JvmAnnotationType}
(deprecated?='deprecated')?
(abstract?='abstract')?
(static?='static')?
(final?='final')?
'JvmAnnotationType'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('packageName' packageName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('arrayType' arrayType=JvmArrayType)?
('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )?
('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )?
'}';
JvmEnumerationType returns types::JvmEnumerationType:
{types::JvmEnumerationType}
(deprecated?='deprecated')?
(abstract?='abstract')?
(static?='static')?
(final?='final')?
'JvmEnumerationType'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('packageName' packageName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('arrayType' arrayType=JvmArrayType)?
('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )?
('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )?
'}';
JvmGenericType returns types::JvmGenericType:
{types::JvmGenericType}
(deprecated?='deprecated')?
(abstract?='abstract')?
(static?='static')?
(final?='final')?
(interface?='interface')?
(strictFloatingPoint?='strictFloatingPoint')?
(anonymous?='anonymous')?
'JvmGenericType'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('packageName' packageName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('arrayType' arrayType=JvmArrayType)?
('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )?
('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )?
('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )?
'}';
EString returns ecore::EString:
STRING | ID;
JvmAnnotationReference returns types::JvmAnnotationReference:
{types::JvmAnnotationReference}
'JvmAnnotationReference'
'{'
('annotation' annotation=[types::JvmAnnotationType|EString])?
('explicitValues' '{' explicitValues+=JvmAnnotationValue ( "," explicitValues+=JvmAnnotationValue)* '}' )?
'}';
enum JvmVisibility returns types::JvmVisibility:
DEFAULT = 'DEFAULT' | PRIVATE = 'PRIVATE' | PROTECTED = 'PROTECTED' | PUBLIC = 'PUBLIC';
EBoolean returns ecore::EBoolean:
'true' | 'false';
JvmOperation returns types::JvmOperation:
{types::JvmOperation}
(deprecated?='deprecated')?
(varArgs?='varArgs')?
(static?='static')?
(final?='final')?
(abstract?='abstract')?
(synchronized?='synchronized')?
(default?='default')?
(native?='native')?
(strictFloatingPoint?='strictFloatingPoint')?
'JvmOperation'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )?
('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )?
('parameters' '{' parameters+=JvmFormalParameter ( "," parameters+=JvmFormalParameter)* '}' )?
('exceptions' '{' exceptions+=JvmTypeReference ( "," exceptions+=JvmTypeReference)* '}' )?
('returnType' returnType=JvmTypeReference)?
('defaultValue' defaultValue=JvmAnnotationValue)?
'}';
JvmIntAnnotationValue returns types::JvmIntAnnotationValue:
{types::JvmIntAnnotationValue}
'JvmIntAnnotationValue'
'{'
('values' '{' values+=EInt ( "," values+=EInt)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmBooleanAnnotationValue returns types::JvmBooleanAnnotationValue:
{types::JvmBooleanAnnotationValue}
'JvmBooleanAnnotationValue'
'{'
('values' '{' values+=EBoolean ( "," values+=EBoolean)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmByteAnnotationValue returns types::JvmByteAnnotationValue:
{types::JvmByteAnnotationValue}
'JvmByteAnnotationValue'
'{'
('values' '{' values+=EByte ( "," values+=EByte)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmShortAnnotationValue returns types::JvmShortAnnotationValue:
{types::JvmShortAnnotationValue}
'JvmShortAnnotationValue'
'{'
('values' '{' values+=EShort ( "," values+=EShort)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmLongAnnotationValue returns types::JvmLongAnnotationValue:
{types::JvmLongAnnotationValue}
'JvmLongAnnotationValue'
'{'
('values' '{' values+=ELong ( "," values+=ELong)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmDoubleAnnotationValue returns types::JvmDoubleAnnotationValue:
{types::JvmDoubleAnnotationValue}
'JvmDoubleAnnotationValue'
'{'
('values' '{' values+=EDouble ( "," values+=EDouble)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmFloatAnnotationValue returns types::JvmFloatAnnotationValue:
{types::JvmFloatAnnotationValue}
'JvmFloatAnnotationValue'
'{'
('values' '{' values+=EFloat ( "," values+=EFloat)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmCharAnnotationValue returns types::JvmCharAnnotationValue:
{types::JvmCharAnnotationValue}
'JvmCharAnnotationValue'
'{'
('values' '{' values+=EChar ( "," values+=EChar)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmStringAnnotationValue returns types::JvmStringAnnotationValue:
{types::JvmStringAnnotationValue}
'JvmStringAnnotationValue'
'{'
('values' '{' values+=EString ( "," values+=EString)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmTypeAnnotationValue returns types::JvmTypeAnnotationValue:
{types::JvmTypeAnnotationValue}
'JvmTypeAnnotationValue'
'{'
('operation' operation=[types::JvmOperation|EString])?
('values' '{' values+=JvmTypeReference ( "," values+=JvmTypeReference)* '}' )?
'}';
JvmAnnotationAnnotationValue returns types::JvmAnnotationAnnotationValue:
{types::JvmAnnotationAnnotationValue}
'JvmAnnotationAnnotationValue'
'{'
('operation' operation=[types::JvmOperation|EString])?
('values' '{' values+=JvmAnnotationReference ( "," values+=JvmAnnotationReference)* '}' )?
'}';
JvmEnumAnnotationValue returns types::JvmEnumAnnotationValue:
{types::JvmEnumAnnotationValue}
'JvmEnumAnnotationValue'
'{'
('operation' operation=[types::JvmOperation|EString])?
('values' '(' values+=[types::JvmEnumerationLiteral|EString] ( "," values+=[types::JvmEnumerationLiteral|EString])* ')' )?
'}';
JvmCustomAnnotationValue returns types::JvmCustomAnnotationValue:
{types::JvmCustomAnnotationValue}
'JvmCustomAnnotationValue'
'{'
('operation' operation=[types::JvmOperation|EString])?
('values' '(' values+=[ecore::EObject|EString] ( "," values+=[ecore::EObject|EString])* ')' )?
'}';
JvmFormalParameter returns types::JvmFormalParameter:
{types::JvmFormalParameter}
'JvmFormalParameter'
name=EString
'{'
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('parameterType' parameterType=JvmTypeReference)?
'}';
EInt returns ecore::EInt:
'-'? INT;
EByte returns ecore::EByte:
'-'? INT;
EShort returns ecore::EShort:
'-'? INT;
ELong returns ecore::ELong:
'-'? INT;
EDouble returns ecore::EDouble:
'-'? INT? '.' INT (('E'|'e') '-'? INT)?;
EFloat returns ecore::EFloat:
'-'? INT? '.' INT (('E'|'e') '-'? INT)?;
EChar returns ecore::EChar:
'-'? INT;
JvmEnumerationLiteral returns types::JvmEnumerationLiteral:
{types::JvmEnumerationLiteral}
(deprecated?='deprecated')?
(static?='static')?
(final?='final')?
(volatile?='volatile')?
(transient?='transient')?
(constant?='constant')?
'JvmEnumerationLiteral'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('constantValue' constantValue=EJavaObject)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )?
('type' type=JvmTypeReference)?
'}';
EJavaObject returns ecore::EJavaObject:
'EJavaObject' /* TODO: implement this rule and an appropriate IValueConverter */;
EObject returns ecore::EObject:
{ecore::EObject}
'EObject'
;
JvmField_Impl returns types::JvmField:
{types::JvmField}
(deprecated?='deprecated')?
(static?='static')?
(final?='final')?
(volatile?='volatile')?
(transient?='transient')?
(constant?='constant')?
'JvmField'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('constantValue' constantValue=EJavaObject)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )?
('type' type=JvmTypeReference)?
'}';
JvmConstructor returns types::JvmConstructor:
{types::JvmConstructor}
(deprecated?='deprecated')?
(varArgs?='varArgs')?
'JvmConstructor'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )?
('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )?
('parameters' '{' parameters+=JvmFormalParameter ( "," parameters+=JvmFormalParameter)* '}' )?
('exceptions' '{' exceptions+=JvmTypeReference ( "," exceptions+=JvmTypeReference)* '}' )?
'}';
JvmUpperBound returns types::JvmUpperBound:
{types::JvmUpperBound}
'JvmUpperBound'
'{'
('typeReference' typeReference=JvmTypeReference)?
'}';
JvmLowerBound returns types::JvmLowerBound:
{types::JvmLowerBound}
'JvmLowerBound'
'{'
('typeReference' typeReference=JvmTypeReference)?
'}';
XIfExpression returns xbase::XIfExpression:
{xbase::XIfExpression}
'XIfExpression'
'{'
('if' if=XExpression)?
('then' then=XExpression)?
('else' else=XExpression)?
'}';
XSwitchExpression returns xbase::XSwitchExpression:
{xbase::XSwitchExpression}
'XSwitchExpression'
'{'
('switch' switch=XExpression)?
('cases' '{' cases+=XCasePart ( "," cases+=XCasePart)* '}' )?
('default' default=XExpression)?
('declaredParam' declaredParam=JvmFormalParameter)?
'}';
XVariableDeclaration returns xbase::XVariableDeclaration:
{xbase::XVariableDeclaration}
(writeable?='writeable')?
'XVariableDeclaration'
name=EString
'{'
('type' type=JvmTypeReference)?
('right' right=XExpression)?
'}';
XMemberFeatureCall returns xbase::XMemberFeatureCall:
{xbase::XMemberFeatureCall}
(explicitOperationCall?='explicitOperationCall')?
(explicitStatic?='explicitStatic')?
(nullSafe?='nullSafe')?
'XMemberFeatureCall'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('memberCallTarget' memberCallTarget=XExpression)?
('memberCallArguments' '{' memberCallArguments+=XExpression ( "," memberCallArguments+=XExpression)* '}' )?
'}';
XFeatureCall returns xbase::XFeatureCall:
{xbase::XFeatureCall}
(explicitOperationCall?='explicitOperationCall')?
'XFeatureCall'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('featureCallArguments' '{' featureCallArguments+=XExpression ( "," featureCallArguments+=XExpression)* '}' )?
'}';
XConstructorCall returns xbase::XConstructorCall:
{xbase::XConstructorCall}
(explicitConstructorCall?='explicitConstructorCall')?
'XConstructorCall'
'{'
('constructor' constructor=[types::JvmConstructor|EString])?
('arguments' '{' arguments+=XExpression ( "," arguments+=XExpression)* '}' )?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
'}';
XBooleanLiteral returns xbase::XBooleanLiteral:
{xbase::XBooleanLiteral}
(isTrue?='isTrue')?
'XBooleanLiteral'
;
XNullLiteral returns xbase::XNullLiteral:
{xbase::XNullLiteral}
'XNullLiteral'
;
XNumberLiteral returns xbase::XNumberLiteral:
{xbase::XNumberLiteral}
'XNumberLiteral'
'{'
('value' value=EString)?
'}';
XStringLiteral returns xbase::XStringLiteral:
{xbase::XStringLiteral}
'XStringLiteral'
'{'
('value' value=EString)?
'}';
XListLiteral returns xbase::XListLiteral:
{xbase::XListLiteral}
'XListLiteral'
'{'
('elements' '{' elements+=XExpression ( "," elements+=XExpression)* '}' )?
'}';
XSetLiteral returns xbase::XSetLiteral:
{xbase::XSetLiteral}
'XSetLiteral'
'{'
('elements' '{' elements+=XExpression ( "," elements+=XExpression)* '}' )?
'}';
XClosure returns xbase::XClosure:
{xbase::XClosure}
(explicitSyntax?='explicitSyntax')?
'XClosure'
'{'
('declaredFormalParameters' '{' declaredFormalParameters+=JvmFormalParameter ( "," declaredFormalParameters+=JvmFormalParameter)* '}' )?
('expression' expression=XExpression)?
'}';
XCastedExpression returns xbase::XCastedExpression:
{xbase::XCastedExpression}
'XCastedExpression'
'{'
('type' type=JvmTypeReference)?
('target' target=XExpression)?
'}';
XBinaryOperation returns xbase::XBinaryOperation:
{xbase::XBinaryOperation}
(reassignFirstArgument?='reassignFirstArgument')?
'XBinaryOperation'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('leftOperand' leftOperand=XExpression)?
('rightOperand' rightOperand=XExpression)?
'}';
XUnaryOperation returns xbase::XUnaryOperation:
{xbase::XUnaryOperation}
'XUnaryOperation'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('operand' operand=XExpression)?
'}';
XPostfixOperation returns xbase::XPostfixOperation:
{xbase::XPostfixOperation}
'XPostfixOperation'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('operand' operand=XExpression)?
'}';
XForLoopExpression returns xbase::XForLoopExpression:
{xbase::XForLoopExpression}
'XForLoopExpression'
'{'
('forExpression' forExpression=XExpression)?
('eachExpression' eachExpression=XExpression)?
('declaredParam' declaredParam=JvmFormalParameter)?
'}';
XBasicForLoopExpression returns xbase::XBasicForLoopExpression:
{xbase::XBasicForLoopExpression}
'XBasicForLoopExpression'
'{'
('expression' expression=XExpression)?
('eachExpression' eachExpression=XExpression)?
('initExpressions' '{' initExpressions+=XExpression ( "," initExpressions+=XExpression)* '}' )?
('updateExpressions' '{' updateExpressions+=XExpression ( "," updateExpressions+=XExpression)* '}' )?
'}';
XDoWhileExpression returns xbase::XDoWhileExpression:
{xbase::XDoWhileExpression}
'XDoWhileExpression'
'{'
('predicate' predicate=XExpression)?
('body' body=XExpression)?
'}';
XWhileExpression returns xbase::XWhileExpression:
{xbase::XWhileExpression}
'XWhileExpression'
'{'
('predicate' predicate=XExpression)?
('body' body=XExpression)?
'}';
XTypeLiteral returns xbase::XTypeLiteral:
'XTypeLiteral'
'{'
('arrayDimensions' '{' arrayDimensions+=EString ( "," arrayDimensions+=EString)* '}' )?
'type' type=[types::JvmType|EString]
'}';
XInstanceOfExpression returns xbase::XInstanceOfExpression:
'XInstanceOfExpression'
'{'
'type' type=JvmTypeReference
'expression' expression=XExpression
'}';
XThrowExpression returns xbase::XThrowExpression:
{xbase::XThrowExpression}
'XThrowExpression'
'{'
('expression' expression=XExpression)?
'}';
XTryCatchFinallyExpression returns xbase::XTryCatchFinallyExpression:
{xbase::XTryCatchFinallyExpression}
'XTryCatchFinallyExpression'
'{'
('expression' expression=XExpression)?
('finallyExpression' finallyExpression=XExpression)?
('catchClauses' '{' catchClauses+=XCatchClause ( "," catchClauses+=XCatchClause)* '}' )?
'}';
XAssignment returns xbase::XAssignment:
{xbase::XAssignment}
(explicitStatic?='explicitStatic')?
'XAssignment'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('assignable' assignable=XExpression)?
('value' value=XExpression)?
'}';
Rebuilds Xbase grammar without reusing it…
Wizard does crazy things…// automatically generated by Xtext
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
import "http://www.xtext.org/example/xbase"
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types
import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
MyClass returns MyClass:
{MyClass}
'MyClass'
'{'
('ref' ref=JvmTypeReference)?
('body' body=XBlockExpression)?
'}';
JvmTypeReference returns types::JvmTypeReference:
JvmParameterizedTypeReference_Impl | JvmGenericArrayTypeReference | JvmWildcardTypeReference | JvmAnyTypeReference | JvmMultiTypeReference | JvmDelegateTypeReference | JvmSynonymTypeReference | JvmUnknownTypeReference | JvmInnerTypeReference;
XExpression returns xbase::XExpression:
XIfExpression | XSwitchExpression | XBlockExpression | XVariableDeclaration | XMemberFeatureCall | XFeatureCall | XConstructorCall | XBooleanLiteral | XNullLiteral | XNumberLiteral | XStringLiteral | XListLiteral | XSetLiteral | XClosure | XCastedExpression | XBinaryOperation | XUnaryOperation | XPostfixOperation | XForLoopExpression | XBasicForLoopExpression | XDoWhileExpression | XWhileExpression | XTypeLiteral | XInstanceOfExpression | XThrowExpression | XTryCatchFinallyExpression | XAssignment | XReturnExpression | XSynchronizedExpression;
JvmType returns types::JvmType:
JvmVoid | JvmPrimitiveType | JvmArrayType | JvmTypeParameter | JvmAnnotationType | JvmEnumerationType | JvmGenericType;
JvmTypeConstraint returns types::JvmTypeConstraint:
JvmUpperBound | JvmLowerBound;
JvmParameterizedTypeReference returns types::JvmParameterizedTypeReference:
JvmParameterizedTypeReference_Impl | JvmInnerTypeReference;
JvmMember returns types::JvmMember:
JvmAnnotationType | JvmEnumerationType | JvmEnumerationLiteral | JvmGenericType | JvmField_Impl | JvmConstructor | JvmOperation;
JvmAnnotationValue returns types::JvmAnnotationValue:
JvmIntAnnotationValue | JvmBooleanAnnotationValue | JvmByteAnnotationValue | JvmShortAnnotationValue | JvmLongAnnotationValue | JvmDoubleAnnotationValue | JvmFloatAnnotationValue | JvmCharAnnotationValue | JvmStringAnnotationValue | JvmTypeAnnotationValue | JvmAnnotationAnnotationValue | JvmEnumAnnotationValue | JvmCustomAnnotationValue;
JvmIdentifiableElement returns types::JvmIdentifiableElement:
JvmVoid | JvmPrimitiveType | JvmArrayType | JvmTypeParameter | JvmAnnotationType | JvmEnumerationType | JvmEnumerationLiteral | JvmGenericType | JvmField_Impl | JvmConstructor | JvmOperation | JvmFormalParameter;
XBlockExpression returns xbase::XBlockExpression:
{xbase::XBlockExpression}
'XBlockExpression'
'{'
('expressions' '{' expressions+=XExpression ( "," expressions+=XExpression)* '}' )?
'}';
JvmParameterizedTypeReference_Impl returns types::JvmParameterizedTypeReference:
{types::JvmParameterizedTypeReference}
'JvmParameterizedTypeReference'
'{'
('type' type=[types::JvmType|EString])?
('arguments' '{' arguments+=JvmTypeReference ( "," arguments+=JvmTypeReference)* '}' )?
'}';
JvmGenericArrayTypeReference returns types::JvmGenericArrayTypeReference:
{types::JvmGenericArrayTypeReference}
'JvmGenericArrayTypeReference'
'{'
('componentType' componentType=JvmTypeReference)?
'}';
JvmWildcardTypeReference returns types::JvmWildcardTypeReference:
{types::JvmWildcardTypeReference}
'JvmWildcardTypeReference'
'{'
('constraints' '{' constraints+=JvmTypeConstraint ( "," constraints+=JvmTypeConstraint)* '}' )?
'}';
JvmAnyTypeReference returns types::JvmAnyTypeReference:
{types::JvmAnyTypeReference}
'JvmAnyTypeReference'
'{'
('type' type=[types::JvmType|EString])?
'}';
JvmMultiTypeReference returns types::JvmMultiTypeReference:
{types::JvmMultiTypeReference}
'JvmMultiTypeReference'
'{'
('type' type=[types::JvmType|EString])?
('references' '{' references+=JvmTypeReference ( "," references+=JvmTypeReference)* '}' )?
'}';
JvmDelegateTypeReference returns types::JvmDelegateTypeReference:
{types::JvmDelegateTypeReference}
'JvmDelegateTypeReference'
'{'
('delegate' delegate=[types::JvmTypeReference|EString])?
'}';
JvmSynonymTypeReference returns types::JvmSynonymTypeReference:
{types::JvmSynonymTypeReference}
'JvmSynonymTypeReference'
'{'
('type' type=[types::JvmType|EString])?
('references' '{' references+=JvmTypeReference ( "," references+=JvmTypeReference)* '}' )?
'}';
JvmUnknownTypeReference returns types::JvmUnknownTypeReference:
{types::JvmUnknownTypeReference}
'JvmUnknownTypeReference'
;
JvmInnerTypeReference returns types::JvmInnerTypeReference:
{types::JvmInnerTypeReference}
'JvmInnerTypeReference'
'{'
('type' type=[types::JvmType|EString])?
('arguments' '{' arguments+=JvmTypeReference ( "," arguments+=JvmTypeReference)* '}' )?
('outer' outer=JvmParameterizedTypeReference)?
'}';
JvmVoid returns types::JvmVoid:
{types::JvmVoid}
'JvmVoid'
;
JvmPrimitiveType returns types::JvmPrimitiveType:
{types::JvmPrimitiveType}
'JvmPrimitiveType'
'{'
('simpleName' simpleName=EString)?
('arrayType' arrayType=JvmArrayType)?
'}';
JvmArrayType returns types::JvmArrayType:
{types::JvmArrayType}
'JvmArrayType'
'{'
('arrayType' arrayType=JvmArrayType)?
'}';
JvmTypeParameter returns types::JvmTypeParameter:
{types::JvmTypeParameter}
'JvmTypeParameter'
name=EString
'{'
('arrayType' arrayType=JvmArrayType)?
('constraints' '{' constraints+=JvmTypeConstraint ( "," constraints+=JvmTypeConstraint)* '}' )?
'}';
JvmAnnotationType returns types::JvmAnnotationType:
{types::JvmAnnotationType}
(deprecated?='deprecated')?
(abstract?='abstract')?
(static?='static')?
(final?='final')?
'JvmAnnotationType'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('packageName' packageName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('arrayType' arrayType=JvmArrayType)?
('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )?
('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )?
'}';
JvmEnumerationType returns types::JvmEnumerationType:
{types::JvmEnumerationType}
(deprecated?='deprecated')?
(abstract?='abstract')?
(static?='static')?
(final?='final')?
'JvmEnumerationType'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('packageName' packageName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('arrayType' arrayType=JvmArrayType)?
('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )?
('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )?
'}';
JvmGenericType returns types::JvmGenericType:
{types::JvmGenericType}
(deprecated?='deprecated')?
(abstract?='abstract')?
(static?='static')?
(final?='final')?
(interface?='interface')?
(strictFloatingPoint?='strictFloatingPoint')?
(anonymous?='anonymous')?
'JvmGenericType'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('packageName' packageName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('arrayType' arrayType=JvmArrayType)?
('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )?
('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )?
('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )?
'}';
EString returns ecore::EString:
STRING | ID;
JvmAnnotationReference returns types::JvmAnnotationReference:
{types::JvmAnnotationReference}
'JvmAnnotationReference'
'{'
('annotation' annotation=[types::JvmAnnotationType|EString])?
('explicitValues' '{' explicitValues+=JvmAnnotationValue ( "," explicitValues+=JvmAnnotationValue)* '}' )?
'}';
enum JvmVisibility returns types::JvmVisibility:
DEFAULT = 'DEFAULT' | PRIVATE = 'PRIVATE' | PROTECTED = 'PROTECTED' | PUBLIC = 'PUBLIC';
EBoolean returns ecore::EBoolean:
'true' | 'false';
JvmOperation returns types::JvmOperation:
{types::JvmOperation}
(deprecated?='deprecated')?
(varArgs?='varArgs')?
(static?='static')?
(final?='final')?
(abstract?='abstract')?
(synchronized?='synchronized')?
(default?='default')?
(native?='native')?
(strictFloatingPoint?='strictFloatingPoint')?
'JvmOperation'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )?
('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )?
('parameters' '{' parameters+=JvmFormalParameter ( "," parameters+=JvmFormalParameter)* '}' )?
('exceptions' '{' exceptions+=JvmTypeReference ( "," exceptions+=JvmTypeReference)* '}' )?
('returnType' returnType=JvmTypeReference)?
('defaultValue' defaultValue=JvmAnnotationValue)?
'}';
JvmIntAnnotationValue returns types::JvmIntAnnotationValue:
{types::JvmIntAnnotationValue}
'JvmIntAnnotationValue'
'{'
('values' '{' values+=EInt ( "," values+=EInt)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmBooleanAnnotationValue returns types::JvmBooleanAnnotationValue:
{types::JvmBooleanAnnotationValue}
'JvmBooleanAnnotationValue'
'{'
('values' '{' values+=EBoolean ( "," values+=EBoolean)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmByteAnnotationValue returns types::JvmByteAnnotationValue:
{types::JvmByteAnnotationValue}
'JvmByteAnnotationValue'
'{'
('values' '{' values+=EByte ( "," values+=EByte)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmShortAnnotationValue returns types::JvmShortAnnotationValue:
{types::JvmShortAnnotationValue}
'JvmShortAnnotationValue'
'{'
('values' '{' values+=EShort ( "," values+=EShort)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmLongAnnotationValue returns types::JvmLongAnnotationValue:
{types::JvmLongAnnotationValue}
'JvmLongAnnotationValue'
'{'
('values' '{' values+=ELong ( "," values+=ELong)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmDoubleAnnotationValue returns types::JvmDoubleAnnotationValue:
{types::JvmDoubleAnnotationValue}
'JvmDoubleAnnotationValue'
'{'
('values' '{' values+=EDouble ( "," values+=EDouble)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmFloatAnnotationValue returns types::JvmFloatAnnotationValue:
{types::JvmFloatAnnotationValue}
'JvmFloatAnnotationValue'
'{'
('values' '{' values+=EFloat ( "," values+=EFloat)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmCharAnnotationValue returns types::JvmCharAnnotationValue:
{types::JvmCharAnnotationValue}
'JvmCharAnnotationValue'
'{'
('values' '{' values+=EChar ( "," values+=EChar)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmStringAnnotationValue returns types::JvmStringAnnotationValue:
{types::JvmStringAnnotationValue}
'JvmStringAnnotationValue'
'{'
('values' '{' values+=EString ( "," values+=EString)* '}' )?
('operation' operation=[types::JvmOperation|EString])?
'}';
JvmTypeAnnotationValue returns types::JvmTypeAnnotationValue:
{types::JvmTypeAnnotationValue}
'JvmTypeAnnotationValue'
'{'
('operation' operation=[types::JvmOperation|EString])?
('values' '{' values+=JvmTypeReference ( "," values+=JvmTypeReference)* '}' )?
'}';
JvmAnnotationAnnotationValue returns types::JvmAnnotationAnnotationValue:
{types::JvmAnnotationAnnotationValue}
'JvmAnnotationAnnotationValue'
'{'
('operation' operation=[types::JvmOperation|EString])?
('values' '{' values+=JvmAnnotationReference ( "," values+=JvmAnnotationReference)* '}' )?
'}';
JvmEnumAnnotationValue returns types::JvmEnumAnnotationValue:
{types::JvmEnumAnnotationValue}
'JvmEnumAnnotationValue'
'{'
('operation' operation=[types::JvmOperation|EString])?
('values' '(' values+=[types::JvmEnumerationLiteral|EString] ( "," values+=[types::JvmEnumerationLiteral|EString])* ')' )?
'}';
JvmCustomAnnotationValue returns types::JvmCustomAnnotationValue:
{types::JvmCustomAnnotationValue}
'JvmCustomAnnotationValue'
'{'
('operation' operation=[types::JvmOperation|EString])?
('values' '(' values+=[ecore::EObject|EString] ( "," values+=[ecore::EObject|EString])* ')' )?
'}';
JvmFormalParameter returns types::JvmFormalParameter:
{types::JvmFormalParameter}
'JvmFormalParameter'
name=EString
'{'
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('parameterType' parameterType=JvmTypeReference)?
'}';
EInt returns ecore::EInt:
'-'? INT;
EByte returns ecore::EByte:
'-'? INT;
EShort returns ecore::EShort:
'-'? INT;
ELong returns ecore::ELong:
'-'? INT;
EDouble returns ecore::EDouble:
'-'? INT? '.' INT (('E'|'e') '-'? INT)?;
EFloat returns ecore::EFloat:
'-'? INT? '.' INT (('E'|'e') '-'? INT)?;
EChar returns ecore::EChar:
'-'? INT;
JvmEnumerationLiteral returns types::JvmEnumerationLiteral:
{types::JvmEnumerationLiteral}
(deprecated?='deprecated')?
(static?='static')?
(final?='final')?
(volatile?='volatile')?
(transient?='transient')?
(constant?='constant')?
'JvmEnumerationLiteral'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('constantValue' constantValue=EJavaObject)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )?
('type' type=JvmTypeReference)?
'}';
EJavaObject returns ecore::EJavaObject:
'EJavaObject' /* TODO: implement this rule and an appropriate IValueConverter */;
EObject returns ecore::EObject:
{ecore::EObject}
'EObject'
;
JvmField_Impl returns types::JvmField:
{types::JvmField}
(deprecated?='deprecated')?
(static?='static')?
(final?='final')?
(volatile?='volatile')?
(transient?='transient')?
(constant?='constant')?
'JvmField'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('constantValue' constantValue=EJavaObject)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )?
('type' type=JvmTypeReference)?
'}';
JvmConstructor returns types::JvmConstructor:
{types::JvmConstructor}
(deprecated?='deprecated')?
(varArgs?='varArgs')?
'JvmConstructor'
'{'
('visibility' visibility=JvmVisibility)?
('simpleName' simpleName=EString)?
('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )?
('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )?
('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )?
('parameters' '{' parameters+=JvmFormalParameter ( "," parameters+=JvmFormalParameter)* '}' )?
('exceptions' '{' exceptions+=JvmTypeReference ( "," exceptions+=JvmTypeReference)* '}' )?
'}';
JvmUpperBound returns types::JvmUpperBound:
{types::JvmUpperBound}
'JvmUpperBound'
'{'
('typeReference' typeReference=JvmTypeReference)?
'}';
JvmLowerBound returns types::JvmLowerBound:
{types::JvmLowerBound}
'JvmLowerBound'
'{'
('typeReference' typeReference=JvmTypeReference)?
'}';
XIfExpression returns xbase::XIfExpression:
{xbase::XIfExpression}
'XIfExpression'
'{'
('if' if=XExpression)?
('then' then=XExpression)?
('else' else=XExpression)?
'}';
XSwitchExpression returns xbase::XSwitchExpression:
{xbase::XSwitchExpression}
'XSwitchExpression'
'{'
('switch' switch=XExpression)?
('cases' '{' cases+=XCasePart ( "," cases+=XCasePart)* '}' )?
('default' default=XExpression)?
('declaredParam' declaredParam=JvmFormalParameter)?
'}';
XVariableDeclaration returns xbase::XVariableDeclaration:
{xbase::XVariableDeclaration}
(writeable?='writeable')?
'XVariableDeclaration'
name=EString
'{'
('type' type=JvmTypeReference)?
('right' right=XExpression)?
'}';
XMemberFeatureCall returns xbase::XMemberFeatureCall:
{xbase::XMemberFeatureCall}
(explicitOperationCall?='explicitOperationCall')?
(explicitStatic?='explicitStatic')?
(nullSafe?='nullSafe')?
'XMemberFeatureCall'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('memberCallTarget' memberCallTarget=XExpression)?
('memberCallArguments' '{' memberCallArguments+=XExpression ( "," memberCallArguments+=XExpression)* '}' )?
'}';
XFeatureCall returns xbase::XFeatureCall:
{xbase::XFeatureCall}
(explicitOperationCall?='explicitOperationCall')?
'XFeatureCall'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('featureCallArguments' '{' featureCallArguments+=XExpression ( "," featureCallArguments+=XExpression)* '}' )?
'}';
XConstructorCall returns xbase::XConstructorCall:
{xbase::XConstructorCall}
(explicitConstructorCall?='explicitConstructorCall')?
'XConstructorCall'
'{'
('constructor' constructor=[types::JvmConstructor|EString])?
('arguments' '{' arguments+=XExpression ( "," arguments+=XExpression)* '}' )?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
'}';
XBooleanLiteral returns xbase::XBooleanLiteral:
{xbase::XBooleanLiteral}
(isTrue?='isTrue')?
'XBooleanLiteral'
;
XNullLiteral returns xbase::XNullLiteral:
{xbase::XNullLiteral}
'XNullLiteral'
;
XNumberLiteral returns xbase::XNumberLiteral:
{xbase::XNumberLiteral}
'XNumberLiteral'
'{'
('value' value=EString)?
'}';
XStringLiteral returns xbase::XStringLiteral:
{xbase::XStringLiteral}
'XStringLiteral'
'{'
('value' value=EString)?
'}';
XListLiteral returns xbase::XListLiteral:
{xbase::XListLiteral}
'XListLiteral'
'{'
('elements' '{' elements+=XExpression ( "," elements+=XExpression)* '}' )?
'}';
XSetLiteral returns xbase::XSetLiteral:
{xbase::XSetLiteral}
'XSetLiteral'
'{'
('elements' '{' elements+=XExpression ( "," elements+=XExpression)* '}' )?
'}';
XClosure returns xbase::XClosure:
{xbase::XClosure}
(explicitSyntax?='explicitSyntax')?
'XClosure'
'{'
('declaredFormalParameters' '{' declaredFormalParameters+=JvmFormalParameter ( "," declaredFormalParameters+=JvmFormalParameter)* '}' )?
('expression' expression=XExpression)?
'}';
XCastedExpression returns xbase::XCastedExpression:
{xbase::XCastedExpression}
'XCastedExpression'
'{'
('type' type=JvmTypeReference)?
('target' target=XExpression)?
'}';
XBinaryOperation returns xbase::XBinaryOperation:
{xbase::XBinaryOperation}
(reassignFirstArgument?='reassignFirstArgument')?
'XBinaryOperation'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('leftOperand' leftOperand=XExpression)?
('rightOperand' rightOperand=XExpression)?
'}';
XUnaryOperation returns xbase::XUnaryOperation:
{xbase::XUnaryOperation}
'XUnaryOperation'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('operand' operand=XExpression)?
'}';
XPostfixOperation returns xbase::XPostfixOperation:
{xbase::XPostfixOperation}
'XPostfixOperation'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('operand' operand=XExpression)?
'}';
XForLoopExpression returns xbase::XForLoopExpression:
{xbase::XForLoopExpression}
'XForLoopExpression'
'{'
('forExpression' forExpression=XExpression)?
('eachExpression' eachExpression=XExpression)?
('declaredParam' declaredParam=JvmFormalParameter)?
'}';
XBasicForLoopExpression returns xbase::XBasicForLoopExpression:
{xbase::XBasicForLoopExpression}
'XBasicForLoopExpression'
'{'
('expression' expression=XExpression)?
('eachExpression' eachExpression=XExpression)?
('initExpressions' '{' initExpressions+=XExpression ( "," initExpressions+=XExpression)* '}' )?
('updateExpressions' '{' updateExpressions+=XExpression ( "," updateExpressions+=XExpression)* '}' )?
'}';
XDoWhileExpression returns xbase::XDoWhileExpression:
{xbase::XDoWhileExpression}
'XDoWhileExpression'
'{'
('predicate' predicate=XExpression)?
('body' body=XExpression)?
'}';
XWhileExpression returns xbase::XWhileExpression:
{xbase::XWhileExpression}
'XWhileExpression'
'{'
('predicate' predicate=XExpression)?
('body' body=XExpression)?
'}';
XTypeLiteral returns xbase::XTypeLiteral:
'XTypeLiteral'
'{'
('arrayDimensions' '{' arrayDimensions+=EString ( "," arrayDimensions+=EString)* '}' )?
'type' type=[types::JvmType|EString]
'}';
XInstanceOfExpression returns xbase::XInstanceOfExpression:
'XInstanceOfExpression'
'{'
'type' type=JvmTypeReference
'expression' expression=XExpression
'}';
XThrowExpression returns xbase::XThrowExpression:
{xbase::XThrowExpression}
'XThrowExpression'
'{'
('expression' expression=XExpression)?
'}';
XTryCatchFinallyExpression returns xbase::XTryCatchFinallyExpression:
{xbase::XTryCatchFinallyExpression}
'XTryCatchFinallyExpression'
'{'
('expression' expression=XExpression)?
('finallyExpression' finallyExpression=XExpression)?
('catchClauses' '{' catchClauses+=XCatchClause ( "," catchClauses+=XCatchClause)* '}' )?
'}';
XAssignment returns xbase::XAssignment:
{xbase::XAssignment}
(explicitStatic?='explicitStatic')?
'XAssignment'
'{'
('feature' feature=[types::JvmIdentifiableElement|EString])?
('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )?
('assignable' assignable=XExpression)?
('value' value=XExpression)?
'}';
Generator wrongly configured
Using Xbase
Using Xbase
I am missing the Maven part…
https://github.com/holgerschill/XtextCon_Xcore_Maven
A full working example can be found here
Tycho
Xtext Maven Plugin
Exec-Maven-Plugin
Xtend Maven Plugin
Pittfalls
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>${xtext-version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<languages>
<language>
<setup>org.eclipse.xtext.ecore.EcoreSupport</setup>
</language>
<language>
<setup>org.eclipse.emf.codegen.ecore.xtext.GenModelSupport</setup>
</language>
<language>
<setup>org.eclipse.emf.ecore.xcore.XcoreStandaloneSetup</setup>
</language>
</languages>
<sourceRoots>
<root>${project.basedir}/model</root>
</sourceRoots>
</configuration>
Register right languages for Xcore
Pittfalls
Right dependencies to generate Java out of Xcore
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.resources</artifactId>
<version>3.7.100</version>
</dependency>
<dependency>
<groupId>org.eclipse.text</groupId>
<artifactId>org.eclipse.text</artifactId>
<version>3.5.101</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.codegen.ecore.xtext</artifactId>
<version>${ecore-xtext-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xcore.lib</artifactId>
<version>${ecore-xcore-lib-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xcore</artifactId>
<version>${ecore-xcore-version}</version>
</dependency>
</dependencies>
Pittfalls
Set modelDirectory in Xcore files explicitly
@GenModel(modelDirectory="./src-gen")
package org.xtext.example.myfirstdsl
import common.NamedElement
import common.Referenceable
class FirstElement extends NamedElement, Referenceable {
refers Referenceable ref
}
Pittfalls
Don’t use classpath URIs in MWE2
var fileExtensions = "first"
var projectName = "org.xtext.example.firstdsl.lang"
var runtimeProject = "../${projectName}"
var generateXtendStub = true
//var grammarURI = "classpath:/org/xtext/example/firstdsl/Lang.xtext"
var grammarURI = "platform:/resource/${projectName}/src/org/xtext/example/firstdsl/Lang.xtext"
Pittfalls
Explicitly set path to generate Java classes
// generates Java API for the generated EPackages
fragment = ecore.EMFGeneratorFragment auto-inject {
javaModelDirectory = "/${projectName}/src-gen"
}
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and FunctionsJussi Pohjolainen
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced JavascriptAdieu
 
Meetup angular http client
Meetup angular http clientMeetup angular http client
Meetup angular http clientGaurav Madaan
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practicesIwan van der Kleijn
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptForziatech
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScriptNascenia IT
 
Kotlin scope functions
Kotlin scope functionsKotlin scope functions
Kotlin scope functionsWaheed Nazir
 
Class 3 - PHP Functions
Class 3 - PHP FunctionsClass 3 - PHP Functions
Class 3 - PHP FunctionsAhmed Swilam
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptWalid Ashraf
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
Asynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & PromisesAsynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & PromisesHùng Nguyễn Huy
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6Rob Eisenberg
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript TutorialBui Kiet
 
Intro to Asynchronous Javascript
Intro to Asynchronous JavascriptIntro to Asynchronous Javascript
Intro to Asynchronous JavascriptGarrett Welson
 

Was ist angesagt? (20)

JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
 
Meetup angular http client
Meetup angular http clientMeetup angular http client
Meetup angular http client
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Kotlin scope functions
Kotlin scope functionsKotlin scope functions
Kotlin scope functions
 
Class 3 - PHP Functions
Class 3 - PHP FunctionsClass 3 - PHP Functions
Class 3 - PHP Functions
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Optional in Java 8
Optional in Java 8Optional in Java 8
Optional in Java 8
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
JavaScript and BOM events
JavaScript and BOM eventsJavaScript and BOM events
JavaScript and BOM events
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Asynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & PromisesAsynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & Promises
 
Modern JS with ES6
Modern JS with ES6Modern JS with ES6
Modern JS with ES6
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
 
Intro to Asynchronous Javascript
Intro to Asynchronous JavascriptIntro to Asynchronous Javascript
Intro to Asynchronous Javascript
 

Andere mochten auch

Syntaxe concrète des DSL en IDM [avec Xtext]
Syntaxe concrète des DSL en IDM [avec Xtext]Syntaxe concrète des DSL en IDM [avec Xtext]
Syntaxe concrète des DSL en IDM [avec Xtext]Olivier Le Goaër
 
Building Your Own DSL with Xtext
Building Your Own DSL with XtextBuilding Your Own DSL with Xtext
Building Your Own DSL with XtextGlobalLogic Ukraine
 
Introduction to Xbase
Introduction to XbaseIntroduction to Xbase
Introduction to XbaseHolger Schill
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With XtextSven Efftinge
 
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2Dr. Jan Köhnlein
 
Executable specifications for xtext
Executable specifications for xtextExecutable specifications for xtext
Executable specifications for xtextmeysholdt
 
Parsing Expression With Xtext
Parsing Expression With XtextParsing Expression With Xtext
Parsing Expression With XtextSven Efftinge
 
Codegeneration Goodies
Codegeneration GoodiesCodegeneration Goodies
Codegeneration Goodiesmeysholdt
 
Code Generation idioms with Xtend
Code Generation idioms with XtendCode Generation idioms with Xtend
Code Generation idioms with XtendHolger Schill
 
Uml to code with acceleo
Uml to code with acceleoUml to code with acceleo
Uml to code with acceleoTarun Telang
 
Recipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendRecipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendKarsten Thoms
 
Graphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagramGraphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagramDr. Jan Köhnlein
 

Andere mochten auch (20)

Syntaxe concrète des DSL en IDM [avec Xtext]
Syntaxe concrète des DSL en IDM [avec Xtext]Syntaxe concrète des DSL en IDM [avec Xtext]
Syntaxe concrète des DSL en IDM [avec Xtext]
 
Building Your Own DSL with Xtext
Building Your Own DSL with XtextBuilding Your Own DSL with Xtext
Building Your Own DSL with Xtext
 
Java DSLs with Xtext
Java DSLs with XtextJava DSLs with Xtext
Java DSLs with Xtext
 
Introduction to Xbase
Introduction to XbaseIntroduction to Xbase
Introduction to Xbase
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With Xtext
 
Scoping Tips and Tricks
Scoping Tips and TricksScoping Tips and Tricks
Scoping Tips and Tricks
 
Scoping
ScopingScoping
Scoping
 
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
 
Executable specifications for xtext
Executable specifications for xtextExecutable specifications for xtext
Executable specifications for xtext
 
Future of Xtext
Future of XtextFuture of Xtext
Future of Xtext
 
Xtext Best Practices
Xtext Best PracticesXtext Best Practices
Xtext Best Practices
 
Parsing Expression With Xtext
Parsing Expression With XtextParsing Expression With Xtext
Parsing Expression With Xtext
 
What's Cooking in Xtext 2.0
What's Cooking in Xtext 2.0What's Cooking in Xtext 2.0
What's Cooking in Xtext 2.0
 
Codegeneration Goodies
Codegeneration GoodiesCodegeneration Goodies
Codegeneration Goodies
 
Code Generation idioms with Xtend
Code Generation idioms with XtendCode Generation idioms with Xtend
Code Generation idioms with Xtend
 
Uml to code with acceleo
Uml to code with acceleoUml to code with acceleo
Uml to code with acceleo
 
Recipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendRecipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with Xtend
 
EMF - Beyond The Basics
EMF - Beyond The BasicsEMF - Beyond The Basics
EMF - Beyond The Basics
 
EMF Tips n Tricks
EMF Tips n TricksEMF Tips n Tricks
EMF Tips n Tricks
 
Graphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagramGraphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagram
 

Ähnlich wie Using Xcore with Xtext

The Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumThe Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumMatthias Noback
 
The Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaThe Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaMatthias Noback
 
The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014Matthias Noback
 
Let ColdFusion ORM do the work for you!
Let ColdFusion ORM do the work for you!Let ColdFusion ORM do the work for you!
Let ColdFusion ORM do the work for you!Masha Edelen
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Devoxx08 - Nuxeo Core, JCR 2, CMIS
Devoxx08 - Nuxeo Core, JCR 2, CMIS Devoxx08 - Nuxeo Core, JCR 2, CMIS
Devoxx08 - Nuxeo Core, JCR 2, CMIS Nuxeo
 
Hack an ASP .NET website? Hard, but possible!
Hack an ASP .NET website? Hard, but possible! Hack an ASP .NET website? Hard, but possible!
Hack an ASP .NET website? Hard, but possible! Vladimir Kochetkov
 
SAX, DOM & JDOM parsers for beginners
SAX, DOM & JDOM parsers for beginnersSAX, DOM & JDOM parsers for beginners
SAX, DOM & JDOM parsers for beginnersHicham QAISSI
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridGiorgio Cefaro
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrideugenio pombi
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Domkaven yan
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdfSudhanshiBakre1
 
Ian 2014.10.24 weekly report
Ian 2014.10.24 weekly reportIan 2014.10.24 weekly report
Ian 2014.10.24 weekly reportLearningTech
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)David McCarter
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testabilityJohn Sundell
 

Ähnlich wie Using Xcore with Xtext (20)

Tornadoweb
TornadowebTornadoweb
Tornadoweb
 
The Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumThe Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup Belgium
 
srgoc
srgocsrgoc
srgoc
 
The Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony BarcelonaThe Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony Barcelona
 
The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
 
Let ColdFusion ORM do the work for you!
Let ColdFusion ORM do the work for you!Let ColdFusion ORM do the work for you!
Let ColdFusion ORM do the work for you!
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Devoxx08 - Nuxeo Core, JCR 2, CMIS
Devoxx08 - Nuxeo Core, JCR 2, CMIS Devoxx08 - Nuxeo Core, JCR 2, CMIS
Devoxx08 - Nuxeo Core, JCR 2, CMIS
 
Hack an ASP .NET website? Hard, but possible!
Hack an ASP .NET website? Hard, but possible! Hack an ASP .NET website? Hard, but possible!
Hack an ASP .NET website? Hard, but possible!
 
SAX, DOM & JDOM parsers for beginners
SAX, DOM & JDOM parsers for beginnersSAX, DOM & JDOM parsers for beginners
SAX, DOM & JDOM parsers for beginners
 
backend
backendbackend
backend
 
backend
backendbackend
backend
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdf
 
Ian 2014.10.24 weekly report
Ian 2014.10.24 weekly reportIan 2014.10.24 weekly report
Ian 2014.10.24 weekly report
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testability
 

Kürzlich hochgeladen

Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Vipesco
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Baileyhlharris
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubssamaasim06
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Delhi Call girls
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxmohammadalnahdi22
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIINhPhngng3
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatmentnswingard
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoKayode Fayemi
 
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxNikitaBankoti2
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxraffaeleoman
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lodhisaajjda
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar TrainingKylaCullinane
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesPooja Nehwal
 
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyPooja Nehwal
 
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...Hasting Chen
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfSenaatti-kiinteistöt
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfSkillCertProExams
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaKayode Fayemi
 

Kürzlich hochgeladen (20)

Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubs
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
 
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
 
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 

Using Xcore with Xtext

  • 5. You will come to the point… Where you want to take control…
  • 6. Problem grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Model: elements+=AbstractElement*; AbstractElement: Element | SecondElement | ThirdElement ; Element: 'Element' name=ID ref=[AbstractElement] ; SecondElement: 'SecondElement' name=ID ; ThirdElement: 'ThirdElement' name=ID ; Example
  • 7. Problem grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Model: elements+=AbstractElement*; AbstractElement: Element | SecondElement | ThirdElement ; Element: 'Element' name=ID ref=[AbstractElement] ; SecondElement: 'SecondElement' name=ID ; ThirdElement: 'ThirdElement' name=ID ; Example
  • 8. grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Model: elements+=AbstractElement*; AbstractElement: Element | SecondElement | ThirdElement ; Element: 'Element' name=ID ref=[Referenceable] ; SecondElement: 'SecondElement' name=ID ; ThirdElement: 'ThirdElement' name=ID ; Referenceable: SecondElement | ThirdElement ; Never invoked by the parser Example Fake Rules to influence EMF Generator
  • 9. For rapid prototyping the generated model is fine When to stay with the generated model
  • 10. For rapid prototyping the generated model is fine Automatic synchronisation from grammar to model When to stay with the generated model
  • 11. For rapid prototyping the generated model is fine Automatic synchronisation from grammar to model If you do not need to introduce fake rules When to stay with the generated model
  • 12. But what if… DSL DSL DSL Order for generating DSLs is important
  • 13. But what if… DSL DSL DSL Order for generating DSLs is important Eagerly loaded
  • 14. DSL DSL DSLs reference each other But what if…
  • 18. Still that tree editor…
  • 19. Still that tree editor… Merging can be difficult
  • 22. The MyDSL example in Xcore
  • 23. Derives ecore and genmodel
  • 24. Put code directly in the model
  • 25. Put code directly in the model
  • 26. Load Xcore file No Registration needed Workflow configuration
  • 27. Don’t forget the Xcore dependency
  • 28. Don’t forget the Xcore dependency Caused by: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/org.xtext.example.mydsl.model/model/MyDsl.xcore; systemId: platform:/resource/org.xtext.example.mydsl.model/model/MyDsl.xcore; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java: 510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) Invokes XcoreStandaloneSetup to register *.xcore
  • 29. There is a wizard for that…
  • 30. More complex setups Ecore model Xcore model Xtext DSL Xcore imports another ecore model Xtext DSL imports Xcore
  • 33. Caused by: java.lang.IllegalStateException: Problem parsing 'classpath:/org/xtext/example/ mydsl/MyDsl.xtext': TransformationDiagnostic: null:9 Cannot find compatible feature name in sealed EClass Greeting from imported package http://www.xtext.org/example/mydsl/MyDsl: The type 'Greeting' does not have a feature 'name'. (ErrorCode: CannotCreateTypeInSealedMetamodel) at org.eclipse.xtext.generator.LanguageConfig.setUri(LanguageConfig.java:247) ... 42 more You will face that Exception
  • 34. Caused by: java.lang.IllegalStateException: Problem parsing 'classpath:/org/xtext/example/ mydsl/MyDsl.xtext': TransformationDiagnostic: null:9 Cannot find compatible feature name in sealed EClass Greeting from imported package http://www.xtext.org/example/mydsl/MyDsl: The type 'Greeting' does not have a feature 'name'. (ErrorCode: CannotCreateTypeInSealedMetamodel) at org.eclipse.xtext.generator.LanguageConfig.setUri(LanguageConfig.java:247) ... 42 more You will face that Exception Ecore model Xcore model Proxy not resolvable Index is not aware of genmodel that the Xcore model links against Proxy
  • 35. But I added that stuff in the StandaloneSetup…?
  • 36. But I added that stuff in the StandaloneSetup…? ResourceSet Resource Resource Resource Resource ResourceSet Resource Resource
  • 37. Ecore model Xcore model Proxy What’s happening? ResourceSet Grammar Xcore resource Ecore model Genmodel Index ResourceDescription ResourceDescription ResourceDescription ResourceDescription
  • 43. More complex example Xtext DSL Xtext DSL Languages referencing each other
  • 44. More complex example Xtext DSL Xtext DSL Languages referencing each other Plugin Xtext DSL 1 Plugin Xtext DSL 1 Problem Circular dependency Buddypolicy
  • 45. Introduce a Ecore model as a protocol Xtext DSL Xtext DSL Ecore model Generated Model Generated Model
  • 46. grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" import "http://www.xtext.org/common/model" as common PackageDeclaration returns common::PackageDeclaration: 'package' name=FQN content+=Element ; Element returns common::NamedElement: {Element} 'element' name=ID '{' ref=[common::Referenceable | FQN]? '}' ; FQN: ID ('.' ID)* ; Introduce a Ecore model as a protocol
  • 47. grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" import "http://www.xtext.org/common/model" as common PackageDeclaration returns common::PackageDeclaration: 'package' name=FQN content+=Element ; Element returns common::NamedElement: {Element} 'element' name=ID '{' ref=[common::Referenceable | FQN]? '}' ; FQN: ID ('.' ID)* ; Introduce a Ecore model as a protocol
  • 48. More complex example Xtext DSL Xtext DSL Xcore model Xcore model Imported Model Imported Model
  • 49. More complex example Xtext DSL Xtext DSL Xcore model Xcore model Imported Model Imported Model Same Plugin
  • 50. More complex example Xtext DSL Xtext DSL Xcore model Xcore model Imported Model Imported Model Different plugins
  • 51. More complex example Xtext DSL Xtext DSL Ecore model Xcore model Xcore model Imported Model Imported Model
  • 53. grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals import "org.xtext.example.myfirstdsl" import "http://www.eclipse.org/emf/2002/Ecore" as ecore import "http://www.xtext.org/common/model" as common import "org.xtext.example.myseconddsl" as second PackageDeclaration returns common::PackageDeclaration : 'package' name=FQN content+=FirstElement* ; FirstElement : 'element' name=ID '{' ref=[second::SecondElement| FQN]? '}' ; FQN: ID ('.' ID)* ; A lot of imports…
  • 54. grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals import "org.xtext.example.myfirstdsl" import "http://www.eclipse.org/emf/2002/Ecore" as ecore import "http://www.xtext.org/common/model" as common import "org.xtext.example.myseconddsl" as second PackageDeclaration returns common::PackageDeclaration : 'package' name=FQN content+=FirstElement* ; FirstElement : 'element' name=ID '{' ref=[second::SecondElement| FQN]? '}' ; FQN: ID ('.' ID)* ; Have same root node…
  • 55. grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals import "org.xtext.example.myfirstdsl" import "http://www.eclipse.org/emf/2002/Ecore" as ecore import "http://www.xtext.org/common/model" as common import "org.xtext.example.myseconddsl" as second PackageDeclaration returns common::PackageDeclaration : 'package' name=FQN content+=FirstElement* ; FirstElement : 'element' name=ID '{' ref=[second::SecondElement| FQN]? '}' ; FQN: ID ('.' ID)* ; Use implicitly imported classifier
  • 56. MWE2 configuration Same for both languages
  • 57. grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals import "org.xtext.example.myfirstdsl" import "http://www.eclipse.org/emf/2002/Ecore" as ecore import "http://www.xtext.org/common/model" as common import "org.xtext.example.myseconddsl" as second PackageDeclaration returns common::PackageDeclaration : 'package' name=FQN content+=FirstElement* ; FirstElement : 'element' name=ID '{' ref=[second::SecondElement| FQN]? '}' ; FQN: ID ('.' ID)* ; But there is a small problem
  • 58. grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals import "org.xtext.example.myfirstdsl" import "http://www.eclipse.org/emf/2002/Ecore" as ecore import "http://www.xtext.org/common/model" as common import "org.xtext.example.myseconddsl" as second PackageDeclaration returns common::PackageDeclaration : 'package' name=FQN content+=FirstElement* ; FirstElement : 'element' name=ID '{' ref=[second::SecondElement| FQN]? '}' ; FQN: ID ('.' ID)* ; CA is showing both elements?
  • 59. grammar org.xtext.example.firstdsl.Lang with org.eclipse.xtext.common.Terminals import "org.xtext.example.myfirstdsl" import "http://www.eclipse.org/emf/2002/Ecore" as ecore import "http://www.xtext.org/common/model" as common import "org.xtext.example.myseconddsl" as second PackageDeclaration returns common::PackageDeclaration : 'package' name=FQN content+=FirstElement* ; FirstElement : 'element' name=ID '{' ref=[second::SecondElement| FQN]? '}' ; FQN: ID ('.' ID)* ; CA is showing both elements?
  • 60. Xtext DSL Xtext DSL Ecore model Xcore model Xcore model generated Model generated Model One way to solve that…
  • 61. One way to solve that…
  • 62. One way to solve that… grammar org.xtext.example.seconddsl.Lang with org.eclipse.xtext.common.Terminals generate generatedSecondModel "http://www.xtext.org/generatedSecondModel" import "org.xtext.example.myseconddsl" import "http://www.xtext.org/common/model" as common import "http://www.eclipse.org/emf/2002/Ecore" as ecore import "org.xtext.example.myfirstdsl" as first PackageDeclaration returns common::PackageDeclaration : 'package' name=FQN content+=SecondElement* ; SecondElement returns SecondElement: {CustomSecondElement} 'element' name=ID '{' ref=[first::FirstElement | FQN]? '}' ; FQN: ID ('.' ID)* ;
  • 63. One way to solve that… grammar org.xtext.example.seconddsl.Lang with org.eclipse.xtext.common.Terminals generate generatedSecondModel "http://www.xtext.org/generatedSecondModel" import "org.xtext.example.myseconddsl" import "http://www.xtext.org/common/model" as common import "http://www.eclipse.org/emf/2002/Ecore" as ecore import "org.xtext.example.myfirstdsl" as first PackageDeclaration returns common::PackageDeclaration : 'package' name=FQN content+=SecondElement* ; SecondElement returns SecondElement: {CustomSecondElement} 'element' name=ID '{' ref=[first::FirstElement | FQN]? '}' ; FQN: ID ('.' ID)* ;
  • 64. But when I run it…. [ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: Generator) java.lang.RuntimeException: Could not find a GenModel for EPackage 'http://www.xtext.org/ generatedSecondModel' from http://www.xtext.org/generatedSecondModel If the missing GenModel has been generated via EMFGeneratorFragment or EcoreGeneratorFragment make sure to run it first in the workflow. If you have a *.genmodel-file, make sure to register it via StandaloneSetup.registerGenModelFile(String) at org.eclipse.xtext.generator.GenModelAccess.getGenModelResource(GenModelAccess.java:137) at org.eclipse.xtext.generator.GenModelAccess.getGenPackage(GenModelAccess.java:85)
  • 65. But when I run it…. // generates Java API for the generated EPackages fragment = ecore.EMFGeneratorFragment auto-inject {} Don’t forget the EMFGeneratorFragment [ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: Generator) java.lang.RuntimeException: Could not find a GenModel for EPackage 'http://www.xtext.org/ generatedSecondModel' from http://www.xtext.org/generatedSecondModel If the missing GenModel has been generated via EMFGeneratorFragment or EcoreGeneratorFragment make sure to run it first in the workflow. If you have a *.genmodel-file, make sure to register it via StandaloneSetup.registerGenModelFile(String) at org.eclipse.xtext.generator.GenModelAccess.getGenModelResource(GenModelAccess.java:137) at org.eclipse.xtext.generator.GenModelAccess.getGenPackage(GenModelAccess.java:85)
  • 66. There was nothing about Xbase so far…
  • 68. Wizard does crazy things…// automatically generated by Xtext grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals import "http://www.xtext.org/example/xbase" import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase import "http://www.eclipse.org/emf/2002/Ecore" as ecore MyClass returns MyClass: {MyClass} 'MyClass' '{' ('ref' ref=JvmTypeReference)? ('body' body=XBlockExpression)? '}'; JvmTypeReference returns types::JvmTypeReference: JvmParameterizedTypeReference_Impl | JvmGenericArrayTypeReference | JvmWildcardTypeReference | JvmAnyTypeReference | JvmMultiTypeReference | JvmDelegateTypeReference | JvmSynonymTypeReference | JvmUnknownTypeReference | JvmInnerTypeReference; XExpression returns xbase::XExpression: XIfExpression | XSwitchExpression | XBlockExpression | XVariableDeclaration | XMemberFeatureCall | XFeatureCall | XConstructorCall | XBooleanLiteral | XNullLiteral | XNumberLiteral | XStringLiteral | XListLiteral | XSetLiteral | XClosure | XCastedExpression | XBinaryOperation | XUnaryOperation | XPostfixOperation | XForLoopExpression | XBasicForLoopExpression | XDoWhileExpression | XWhileExpression | XTypeLiteral | XInstanceOfExpression | XThrowExpression | XTryCatchFinallyExpression | XAssignment | XReturnExpression | XSynchronizedExpression; JvmType returns types::JvmType: JvmVoid | JvmPrimitiveType | JvmArrayType | JvmTypeParameter | JvmAnnotationType | JvmEnumerationType | JvmGenericType; JvmTypeConstraint returns types::JvmTypeConstraint: JvmUpperBound | JvmLowerBound; JvmParameterizedTypeReference returns types::JvmParameterizedTypeReference: JvmParameterizedTypeReference_Impl | JvmInnerTypeReference; JvmMember returns types::JvmMember: JvmAnnotationType | JvmEnumerationType | JvmEnumerationLiteral | JvmGenericType | JvmField_Impl | JvmConstructor | JvmOperation; JvmAnnotationValue returns types::JvmAnnotationValue: JvmIntAnnotationValue | JvmBooleanAnnotationValue | JvmByteAnnotationValue | JvmShortAnnotationValue | JvmLongAnnotationValue | JvmDoubleAnnotationValue | JvmFloatAnnotationValue | JvmCharAnnotationValue | JvmStringAnnotationValue | JvmTypeAnnotationValue | JvmAnnotationAnnotationValue | JvmEnumAnnotationValue | JvmCustomAnnotationValue; JvmIdentifiableElement returns types::JvmIdentifiableElement: JvmVoid | JvmPrimitiveType | JvmArrayType | JvmTypeParameter | JvmAnnotationType | JvmEnumerationType | JvmEnumerationLiteral | JvmGenericType | JvmField_Impl | JvmConstructor | JvmOperation | JvmFormalParameter; XBlockExpression returns xbase::XBlockExpression: {xbase::XBlockExpression} 'XBlockExpression' '{' ('expressions' '{' expressions+=XExpression ( "," expressions+=XExpression)* '}' )? '}'; JvmParameterizedTypeReference_Impl returns types::JvmParameterizedTypeReference: {types::JvmParameterizedTypeReference} 'JvmParameterizedTypeReference' '{' ('type' type=[types::JvmType|EString])? ('arguments' '{' arguments+=JvmTypeReference ( "," arguments+=JvmTypeReference)* '}' )? '}'; JvmGenericArrayTypeReference returns types::JvmGenericArrayTypeReference: {types::JvmGenericArrayTypeReference} 'JvmGenericArrayTypeReference' '{' ('componentType' componentType=JvmTypeReference)? '}'; JvmWildcardTypeReference returns types::JvmWildcardTypeReference: {types::JvmWildcardTypeReference} 'JvmWildcardTypeReference' '{' ('constraints' '{' constraints+=JvmTypeConstraint ( "," constraints+=JvmTypeConstraint)* '}' )? '}'; JvmAnyTypeReference returns types::JvmAnyTypeReference: {types::JvmAnyTypeReference} 'JvmAnyTypeReference' '{' ('type' type=[types::JvmType|EString])? '}'; JvmMultiTypeReference returns types::JvmMultiTypeReference: {types::JvmMultiTypeReference} 'JvmMultiTypeReference' '{' ('type' type=[types::JvmType|EString])? ('references' '{' references+=JvmTypeReference ( "," references+=JvmTypeReference)* '}' )? '}'; JvmDelegateTypeReference returns types::JvmDelegateTypeReference: {types::JvmDelegateTypeReference} 'JvmDelegateTypeReference' '{' ('delegate' delegate=[types::JvmTypeReference|EString])? '}'; JvmSynonymTypeReference returns types::JvmSynonymTypeReference: {types::JvmSynonymTypeReference} 'JvmSynonymTypeReference' '{' ('type' type=[types::JvmType|EString])? ('references' '{' references+=JvmTypeReference ( "," references+=JvmTypeReference)* '}' )? '}'; JvmUnknownTypeReference returns types::JvmUnknownTypeReference: {types::JvmUnknownTypeReference} 'JvmUnknownTypeReference' ; JvmInnerTypeReference returns types::JvmInnerTypeReference: {types::JvmInnerTypeReference} 'JvmInnerTypeReference' '{' ('type' type=[types::JvmType|EString])? ('arguments' '{' arguments+=JvmTypeReference ( "," arguments+=JvmTypeReference)* '}' )? ('outer' outer=JvmParameterizedTypeReference)? '}'; JvmVoid returns types::JvmVoid: {types::JvmVoid} 'JvmVoid' ; JvmPrimitiveType returns types::JvmPrimitiveType: {types::JvmPrimitiveType} 'JvmPrimitiveType' '{' ('simpleName' simpleName=EString)? ('arrayType' arrayType=JvmArrayType)? '}'; JvmArrayType returns types::JvmArrayType: {types::JvmArrayType} 'JvmArrayType' '{' ('arrayType' arrayType=JvmArrayType)? '}'; JvmTypeParameter returns types::JvmTypeParameter: {types::JvmTypeParameter} 'JvmTypeParameter' name=EString '{' ('arrayType' arrayType=JvmArrayType)? ('constraints' '{' constraints+=JvmTypeConstraint ( "," constraints+=JvmTypeConstraint)* '}' )? '}'; JvmAnnotationType returns types::JvmAnnotationType: {types::JvmAnnotationType} (deprecated?='deprecated')? (abstract?='abstract')? (static?='static')? (final?='final')? 'JvmAnnotationType' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('packageName' packageName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('arrayType' arrayType=JvmArrayType)? ('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )? ('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )? '}'; JvmEnumerationType returns types::JvmEnumerationType: {types::JvmEnumerationType} (deprecated?='deprecated')? (abstract?='abstract')? (static?='static')? (final?='final')? 'JvmEnumerationType' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('packageName' packageName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('arrayType' arrayType=JvmArrayType)? ('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )? ('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )? '}'; JvmGenericType returns types::JvmGenericType: {types::JvmGenericType} (deprecated?='deprecated')? (abstract?='abstract')? (static?='static')? (final?='final')? (interface?='interface')? (strictFloatingPoint?='strictFloatingPoint')? (anonymous?='anonymous')? 'JvmGenericType' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('packageName' packageName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('arrayType' arrayType=JvmArrayType)? ('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )? ('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )? ('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )? '}'; EString returns ecore::EString: STRING | ID; JvmAnnotationReference returns types::JvmAnnotationReference: {types::JvmAnnotationReference} 'JvmAnnotationReference' '{' ('annotation' annotation=[types::JvmAnnotationType|EString])? ('explicitValues' '{' explicitValues+=JvmAnnotationValue ( "," explicitValues+=JvmAnnotationValue)* '}' )? '}'; enum JvmVisibility returns types::JvmVisibility: DEFAULT = 'DEFAULT' | PRIVATE = 'PRIVATE' | PROTECTED = 'PROTECTED' | PUBLIC = 'PUBLIC'; EBoolean returns ecore::EBoolean: 'true' | 'false'; JvmOperation returns types::JvmOperation: {types::JvmOperation} (deprecated?='deprecated')? (varArgs?='varArgs')? (static?='static')? (final?='final')? (abstract?='abstract')? (synchronized?='synchronized')? (default?='default')? (native?='native')? (strictFloatingPoint?='strictFloatingPoint')? 'JvmOperation' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )? ('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )? ('parameters' '{' parameters+=JvmFormalParameter ( "," parameters+=JvmFormalParameter)* '}' )? ('exceptions' '{' exceptions+=JvmTypeReference ( "," exceptions+=JvmTypeReference)* '}' )? ('returnType' returnType=JvmTypeReference)? ('defaultValue' defaultValue=JvmAnnotationValue)? '}'; JvmIntAnnotationValue returns types::JvmIntAnnotationValue: {types::JvmIntAnnotationValue} 'JvmIntAnnotationValue' '{' ('values' '{' values+=EInt ( "," values+=EInt)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmBooleanAnnotationValue returns types::JvmBooleanAnnotationValue: {types::JvmBooleanAnnotationValue} 'JvmBooleanAnnotationValue' '{' ('values' '{' values+=EBoolean ( "," values+=EBoolean)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmByteAnnotationValue returns types::JvmByteAnnotationValue: {types::JvmByteAnnotationValue} 'JvmByteAnnotationValue' '{' ('values' '{' values+=EByte ( "," values+=EByte)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmShortAnnotationValue returns types::JvmShortAnnotationValue: {types::JvmShortAnnotationValue} 'JvmShortAnnotationValue' '{' ('values' '{' values+=EShort ( "," values+=EShort)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmLongAnnotationValue returns types::JvmLongAnnotationValue: {types::JvmLongAnnotationValue} 'JvmLongAnnotationValue' '{' ('values' '{' values+=ELong ( "," values+=ELong)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmDoubleAnnotationValue returns types::JvmDoubleAnnotationValue: {types::JvmDoubleAnnotationValue} 'JvmDoubleAnnotationValue' '{' ('values' '{' values+=EDouble ( "," values+=EDouble)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmFloatAnnotationValue returns types::JvmFloatAnnotationValue: {types::JvmFloatAnnotationValue} 'JvmFloatAnnotationValue' '{' ('values' '{' values+=EFloat ( "," values+=EFloat)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmCharAnnotationValue returns types::JvmCharAnnotationValue: {types::JvmCharAnnotationValue} 'JvmCharAnnotationValue' '{' ('values' '{' values+=EChar ( "," values+=EChar)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmStringAnnotationValue returns types::JvmStringAnnotationValue: {types::JvmStringAnnotationValue} 'JvmStringAnnotationValue' '{' ('values' '{' values+=EString ( "," values+=EString)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmTypeAnnotationValue returns types::JvmTypeAnnotationValue: {types::JvmTypeAnnotationValue} 'JvmTypeAnnotationValue' '{' ('operation' operation=[types::JvmOperation|EString])? ('values' '{' values+=JvmTypeReference ( "," values+=JvmTypeReference)* '}' )? '}'; JvmAnnotationAnnotationValue returns types::JvmAnnotationAnnotationValue: {types::JvmAnnotationAnnotationValue} 'JvmAnnotationAnnotationValue' '{' ('operation' operation=[types::JvmOperation|EString])? ('values' '{' values+=JvmAnnotationReference ( "," values+=JvmAnnotationReference)* '}' )? '}'; JvmEnumAnnotationValue returns types::JvmEnumAnnotationValue: {types::JvmEnumAnnotationValue} 'JvmEnumAnnotationValue' '{' ('operation' operation=[types::JvmOperation|EString])? ('values' '(' values+=[types::JvmEnumerationLiteral|EString] ( "," values+=[types::JvmEnumerationLiteral|EString])* ')' )? '}'; JvmCustomAnnotationValue returns types::JvmCustomAnnotationValue: {types::JvmCustomAnnotationValue} 'JvmCustomAnnotationValue' '{' ('operation' operation=[types::JvmOperation|EString])? ('values' '(' values+=[ecore::EObject|EString] ( "," values+=[ecore::EObject|EString])* ')' )? '}'; JvmFormalParameter returns types::JvmFormalParameter: {types::JvmFormalParameter} 'JvmFormalParameter' name=EString '{' ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('parameterType' parameterType=JvmTypeReference)? '}'; EInt returns ecore::EInt: '-'? INT; EByte returns ecore::EByte: '-'? INT; EShort returns ecore::EShort: '-'? INT; ELong returns ecore::ELong: '-'? INT; EDouble returns ecore::EDouble: '-'? INT? '.' INT (('E'|'e') '-'? INT)?; EFloat returns ecore::EFloat: '-'? INT? '.' INT (('E'|'e') '-'? INT)?; EChar returns ecore::EChar: '-'? INT; JvmEnumerationLiteral returns types::JvmEnumerationLiteral: {types::JvmEnumerationLiteral} (deprecated?='deprecated')? (static?='static')? (final?='final')? (volatile?='volatile')? (transient?='transient')? (constant?='constant')? 'JvmEnumerationLiteral' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('constantValue' constantValue=EJavaObject)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )? ('type' type=JvmTypeReference)? '}'; EJavaObject returns ecore::EJavaObject: 'EJavaObject' /* TODO: implement this rule and an appropriate IValueConverter */; EObject returns ecore::EObject: {ecore::EObject} 'EObject' ; JvmField_Impl returns types::JvmField: {types::JvmField} (deprecated?='deprecated')? (static?='static')? (final?='final')? (volatile?='volatile')? (transient?='transient')? (constant?='constant')? 'JvmField' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('constantValue' constantValue=EJavaObject)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )? ('type' type=JvmTypeReference)? '}'; JvmConstructor returns types::JvmConstructor: {types::JvmConstructor} (deprecated?='deprecated')? (varArgs?='varArgs')? 'JvmConstructor' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )? ('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )? ('parameters' '{' parameters+=JvmFormalParameter ( "," parameters+=JvmFormalParameter)* '}' )? ('exceptions' '{' exceptions+=JvmTypeReference ( "," exceptions+=JvmTypeReference)* '}' )? '}'; JvmUpperBound returns types::JvmUpperBound: {types::JvmUpperBound} 'JvmUpperBound' '{' ('typeReference' typeReference=JvmTypeReference)? '}'; JvmLowerBound returns types::JvmLowerBound: {types::JvmLowerBound} 'JvmLowerBound' '{' ('typeReference' typeReference=JvmTypeReference)? '}'; XIfExpression returns xbase::XIfExpression: {xbase::XIfExpression} 'XIfExpression' '{' ('if' if=XExpression)? ('then' then=XExpression)? ('else' else=XExpression)? '}'; XSwitchExpression returns xbase::XSwitchExpression: {xbase::XSwitchExpression} 'XSwitchExpression' '{' ('switch' switch=XExpression)? ('cases' '{' cases+=XCasePart ( "," cases+=XCasePart)* '}' )? ('default' default=XExpression)? ('declaredParam' declaredParam=JvmFormalParameter)? '}'; XVariableDeclaration returns xbase::XVariableDeclaration: {xbase::XVariableDeclaration} (writeable?='writeable')? 'XVariableDeclaration' name=EString '{' ('type' type=JvmTypeReference)? ('right' right=XExpression)? '}'; XMemberFeatureCall returns xbase::XMemberFeatureCall: {xbase::XMemberFeatureCall} (explicitOperationCall?='explicitOperationCall')? (explicitStatic?='explicitStatic')? (nullSafe?='nullSafe')? 'XMemberFeatureCall' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('memberCallTarget' memberCallTarget=XExpression)? ('memberCallArguments' '{' memberCallArguments+=XExpression ( "," memberCallArguments+=XExpression)* '}' )? '}'; XFeatureCall returns xbase::XFeatureCall: {xbase::XFeatureCall} (explicitOperationCall?='explicitOperationCall')? 'XFeatureCall' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('featureCallArguments' '{' featureCallArguments+=XExpression ( "," featureCallArguments+=XExpression)* '}' )? '}'; XConstructorCall returns xbase::XConstructorCall: {xbase::XConstructorCall} (explicitConstructorCall?='explicitConstructorCall')? 'XConstructorCall' '{' ('constructor' constructor=[types::JvmConstructor|EString])? ('arguments' '{' arguments+=XExpression ( "," arguments+=XExpression)* '}' )? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? '}'; XBooleanLiteral returns xbase::XBooleanLiteral: {xbase::XBooleanLiteral} (isTrue?='isTrue')? 'XBooleanLiteral' ; XNullLiteral returns xbase::XNullLiteral: {xbase::XNullLiteral} 'XNullLiteral' ; XNumberLiteral returns xbase::XNumberLiteral: {xbase::XNumberLiteral} 'XNumberLiteral' '{' ('value' value=EString)? '}'; XStringLiteral returns xbase::XStringLiteral: {xbase::XStringLiteral} 'XStringLiteral' '{' ('value' value=EString)? '}'; XListLiteral returns xbase::XListLiteral: {xbase::XListLiteral} 'XListLiteral' '{' ('elements' '{' elements+=XExpression ( "," elements+=XExpression)* '}' )? '}'; XSetLiteral returns xbase::XSetLiteral: {xbase::XSetLiteral} 'XSetLiteral' '{' ('elements' '{' elements+=XExpression ( "," elements+=XExpression)* '}' )? '}'; XClosure returns xbase::XClosure: {xbase::XClosure} (explicitSyntax?='explicitSyntax')? 'XClosure' '{' ('declaredFormalParameters' '{' declaredFormalParameters+=JvmFormalParameter ( "," declaredFormalParameters+=JvmFormalParameter)* '}' )? ('expression' expression=XExpression)? '}'; XCastedExpression returns xbase::XCastedExpression: {xbase::XCastedExpression} 'XCastedExpression' '{' ('type' type=JvmTypeReference)? ('target' target=XExpression)? '}'; XBinaryOperation returns xbase::XBinaryOperation: {xbase::XBinaryOperation} (reassignFirstArgument?='reassignFirstArgument')? 'XBinaryOperation' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('leftOperand' leftOperand=XExpression)? ('rightOperand' rightOperand=XExpression)? '}'; XUnaryOperation returns xbase::XUnaryOperation: {xbase::XUnaryOperation} 'XUnaryOperation' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('operand' operand=XExpression)? '}'; XPostfixOperation returns xbase::XPostfixOperation: {xbase::XPostfixOperation} 'XPostfixOperation' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('operand' operand=XExpression)? '}'; XForLoopExpression returns xbase::XForLoopExpression: {xbase::XForLoopExpression} 'XForLoopExpression' '{' ('forExpression' forExpression=XExpression)? ('eachExpression' eachExpression=XExpression)? ('declaredParam' declaredParam=JvmFormalParameter)? '}'; XBasicForLoopExpression returns xbase::XBasicForLoopExpression: {xbase::XBasicForLoopExpression} 'XBasicForLoopExpression' '{' ('expression' expression=XExpression)? ('eachExpression' eachExpression=XExpression)? ('initExpressions' '{' initExpressions+=XExpression ( "," initExpressions+=XExpression)* '}' )? ('updateExpressions' '{' updateExpressions+=XExpression ( "," updateExpressions+=XExpression)* '}' )? '}'; XDoWhileExpression returns xbase::XDoWhileExpression: {xbase::XDoWhileExpression} 'XDoWhileExpression' '{' ('predicate' predicate=XExpression)? ('body' body=XExpression)? '}'; XWhileExpression returns xbase::XWhileExpression: {xbase::XWhileExpression} 'XWhileExpression' '{' ('predicate' predicate=XExpression)? ('body' body=XExpression)? '}'; XTypeLiteral returns xbase::XTypeLiteral: 'XTypeLiteral' '{' ('arrayDimensions' '{' arrayDimensions+=EString ( "," arrayDimensions+=EString)* '}' )? 'type' type=[types::JvmType|EString] '}'; XInstanceOfExpression returns xbase::XInstanceOfExpression: 'XInstanceOfExpression' '{' 'type' type=JvmTypeReference 'expression' expression=XExpression '}'; XThrowExpression returns xbase::XThrowExpression: {xbase::XThrowExpression} 'XThrowExpression' '{' ('expression' expression=XExpression)? '}'; XTryCatchFinallyExpression returns xbase::XTryCatchFinallyExpression: {xbase::XTryCatchFinallyExpression} 'XTryCatchFinallyExpression' '{' ('expression' expression=XExpression)? ('finallyExpression' finallyExpression=XExpression)? ('catchClauses' '{' catchClauses+=XCatchClause ( "," catchClauses+=XCatchClause)* '}' )? '}'; XAssignment returns xbase::XAssignment: {xbase::XAssignment} (explicitStatic?='explicitStatic')? 'XAssignment' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('assignable' assignable=XExpression)? ('value' value=XExpression)? '}'; Rebuilds Xbase grammar without reusing it…
  • 69. Wizard does crazy things…// automatically generated by Xtext grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals import "http://www.xtext.org/example/xbase" import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase import "http://www.eclipse.org/emf/2002/Ecore" as ecore MyClass returns MyClass: {MyClass} 'MyClass' '{' ('ref' ref=JvmTypeReference)? ('body' body=XBlockExpression)? '}'; JvmTypeReference returns types::JvmTypeReference: JvmParameterizedTypeReference_Impl | JvmGenericArrayTypeReference | JvmWildcardTypeReference | JvmAnyTypeReference | JvmMultiTypeReference | JvmDelegateTypeReference | JvmSynonymTypeReference | JvmUnknownTypeReference | JvmInnerTypeReference; XExpression returns xbase::XExpression: XIfExpression | XSwitchExpression | XBlockExpression | XVariableDeclaration | XMemberFeatureCall | XFeatureCall | XConstructorCall | XBooleanLiteral | XNullLiteral | XNumberLiteral | XStringLiteral | XListLiteral | XSetLiteral | XClosure | XCastedExpression | XBinaryOperation | XUnaryOperation | XPostfixOperation | XForLoopExpression | XBasicForLoopExpression | XDoWhileExpression | XWhileExpression | XTypeLiteral | XInstanceOfExpression | XThrowExpression | XTryCatchFinallyExpression | XAssignment | XReturnExpression | XSynchronizedExpression; JvmType returns types::JvmType: JvmVoid | JvmPrimitiveType | JvmArrayType | JvmTypeParameter | JvmAnnotationType | JvmEnumerationType | JvmGenericType; JvmTypeConstraint returns types::JvmTypeConstraint: JvmUpperBound | JvmLowerBound; JvmParameterizedTypeReference returns types::JvmParameterizedTypeReference: JvmParameterizedTypeReference_Impl | JvmInnerTypeReference; JvmMember returns types::JvmMember: JvmAnnotationType | JvmEnumerationType | JvmEnumerationLiteral | JvmGenericType | JvmField_Impl | JvmConstructor | JvmOperation; JvmAnnotationValue returns types::JvmAnnotationValue: JvmIntAnnotationValue | JvmBooleanAnnotationValue | JvmByteAnnotationValue | JvmShortAnnotationValue | JvmLongAnnotationValue | JvmDoubleAnnotationValue | JvmFloatAnnotationValue | JvmCharAnnotationValue | JvmStringAnnotationValue | JvmTypeAnnotationValue | JvmAnnotationAnnotationValue | JvmEnumAnnotationValue | JvmCustomAnnotationValue; JvmIdentifiableElement returns types::JvmIdentifiableElement: JvmVoid | JvmPrimitiveType | JvmArrayType | JvmTypeParameter | JvmAnnotationType | JvmEnumerationType | JvmEnumerationLiteral | JvmGenericType | JvmField_Impl | JvmConstructor | JvmOperation | JvmFormalParameter; XBlockExpression returns xbase::XBlockExpression: {xbase::XBlockExpression} 'XBlockExpression' '{' ('expressions' '{' expressions+=XExpression ( "," expressions+=XExpression)* '}' )? '}'; JvmParameterizedTypeReference_Impl returns types::JvmParameterizedTypeReference: {types::JvmParameterizedTypeReference} 'JvmParameterizedTypeReference' '{' ('type' type=[types::JvmType|EString])? ('arguments' '{' arguments+=JvmTypeReference ( "," arguments+=JvmTypeReference)* '}' )? '}'; JvmGenericArrayTypeReference returns types::JvmGenericArrayTypeReference: {types::JvmGenericArrayTypeReference} 'JvmGenericArrayTypeReference' '{' ('componentType' componentType=JvmTypeReference)? '}'; JvmWildcardTypeReference returns types::JvmWildcardTypeReference: {types::JvmWildcardTypeReference} 'JvmWildcardTypeReference' '{' ('constraints' '{' constraints+=JvmTypeConstraint ( "," constraints+=JvmTypeConstraint)* '}' )? '}'; JvmAnyTypeReference returns types::JvmAnyTypeReference: {types::JvmAnyTypeReference} 'JvmAnyTypeReference' '{' ('type' type=[types::JvmType|EString])? '}'; JvmMultiTypeReference returns types::JvmMultiTypeReference: {types::JvmMultiTypeReference} 'JvmMultiTypeReference' '{' ('type' type=[types::JvmType|EString])? ('references' '{' references+=JvmTypeReference ( "," references+=JvmTypeReference)* '}' )? '}'; JvmDelegateTypeReference returns types::JvmDelegateTypeReference: {types::JvmDelegateTypeReference} 'JvmDelegateTypeReference' '{' ('delegate' delegate=[types::JvmTypeReference|EString])? '}'; JvmSynonymTypeReference returns types::JvmSynonymTypeReference: {types::JvmSynonymTypeReference} 'JvmSynonymTypeReference' '{' ('type' type=[types::JvmType|EString])? ('references' '{' references+=JvmTypeReference ( "," references+=JvmTypeReference)* '}' )? '}'; JvmUnknownTypeReference returns types::JvmUnknownTypeReference: {types::JvmUnknownTypeReference} 'JvmUnknownTypeReference' ; JvmInnerTypeReference returns types::JvmInnerTypeReference: {types::JvmInnerTypeReference} 'JvmInnerTypeReference' '{' ('type' type=[types::JvmType|EString])? ('arguments' '{' arguments+=JvmTypeReference ( "," arguments+=JvmTypeReference)* '}' )? ('outer' outer=JvmParameterizedTypeReference)? '}'; JvmVoid returns types::JvmVoid: {types::JvmVoid} 'JvmVoid' ; JvmPrimitiveType returns types::JvmPrimitiveType: {types::JvmPrimitiveType} 'JvmPrimitiveType' '{' ('simpleName' simpleName=EString)? ('arrayType' arrayType=JvmArrayType)? '}'; JvmArrayType returns types::JvmArrayType: {types::JvmArrayType} 'JvmArrayType' '{' ('arrayType' arrayType=JvmArrayType)? '}'; JvmTypeParameter returns types::JvmTypeParameter: {types::JvmTypeParameter} 'JvmTypeParameter' name=EString '{' ('arrayType' arrayType=JvmArrayType)? ('constraints' '{' constraints+=JvmTypeConstraint ( "," constraints+=JvmTypeConstraint)* '}' )? '}'; JvmAnnotationType returns types::JvmAnnotationType: {types::JvmAnnotationType} (deprecated?='deprecated')? (abstract?='abstract')? (static?='static')? (final?='final')? 'JvmAnnotationType' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('packageName' packageName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('arrayType' arrayType=JvmArrayType)? ('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )? ('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )? '}'; JvmEnumerationType returns types::JvmEnumerationType: {types::JvmEnumerationType} (deprecated?='deprecated')? (abstract?='abstract')? (static?='static')? (final?='final')? 'JvmEnumerationType' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('packageName' packageName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('arrayType' arrayType=JvmArrayType)? ('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )? ('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )? '}'; JvmGenericType returns types::JvmGenericType: {types::JvmGenericType} (deprecated?='deprecated')? (abstract?='abstract')? (static?='static')? (final?='final')? (interface?='interface')? (strictFloatingPoint?='strictFloatingPoint')? (anonymous?='anonymous')? 'JvmGenericType' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('packageName' packageName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('arrayType' arrayType=JvmArrayType)? ('superTypes' '{' superTypes+=JvmTypeReference ( "," superTypes+=JvmTypeReference)* '}' )? ('members' '{' members+=JvmMember ( "," members+=JvmMember)* '}' )? ('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )? '}'; EString returns ecore::EString: STRING | ID; JvmAnnotationReference returns types::JvmAnnotationReference: {types::JvmAnnotationReference} 'JvmAnnotationReference' '{' ('annotation' annotation=[types::JvmAnnotationType|EString])? ('explicitValues' '{' explicitValues+=JvmAnnotationValue ( "," explicitValues+=JvmAnnotationValue)* '}' )? '}'; enum JvmVisibility returns types::JvmVisibility: DEFAULT = 'DEFAULT' | PRIVATE = 'PRIVATE' | PROTECTED = 'PROTECTED' | PUBLIC = 'PUBLIC'; EBoolean returns ecore::EBoolean: 'true' | 'false'; JvmOperation returns types::JvmOperation: {types::JvmOperation} (deprecated?='deprecated')? (varArgs?='varArgs')? (static?='static')? (final?='final')? (abstract?='abstract')? (synchronized?='synchronized')? (default?='default')? (native?='native')? (strictFloatingPoint?='strictFloatingPoint')? 'JvmOperation' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )? ('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )? ('parameters' '{' parameters+=JvmFormalParameter ( "," parameters+=JvmFormalParameter)* '}' )? ('exceptions' '{' exceptions+=JvmTypeReference ( "," exceptions+=JvmTypeReference)* '}' )? ('returnType' returnType=JvmTypeReference)? ('defaultValue' defaultValue=JvmAnnotationValue)? '}'; JvmIntAnnotationValue returns types::JvmIntAnnotationValue: {types::JvmIntAnnotationValue} 'JvmIntAnnotationValue' '{' ('values' '{' values+=EInt ( "," values+=EInt)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmBooleanAnnotationValue returns types::JvmBooleanAnnotationValue: {types::JvmBooleanAnnotationValue} 'JvmBooleanAnnotationValue' '{' ('values' '{' values+=EBoolean ( "," values+=EBoolean)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmByteAnnotationValue returns types::JvmByteAnnotationValue: {types::JvmByteAnnotationValue} 'JvmByteAnnotationValue' '{' ('values' '{' values+=EByte ( "," values+=EByte)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmShortAnnotationValue returns types::JvmShortAnnotationValue: {types::JvmShortAnnotationValue} 'JvmShortAnnotationValue' '{' ('values' '{' values+=EShort ( "," values+=EShort)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmLongAnnotationValue returns types::JvmLongAnnotationValue: {types::JvmLongAnnotationValue} 'JvmLongAnnotationValue' '{' ('values' '{' values+=ELong ( "," values+=ELong)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmDoubleAnnotationValue returns types::JvmDoubleAnnotationValue: {types::JvmDoubleAnnotationValue} 'JvmDoubleAnnotationValue' '{' ('values' '{' values+=EDouble ( "," values+=EDouble)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmFloatAnnotationValue returns types::JvmFloatAnnotationValue: {types::JvmFloatAnnotationValue} 'JvmFloatAnnotationValue' '{' ('values' '{' values+=EFloat ( "," values+=EFloat)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmCharAnnotationValue returns types::JvmCharAnnotationValue: {types::JvmCharAnnotationValue} 'JvmCharAnnotationValue' '{' ('values' '{' values+=EChar ( "," values+=EChar)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmStringAnnotationValue returns types::JvmStringAnnotationValue: {types::JvmStringAnnotationValue} 'JvmStringAnnotationValue' '{' ('values' '{' values+=EString ( "," values+=EString)* '}' )? ('operation' operation=[types::JvmOperation|EString])? '}'; JvmTypeAnnotationValue returns types::JvmTypeAnnotationValue: {types::JvmTypeAnnotationValue} 'JvmTypeAnnotationValue' '{' ('operation' operation=[types::JvmOperation|EString])? ('values' '{' values+=JvmTypeReference ( "," values+=JvmTypeReference)* '}' )? '}'; JvmAnnotationAnnotationValue returns types::JvmAnnotationAnnotationValue: {types::JvmAnnotationAnnotationValue} 'JvmAnnotationAnnotationValue' '{' ('operation' operation=[types::JvmOperation|EString])? ('values' '{' values+=JvmAnnotationReference ( "," values+=JvmAnnotationReference)* '}' )? '}'; JvmEnumAnnotationValue returns types::JvmEnumAnnotationValue: {types::JvmEnumAnnotationValue} 'JvmEnumAnnotationValue' '{' ('operation' operation=[types::JvmOperation|EString])? ('values' '(' values+=[types::JvmEnumerationLiteral|EString] ( "," values+=[types::JvmEnumerationLiteral|EString])* ')' )? '}'; JvmCustomAnnotationValue returns types::JvmCustomAnnotationValue: {types::JvmCustomAnnotationValue} 'JvmCustomAnnotationValue' '{' ('operation' operation=[types::JvmOperation|EString])? ('values' '(' values+=[ecore::EObject|EString] ( "," values+=[ecore::EObject|EString])* ')' )? '}'; JvmFormalParameter returns types::JvmFormalParameter: {types::JvmFormalParameter} 'JvmFormalParameter' name=EString '{' ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('parameterType' parameterType=JvmTypeReference)? '}'; EInt returns ecore::EInt: '-'? INT; EByte returns ecore::EByte: '-'? INT; EShort returns ecore::EShort: '-'? INT; ELong returns ecore::ELong: '-'? INT; EDouble returns ecore::EDouble: '-'? INT? '.' INT (('E'|'e') '-'? INT)?; EFloat returns ecore::EFloat: '-'? INT? '.' INT (('E'|'e') '-'? INT)?; EChar returns ecore::EChar: '-'? INT; JvmEnumerationLiteral returns types::JvmEnumerationLiteral: {types::JvmEnumerationLiteral} (deprecated?='deprecated')? (static?='static')? (final?='final')? (volatile?='volatile')? (transient?='transient')? (constant?='constant')? 'JvmEnumerationLiteral' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('constantValue' constantValue=EJavaObject)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )? ('type' type=JvmTypeReference)? '}'; EJavaObject returns ecore::EJavaObject: 'EJavaObject' /* TODO: implement this rule and an appropriate IValueConverter */; EObject returns ecore::EObject: {ecore::EObject} 'EObject' ; JvmField_Impl returns types::JvmField: {types::JvmField} (deprecated?='deprecated')? (static?='static')? (final?='final')? (volatile?='volatile')? (transient?='transient')? (constant?='constant')? 'JvmField' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('constantValue' constantValue=EJavaObject)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )? ('type' type=JvmTypeReference)? '}'; JvmConstructor returns types::JvmConstructor: {types::JvmConstructor} (deprecated?='deprecated')? (varArgs?='varArgs')? 'JvmConstructor' '{' ('visibility' visibility=JvmVisibility)? ('simpleName' simpleName=EString)? ('annotations' '{' annotations+=JvmAnnotationReference ( "," annotations+=JvmAnnotationReference)* '}' )? ('localClasses' '{' localClasses+=JvmGenericType ( "," localClasses+=JvmGenericType)* '}' )? ('typeParameters' '{' typeParameters+=JvmTypeParameter ( "," typeParameters+=JvmTypeParameter)* '}' )? ('parameters' '{' parameters+=JvmFormalParameter ( "," parameters+=JvmFormalParameter)* '}' )? ('exceptions' '{' exceptions+=JvmTypeReference ( "," exceptions+=JvmTypeReference)* '}' )? '}'; JvmUpperBound returns types::JvmUpperBound: {types::JvmUpperBound} 'JvmUpperBound' '{' ('typeReference' typeReference=JvmTypeReference)? '}'; JvmLowerBound returns types::JvmLowerBound: {types::JvmLowerBound} 'JvmLowerBound' '{' ('typeReference' typeReference=JvmTypeReference)? '}'; XIfExpression returns xbase::XIfExpression: {xbase::XIfExpression} 'XIfExpression' '{' ('if' if=XExpression)? ('then' then=XExpression)? ('else' else=XExpression)? '}'; XSwitchExpression returns xbase::XSwitchExpression: {xbase::XSwitchExpression} 'XSwitchExpression' '{' ('switch' switch=XExpression)? ('cases' '{' cases+=XCasePart ( "," cases+=XCasePart)* '}' )? ('default' default=XExpression)? ('declaredParam' declaredParam=JvmFormalParameter)? '}'; XVariableDeclaration returns xbase::XVariableDeclaration: {xbase::XVariableDeclaration} (writeable?='writeable')? 'XVariableDeclaration' name=EString '{' ('type' type=JvmTypeReference)? ('right' right=XExpression)? '}'; XMemberFeatureCall returns xbase::XMemberFeatureCall: {xbase::XMemberFeatureCall} (explicitOperationCall?='explicitOperationCall')? (explicitStatic?='explicitStatic')? (nullSafe?='nullSafe')? 'XMemberFeatureCall' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('memberCallTarget' memberCallTarget=XExpression)? ('memberCallArguments' '{' memberCallArguments+=XExpression ( "," memberCallArguments+=XExpression)* '}' )? '}'; XFeatureCall returns xbase::XFeatureCall: {xbase::XFeatureCall} (explicitOperationCall?='explicitOperationCall')? 'XFeatureCall' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('featureCallArguments' '{' featureCallArguments+=XExpression ( "," featureCallArguments+=XExpression)* '}' )? '}'; XConstructorCall returns xbase::XConstructorCall: {xbase::XConstructorCall} (explicitConstructorCall?='explicitConstructorCall')? 'XConstructorCall' '{' ('constructor' constructor=[types::JvmConstructor|EString])? ('arguments' '{' arguments+=XExpression ( "," arguments+=XExpression)* '}' )? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? '}'; XBooleanLiteral returns xbase::XBooleanLiteral: {xbase::XBooleanLiteral} (isTrue?='isTrue')? 'XBooleanLiteral' ; XNullLiteral returns xbase::XNullLiteral: {xbase::XNullLiteral} 'XNullLiteral' ; XNumberLiteral returns xbase::XNumberLiteral: {xbase::XNumberLiteral} 'XNumberLiteral' '{' ('value' value=EString)? '}'; XStringLiteral returns xbase::XStringLiteral: {xbase::XStringLiteral} 'XStringLiteral' '{' ('value' value=EString)? '}'; XListLiteral returns xbase::XListLiteral: {xbase::XListLiteral} 'XListLiteral' '{' ('elements' '{' elements+=XExpression ( "," elements+=XExpression)* '}' )? '}'; XSetLiteral returns xbase::XSetLiteral: {xbase::XSetLiteral} 'XSetLiteral' '{' ('elements' '{' elements+=XExpression ( "," elements+=XExpression)* '}' )? '}'; XClosure returns xbase::XClosure: {xbase::XClosure} (explicitSyntax?='explicitSyntax')? 'XClosure' '{' ('declaredFormalParameters' '{' declaredFormalParameters+=JvmFormalParameter ( "," declaredFormalParameters+=JvmFormalParameter)* '}' )? ('expression' expression=XExpression)? '}'; XCastedExpression returns xbase::XCastedExpression: {xbase::XCastedExpression} 'XCastedExpression' '{' ('type' type=JvmTypeReference)? ('target' target=XExpression)? '}'; XBinaryOperation returns xbase::XBinaryOperation: {xbase::XBinaryOperation} (reassignFirstArgument?='reassignFirstArgument')? 'XBinaryOperation' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('leftOperand' leftOperand=XExpression)? ('rightOperand' rightOperand=XExpression)? '}'; XUnaryOperation returns xbase::XUnaryOperation: {xbase::XUnaryOperation} 'XUnaryOperation' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('operand' operand=XExpression)? '}'; XPostfixOperation returns xbase::XPostfixOperation: {xbase::XPostfixOperation} 'XPostfixOperation' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('operand' operand=XExpression)? '}'; XForLoopExpression returns xbase::XForLoopExpression: {xbase::XForLoopExpression} 'XForLoopExpression' '{' ('forExpression' forExpression=XExpression)? ('eachExpression' eachExpression=XExpression)? ('declaredParam' declaredParam=JvmFormalParameter)? '}'; XBasicForLoopExpression returns xbase::XBasicForLoopExpression: {xbase::XBasicForLoopExpression} 'XBasicForLoopExpression' '{' ('expression' expression=XExpression)? ('eachExpression' eachExpression=XExpression)? ('initExpressions' '{' initExpressions+=XExpression ( "," initExpressions+=XExpression)* '}' )? ('updateExpressions' '{' updateExpressions+=XExpression ( "," updateExpressions+=XExpression)* '}' )? '}'; XDoWhileExpression returns xbase::XDoWhileExpression: {xbase::XDoWhileExpression} 'XDoWhileExpression' '{' ('predicate' predicate=XExpression)? ('body' body=XExpression)? '}'; XWhileExpression returns xbase::XWhileExpression: {xbase::XWhileExpression} 'XWhileExpression' '{' ('predicate' predicate=XExpression)? ('body' body=XExpression)? '}'; XTypeLiteral returns xbase::XTypeLiteral: 'XTypeLiteral' '{' ('arrayDimensions' '{' arrayDimensions+=EString ( "," arrayDimensions+=EString)* '}' )? 'type' type=[types::JvmType|EString] '}'; XInstanceOfExpression returns xbase::XInstanceOfExpression: 'XInstanceOfExpression' '{' 'type' type=JvmTypeReference 'expression' expression=XExpression '}'; XThrowExpression returns xbase::XThrowExpression: {xbase::XThrowExpression} 'XThrowExpression' '{' ('expression' expression=XExpression)? '}'; XTryCatchFinallyExpression returns xbase::XTryCatchFinallyExpression: {xbase::XTryCatchFinallyExpression} 'XTryCatchFinallyExpression' '{' ('expression' expression=XExpression)? ('finallyExpression' finallyExpression=XExpression)? ('catchClauses' '{' catchClauses+=XCatchClause ( "," catchClauses+=XCatchClause)* '}' )? '}'; XAssignment returns xbase::XAssignment: {xbase::XAssignment} (explicitStatic?='explicitStatic')? 'XAssignment' '{' ('feature' feature=[types::JvmIdentifiableElement|EString])? ('typeArguments' '{' typeArguments+=JvmTypeReference ( "," typeArguments+=JvmTypeReference)* '}' )? ('assignable' assignable=XExpression)? ('value' value=XExpression)? '}'; Generator wrongly configured
  • 72. I am missing the Maven part…
  • 73. https://github.com/holgerschill/XtextCon_Xcore_Maven A full working example can be found here Tycho Xtext Maven Plugin Exec-Maven-Plugin Xtend Maven Plugin
  • 75. Pittfalls Right dependencies to generate Java out of Xcore <dependencies> <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.core</artifactId> <version>4.3.1</version> </dependency> <dependency> <groupId>org.eclipse.core</groupId> <artifactId>org.eclipse.core.resources</artifactId> <version>3.7.100</version> </dependency> <dependency> <groupId>org.eclipse.text</groupId> <artifactId>org.eclipse.text</artifactId> <version>3.5.101</version> </dependency> <dependency> <groupId>org.eclipse.emf</groupId> <artifactId>org.eclipse.emf.codegen.ecore.xtext</artifactId> <version>${ecore-xtext-version}</version> </dependency> <dependency> <groupId>org.eclipse.emf</groupId> <artifactId>org.eclipse.emf.ecore.xcore.lib</artifactId> <version>${ecore-xcore-lib-version}</version> </dependency> <dependency> <groupId>org.eclipse.emf</groupId> <artifactId>org.eclipse.emf.ecore.xcore</artifactId> <version>${ecore-xcore-version}</version> </dependency> </dependencies>
  • 76. Pittfalls Set modelDirectory in Xcore files explicitly @GenModel(modelDirectory="./src-gen") package org.xtext.example.myfirstdsl import common.NamedElement import common.Referenceable class FirstElement extends NamedElement, Referenceable { refers Referenceable ref }
  • 77. Pittfalls Don’t use classpath URIs in MWE2 var fileExtensions = "first" var projectName = "org.xtext.example.firstdsl.lang" var runtimeProject = "../${projectName}" var generateXtendStub = true //var grammarURI = "classpath:/org/xtext/example/firstdsl/Lang.xtext" var grammarURI = "platform:/resource/${projectName}/src/org/xtext/example/firstdsl/Lang.xtext"
  • 78. Pittfalls Explicitly set path to generate Java classes // generates Java API for the generated EPackages fragment = ecore.EMFGeneratorFragment auto-inject { javaModelDirectory = "/${projectName}/src-gen" }