grammar org.xtext.example.mydsl.ClipsDSL hidden(WS) generate clipsDSL "http://www.xtext.org/example/mydsl/ClipsDSL" import "http://www.eclipse.org/emf/2002/Ecore" as ecore Model: (templates+=DeftemplateConstruct)*; terminal WS : (' '|'\t'|'\r'|'\n'); terminal fragment MINUS: '-'; terminal fragment PLUS: '+'; terminal fragment SMALLLETTER: ('a' .. 'z'); terminal fragment BIGLETTER: ('A' .. 'Z'); terminal fragment SIGNS: ('!' | '§'| '%' | '/' | '=' | '?' | '{' | '[' | ']' | '}'| '@' | PLUS | '*' | '#' | ',' | ';' | '.' | ':' | MINUS | '_' | '^' | '°'); terminal fragment DIGIT: ('0'..'9'); terminal SYMBOL: ('<' !('?') !('$?'))? (SMALLLETTER | BIGLETTER) (DIGIT | SMALLLETTER | BIGLETTER | SIGNS)*; terminal STRING: '"' ( '\\' /*('\b'|'\t'|'\n'|'\f'|'\r'|'|"'|'\\' |*/ !('\\'|'"') )* '"'; terminal UNSIGNEDINTEGER returns ecore::EInt: DIGIT+; terminal INTEGER: (PLUS | MINUS)? UNSIGNEDINTEGER; terminal FLOAT : INTEGER '.' UNSIGNEDINTEGER; Number: FLOAT | INTEGER; InstanceName: SYMBOL; Lexeme: SYMBOL | STRING; DeftemplateConstruct: '(deftemplate' name=SYMBOL (comment=Comment)? (slotdefinition+=Slotdefinition)* ')'; Comment: STRING; Slotdefinition: SingleSlotDefinition | MultiSlotDefinition; SingleSlotDefinition: singleSlotDefinition = '(slot' name=SYMBOL (templateattribute+=TemplateAttribute)* ')'; MultiSlotDefinition: multiSlotDefinition = '(multislot' name=SYMBOL (templateattribute+=TemplateAttribute)* ')'; TemplateAttribute: DefaultAttribute | ConstraintAttribute; DefaultAttribute:{DefaultAttribute} default=Default | defaultDynamic=DefaultDynamic; Default:{Default} '(default' ('?DERIVE' | nonde='?NONE' | (expresionn+=Expression)*) ')'; DefaultDynamic:{DefaultDynamic} '(default-dynamic' (expression+=Expression)* ')'; Expression:{Expression} Constant | Variable | FunctionCall; Constant: SYMBOL | STRING | INTEGER | FLOAT; // | InstanceName; Variable: singlefieldvariable+=SingleFieldVariable | multifieldvariable+=MultiFieldVariable | globalvariable+=GlobalVariable; SingleFieldVariable: '?' variablesymbol+=SYMBOL; MultiFieldVariable: '$?' variablesymbol+=SYMBOL; GlobalVariable: '?*' variablesymbol+=SYMBOL '*' ; FunctionCall: '(' name=SYMBOL expression+=(Expression)* ')'; ConstraintAttribute: (typeattribute+=TypeAttribute) | allowedconstantattribute+=AllowedConstantAttribute | cardinalityattribute+=CardinalityAttribute; // | rangeattribute+=RangeAttribute; TypeAttribute: '(type' TypeSpecification ')'; TypeSpecification: (allowedtype+=AllowedType)+ | variable=Variabletype; AllowedType: 'SYMBOL' | 'STRING' | 'LEXEME' | 'INTEGER' | 'FLOAT' | 'NUMBER' | 'INSTANCE-NAME' | 'INSTANCE-ADDRESS' | 'INSTANCE' | 'EXTERNAL-ADDRESS' | 'FACT-ADDRESS'; AllowedConstantAttribute: (allowedsymbols+=Allowedsymbols | allowedstrings+=Allowedstrings | allowedlexeme+=Allowedlexeme | allowedintegers+=Allowedintegers | allowedfloats+=Allowedfloats | allowednumbers+=Allowednumbers| allowedinstancenames+=Allowedinstancenames); Allowedsymbols:{Allowedsymbols} (SYMBOL | variable=Variabletype); Allowedstrings:{Allowedstrings} (STRING | variable=Variabletype); Allowedlexeme:{Allowedlexeme} (Lexeme | variable=Variabletype); Allowedintegers:{Allowedintegers} (INTEGER | variable=Variabletype); Allowedfloats:{Allowedfloats} (FLOAT | variable=Variabletype); Allowednumbers:{Allowednumbers} (Number | variable=Variabletype); Allowedinstancenames:{Allowedinstancenames} (InstanceName | variable=Variabletype); Variabletype: '?VARIABLE'; /*RangeAttribute: '(range' lowrange+=RangeSpezification hirange+=RangeSpezification ')'; RangeSpezification: (number+=Number)+ | variable='?VARIABLE'; */ CardinalityAttribute: '(cardinality' lowcardinality=CardinalitySpezification hicardinality=CardinalitySpezification ')'; CardinalitySpezification: interger=INTEGER | variable=Variabletype;