Created
December 7, 2011 18:31
-
-
Save schakko/1444002 to your computer and use it in GitHub Desktop.
DSL for protyping application w/integrated function point analysis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar de.ckl.Mydsl with org.eclipse.xtext.common.Terminals | |
generate mydsl "http://www.ckl.de/Mydsl | |
Model: | |
(domains+=Domain)*; | |
Operation: | |
(OperationContainer | OperationCreate | OperationList | OperationEdit | OperationDelete) | |
; | |
OperationContainer: | |
operation='container''{' | |
(('referenced-processes' '{' | |
(referencedProcesses+=Transition*) | |
'}') | |
& | |
('options' '{' | |
('container-as:' placeInto=('module' | 'page-in-module' | 'form-in-page')) | |
'}' | |
)?) | |
'}' | |
; | |
Transition: | |
(domain=[Domain] '->' process=[Process]) | |
; | |
OperationList: | |
operation='list''{' | |
'}' | |
; | |
OperationCreate: | |
operation='create' | |
; | |
OperationEdit: | |
operation='edit' | |
; | |
OperationDelete: | |
operation='delete' | |
; | |
Domain: | |
name=ID '{' | |
( | |
(transient='transient')? & | |
('attributes''{' | |
attributes+=Attribute* | |
'}')? & | |
('references''{' | |
references+=Reference* | |
'}')? & | |
('processes''{' | |
processes+=Process* | |
'}')?) | |
'}'; | |
Reference: | |
referenceType=ReferenceType ':' refDomain=[Domain] ('{' options=ReferenceOptions '}')?; | |
ReferenceType: | |
referenceType=('has-one' | 'has-many' | 'belongs-to-one' | 'belongs-to-many'); | |
ReferenceOptions: | |
defaultOptions=DefaultOptions | |
; | |
Attribute: | |
name=ID ':' dataType=PrimitiveDataType; | |
Process: | |
name=ID '{' | |
labelType=LabelType | |
('operation: ' operation=Operation) | |
'}'; | |
PrimitiveDataType: | |
(TypeString | TypeInteger | TypeDate | TypeDouble | TypeBoolean | TypeEnum | TypeDateTime); | |
DefaultOptions: | |
( | |
(exampleType=ExampleType)? & | |
(labelType=LabelType)? & | |
(descriptionType=DescriptionType)? | |
) | |
; | |
PrimitiveDateTypeDefaultOptions: | |
(defaultOptions=DefaultOptions & | |
(dataDefault='default:'defaultsTo=STRING)?); | |
ExampleType: | |
('examples:' (examples+=STRING+)) | |
; | |
LabelType: | |
('label:' label=STRING); | |
DescriptionType: | |
('description:' description=STRING); | |
TypeString: | |
type='string' ('('maxlength=INT')')? (nullable='?')? ('{' defaultOptions=PrimitiveDateTypeDefaultOptions '}')?; | |
TypeInteger: | |
type='integer' ('{' defaultOptions=PrimitiveDateTypeDefaultOptions '}')?; | |
TypeDate: | |
type='date' (nullable='?')? ('{' defaultOptions=PrimitiveDateTypeDefaultOptions '}')?; | |
TypeDateTime: | |
type='datetime' (nullable='?')? ('{' defaultOptions=PrimitiveDateTypeDefaultOptions '}')?; | |
TypeDouble: | |
type='double' ('{' defaultOptions=PrimitiveDateTypeDefaultOptions '}')?; | |
TypeBoolean: | |
type='boolean' ('{' (defaultOptions=PrimitiveDateTypeDefaultOptions) '}')?; | |
TypeEnum: | |
type='enum''('enums+=STRING*')' ('{' defaultOptions=PrimitiveDateTypeDefaultOptions '}')?; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment