blob: e5a8f945105002be2330d916ec67bc908ab993b1 [file] [log] [blame]
grammar org.eclipse.emf.parsley.dsl.EmfParsleyDsl with
org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types
generate model "http://www.eclipse.org/emf/parsley/dsl/EmfParsleyDsl"
Model:
importSection=XImportSection?
module = Module;
Module:
'module' name=QualifiedName (extendsClause=ExtendsClause)? '{'
(
(bindingsSpecification = BindingsSpecification)?
&
(labelProvider = LabelProvider)?
&
(tableLabelProvider = TableLabelProvider)?
&
(featureCaptionProvider = FeatureCaptionProvider)?
&
(formFeatureCaptionProvider = FormFeatureCaptionProvider)?
&
(dialogFeatureCaptionProvider = DialogFeatureCaptionProvider)?
&
(featuresProvider = FeaturesProvider)?
&
(tableFeaturesProvider = TableFeaturesProvider)?
&
(formControlFactory = FormControlFactory)?
&
(dialogControlFactory = DialogControlFactory)?
&
(proposalCreator = ProposalCreator)?
&
(menuBuilder = MenuBuilder)?
&
(configurator = Configurator)?
&
(viewerContentProvider = ViewerContentProvider)?
&
(partsSpecifications = PartsSpecifications)?
&
(resourceManager = ResourceManager)?
)
'}'
;
ExtendsClause: 'extends' superType=JvmTypeReference;
BindingsSpecification:
{BindingsSpecification} 'bindings' '{'
bindings += Binding*
'}'
;
Binding:
{TypeBinding} 'type' typeToBind=JvmTypeReference '->' to=XExpression |
{ProviderBinding} 'provide' type=JvmTypeReference '->' to=XExpression |
{ValueBinding} 'value' typeDecl=JvmTypeReference id=ValidID '->' to=XExpression
;
LabelProvider:
{LabelProvider} 'labelProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'text' '{'
labelSpecifications+=LabelSpecification*
'}'
)?
&
(
'image' '{'
imageSpecifications+=LabelSpecification*
'}'
)?)
'}'
;
FieldSpecification:
annotations+=XAnnotation*
(writeable?='var'|'val')
(
extension?='extension' type=JvmTypeReference
|
type=JvmTypeReference?
)
name=ValidID ('=' right=XExpression)? ';'?
;
TableLabelProvider:
{TableLabelProvider} 'tableLabelProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'text' '{'
labelSpecifications+=FeatureAssociatedExpression*
'}'
)?
&
(
'image' '{'
imageSpecifications+=FeatureAssociatedExpression*
'}'
)?)
'}'
;
LabelSpecification:
parameterType=JvmTypeReference (name=ValidID)?
'->'
expression = XExpression
;
FeatureCaptionProvider:
{FeatureCaptionProvider} 'featureCaptionProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'text' '{'
specifications+=FeatureAssociatedExpression*
'}'
)?)
'}'
;
FormFeatureCaptionProvider:
{FormFeatureCaptionProvider} 'formFeatureCaptionProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'text' '{'
specifications+=FeatureAssociatedExpression*
'}'
)?
&
(
'label' '{'
labelSpecifications+=FeatureAssociatedExpression*
'}'
)?)
'}'
;
DialogFeatureCaptionProvider:
{DialogFeatureCaptionProvider} 'dialogFeatureCaptionProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'text' '{'
specifications+=FeatureAssociatedExpression*
'}'
)?
&
(
'label' '{'
labelSpecifications+=FeatureAssociatedExpression*
'}'
)?)
'}'
;
/**
* Specify an XExpression associated to an EStructuralFeature
* (actually we associated to the Java get method in the generated code, which
* corresponds to the original EStructuralFeature).
*/
FeatureAssociatedExpression:
parameterType=JvmTypeReference ':' feature=[types::JvmMember]
'->'
expression = XExpression
;
FeaturesProvider:
{FeaturesProvider} 'featuresProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'features' '{'
featureSpecifications+=FeatureSpecification*
'}'
)?)
'}'
;
TableFeaturesProvider:
{TableFeaturesProvider} 'tableFeaturesProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'features' '{'
featureSpecifications+=FeatureSpecification*
'}'
)?)
'}'
;
FeatureSpecification:
parameterType=JvmTypeReference
'->'
features += [types::JvmMember] (',' features += [types::JvmMember])*
;
FormControlFactory:
{FormControlFactory} 'formControlFactory' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
(
'control' '{'
controlSpecifications+=ControlFactorySpecification*
'}'
)?
'}'
;
DialogControlFactory:
{DialogControlFactory} 'dialogControlFactory' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
(
'control' '{'
controlSpecifications+=ControlFactorySpecification*
'}'
)?
'}'
;
ControlFactorySpecification:
parameterType=JvmTypeReference ':' feature=[types::JvmMember]
'->'
expression = XExpression
('target' target = XExpression)?
;
ProposalCreator:
{ProposalCreator} 'proposals' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
proposalsSpecifications+=FeatureAssociatedExpression*
'}'
;
MenuBuilder:
{MenuBuilder} 'menuBuilder' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'menus' '{'
menuSpecifications+=LabelSpecification*
'}'
)?
&
(
'emfMenus' '{'
emfMenuSpecifications+=LabelSpecification*
'}'
)?)
'}'
;
Configurator:
{Configurator} 'configurator' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
(
(
'resourceURI' '{'
resourceURISpecifications+=LabelSpecification*
'}'
)?
&
(
'eClass' '{'
eClassSpecifications+=LabelSpecification*
'}'
)?
&
(
'eStructuralFeature' '{'
eStructuralFeatureSpecifications+=LabelSpecification*
'}'
)?
&
(
'contents' '{'
contentsSpecifications+=LabelSpecification*
'}'
)?
)
'}'
;
ViewerContentProvider:
{ViewerContentProvider} 'viewerContentProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'elements' '{'
elementsSpecifications+=LabelSpecification*
'}'
)?
&
(
'children' '{'
childrenSpecifications+=LabelSpecification*
'}'
)?)
'}'
;
ResourceManager:
{ResourceManager} 'resourceManager' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
((
'initializeResource' initializeBody=SimpleMethodSpecification
)?
&
(
'saveResource' saveBody=SimpleMethodSpecification
)?)
'}'
;
SimpleMethodSpecification:
body=XBlockExpression
;
// a utility base class for rules which access features of an EClass
// IMPORTANT: update EmfParsleyDslExpectedSuperTypes if you add another element
EmfFeatureAccess:
FeatureAssociatedExpression |
FeatureSpecification |
ControlFactorySpecification
;
// IMPORTANT: update EmfParsleyDslExpectedSuperTypes if you add another element
AbstractFeatureCaptionProviderWithLabel:
FormFeatureCaptionProvider | DialogFeatureCaptionProvider
;
// IMPORTANT: update EmfParsleyDslExpectedSuperTypes if you add another element
AbstractFeatureProvider:
FeaturesProvider | TableFeaturesProvider
;
// IMPORTANT: update EmfParsleyDslExpectedSuperTypes if you add another element
AbstractControlFactory:
FormControlFactory | DialogControlFactory
;
// a utility base class for rules with 'extends' clause
// IMPORTANT: update EmfParsleyDslExpectedSuperTypes if you add another element
WithExtendsClause:
Module | WithFields
;
// IMPORTANT: update EmfParsleyDslExpectedSuperTypes if you add another element
WithFields:
LabelProvider | TableLabelProvider | FeatureCaptionProvider | AbstractFeatureCaptionProviderWithLabel |
AbstractFeatureProvider | AbstractControlFactory | ProposalCreator | ViewerContentProvider |
MenuBuilder | Configurator | ResourceManager
;
PartsSpecifications:
{PartsSpecifications} 'parts' '{'
parts += PartSpecification*
'}'
;
PartSpecification: ViewSpecification;
ViewSpecification:
{ViewSpecification} 'viewpart' id=QualifiedName '{'
'viewname' viewName=STRING
'viewclass' type=JvmTypeReference
('viewcategory' category=QualifiedName)?
'}'
;