Umple User Manual
myGrammar
// The core of umple is a "program"
program- : ( [[comment]] | [[directive]] )*
// A directive is either configurations, or model elements
directive- : [[glossary]] | [[generate]] | [[generate_path]] | [[useStatement]] | [[namespace]] | [[traceType]] | [[entity]] | [[debug]]
glossary : glossary { [[word]]* }
word : [singular] : [plural] ;
generate- : generate [=generate:Java|Php|Ruby|Cpp|Json|Yuml|Violet|Umlet|Simulate|TextUml|Papyrus|Ecore|Xmi|SQL] ;
generate_path : generate [=language:Java|Php|Ruby|Cpp|Json|Yuml|Violet|Umlet|Simulate|TextUml|Papyrus|Ecore|Xmi|SQL] " [**output] " [=override:--override|--override-all]? ;
useStatement- : use [use] ;
namespace- : namespace [namespace] ;
entity- : [[classDefinition]] | [[interfaceDefinition]] | [[externalDefinition]] | [[associationDefinition]] | [[associationClassDefinition]] | [[stateMachineDefinition]]
comment- : [[inlineComment]] | [[multilineComment]]
inlineComment- : // [*inlineComment]
multilineComment- : /* [**multilineComment] */
debug- : [=debug] ;
abstract- : [=abstract] ;
classDefinition : class [name] { [[classContent]]* }
externalDefinition : external [name] { [[classContent]]* }
interfaceDefinition : interface [name] { [[depend]]* [[interfaceBody]] }
associationDefinition : association [name]? { [[association]]* }
associationClassDefinition : associationClass [name] { [[associationClassContent]]* }
classContent- : [[comment]] | [[classDefinition]] | [[trace]] | [[position]] | [[abstract]] | [[softwarePattern]] | [[depend]] | [[symmetricReflexiveAssociation]] | [[attribute]] | [[stateMachine]] | [[inlineAssociation]] | [[concreteMethodDeclaration]] | [[constantDeclaration]] | [[extraCode]]
associationClassContent- : [[comment]] | [[classDefinition]] | [[position]] | [[softwarePattern]] | [[depend]] | [[singleAssociationEnd]] [[singleAssociationEnd]] | [[stateMachine]] | [[attribute]] | [[inlineAssociation]] | [[extraCode]]
// Section for Members in Interfaces
// NOTE: We are considering type as simple String
// Interface Body: An interface can have CONSTANTS, ATTRIBUTES and METHODS
interfaceBody- : [[interfaceMemberDeclaration]]*
interfaceMemberDeclaration : [[constantDeclaration]] | [[abstractMethodDeclaration]] | [[position]] | [[isA]] | [[extraCode]]
// Constants in interfaces (e.g. constant String ACONSTANT="aValue";)
constantDeclaration : constant ([=list:[]] [name] | [type] [=list:[]] [name] | [type,name>1,0]) (= [**value]) ;
// Methods in classes and Interfaces
// Should we use modifier for concrete methods [=modifier:public|protected|private]?
// Should we use modifier for abstract methods [=modifier:public|protected|abstract|final]?
concreteMethodDeclaration : [type] [[methodDeclarator]] { [**code] }
abstractMethodDeclaration : [type] [[methodDeclarator]] ;
methodDeclarator : [methodName] [[parameterList]] | [methodName] -( -)
parameterList : -( [[parameter]] ( , [[parameter]] )* -)
parameter : ([=list:[]] [name] | [type] [=list:[]] [name] | [type,name>1,0])
association : [=modifier:immutable]? [[associationEnd]] [=arrow:--|->|<-|><] [[associationEnd]] ;
symmetricReflexiveAssociation : [[multiplicity]] self [roleName] ;
inlineAssociation : [=modifier:immutable]? [[inlineAssociationEnd]] [=arrow:--|->|<-|><] [[associationEnd]] ;
inlineAssociationEnd : [[multiplicity]] [roleName]?
singleAssociationEnd : [[multiplicity]] [type,roleName] ;
associationEnd : [[multiplicity]] [type,roleName]
multiplicity- : [=bound:*] | [lowerBound] .. [upperBound] | [bound]
attribute : [[simpleAttribute]] | [[autouniqueAttribute]] | [[derivedAttribute]] | [[complexAttribute]]
simpleAttribute- : [~name] ;
autouniqueAttribute- : [=autounique] [name] ;
derivedAttribute- : [=modifier:immutable|settable|internal|defaulted|const]? ([=list:[]] [name] | [type] [=list:[]] [name] | [type,name>1,0]) = { [**derivedValue] }
complexAttribute- : [=unique]? [=lazy]? [=modifier:immutable|settable|internal|defaulted|const]? ([=list:[]] [name] | [type] [=list:[]] [name] | [type,name>1,0]) (= [**value])? ;
defaultKey : key { }
key : key { [keyId] ( , [keyId] )* }
depend- : depend [depend] ;
extraCode- : [**extraCode]
softwarePattern- : [[isA]] | [[singleton]] | [[immutable]] | [[keyDefinition]] | [[codeInjection]]
isA- : [[singleIsA]] | [[multipleIsA]]
singleIsA- : isA [extendsName] ( , isA [extendsName] )* ;
multipleIsA- : isA [extendsName] ( , [extendsName] )* ;
singleton- : [=singleton] ;
immutable- : [=immutable] ;
keyDefinition- : [[defaultKey]] | [[key]]
codeInjection- : [[beforeCode]] | [[afterCode]]
beforeCode : before [operationName] { [**code] }
afterCode : after [operationName] { [**code] }
stateMachineDefinition : statemachine [name] { [[state]]* }
stateMachine : [[enum]] | [[inlineStateMachine]] | [[referencedStateMachine]]
inlineStateMachine : [name] { ( [[comment]] | [[state]] )* }
referencedStateMachine : [name] as [definitionName] ; | [name] as [definitionName] { [[extendedStateMachine]] }
extendedStateMachine : ( [[comment]] | [=changeType:+|-|*]? [[state]] )*
enum : [name] { } | [name] { [stateName] (, [stateName])* }
state : [stateName] { ( [[stateInternal]] )* } | [=final] [stateName] { ( [[stateInternal]] )* }
stateInternal- : [[comment]] | [=changeType:+|-|*]? [[stateEntity]]
stateEntity- : [=-||] | [[transition]] | [[entryOrExitAction]] | [[activity]] | [[state]]
transition : [[guard]] [[eventDefinition]] -> [[action]]? [stateName] ; | [[eventDefinition]] [[action]] -> [stateName] ; | [[eventDefinition]] [[guard]]? -> [[action]]? [stateName] ; | [[eventDefinition]] [[guard]]? [[action]]? -> [stateName] ;
| [[activity]] -> [stateName]
eventDefinition- : [[afterEveryEvent]] | [[afterEvent]] | [~event]
afterEveryEvent- : afterEvery -( [timer] -)
afterEvent- : after -( [timer] -)
action : / { [**actionCode] }
entryOrExitAction : [=type:entry|exit] / { [**actionCode] }
activity : do { [**activityCode] }
guard : [ [**guardCode] ]
traceType- : tracer [traceType] ;
trace : [[traceDirective]] | [[traceCase]]
traceDirective- : trace [[traceItem]] [[executeClause]]? [[traceWhere]]? [[traceUntil]]? [[traceAfter]]? [[traceGiving]]? [[traceFor]]? [[tracePeriod]]? [[traceDuring]]? [[traceCaseActivation]]? [[traceRecord]]? ;
traceItem- : [[traceEntity]] | [[PreOrPostCondition]]
traceEntity- : ( set,get | set | get | entry | exit | cardinality )? [trace_entity] ( , [trace_entity] )*
PreOrPostCondition- : (giving | where)? [[traceCondition]]
executeClause- : execute { [**trace_execute] }
traceWhere : where [[traceCondition]]
traceUntil : until [[traceCondition]]
traceAfter : after [[traceCondition]]
traceGiving : giving [[traceCondition]]
traceFor- : for [trace_for]
tracePeriod- : period [trace_period]
traceDuring- : during [trace_duration]
traceRecord- : record [[recordEntity]]
recordEntity- : ( only )? [**trace_record] ( , [**trace_record] )*
traceCondition- : [LHS] [[conditionRHS]]
conditionRHS- : [comparison_operator] [RHS]
traceCase- : [[traceCaseDef]] | [[traceCaseActivation]] | [[traceCaseDeactivation]]
traceCaseDef- : tracecase [tracecase_name] { [[traceDirective]]* }
traceCaseActivation- : activate [tracecase_act_name] (onAllObjects | onThisThreadOnly)? ;
traceCaseDeactivation- : deactivate [tracecase_deact_name] onThisObject [[deActivateFor]]? ;
deActivateFor- : for [deactivate_for]
position- : [[associationPosition]] | [[elementPosition]]
elementPosition : position [x] [y] [width] [height] ;
associationPosition : position.association [name] [[coordinate]] [[coordinate]] ;
coordinate : [x] , [y]
|