-
-
Notifications
You must be signed in to change notification settings - Fork 206
Expand file tree
/
Copy pathumple_core.grammar
More file actions
78 lines (60 loc) · 5.41 KB
/
Copy pathumple_core.grammar
File metadata and controls
78 lines (60 loc) · 5.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// The master source of this first part of the Umple grammar is available at
// [*https://github.com/umple/umple/blob/master/cruise.umple/src/umple_core.grammar *]
// The html rendering is generated from the master and appears in the Umple User manual
// at page [*https://umple.org/grammar*]
// Copyright: All contributors to the Umple Project
// This file is made available subject to the open source license found at:
// [*https://umple.org/license*]
// The core of umple is a "program". This is the grammar's 'start symbol'
// Comments and lone semicolons are ignored
program- : [[useProgram]] | [[umpleProgram]]
umpleProgram- : ( [[comment]] | [[directive]] | ; )*
// Directives are the top-level items in an umple file. See manual page [*TypesofDirectives*]
// A directive is either used to configure the system or else is
// an actual entity of the system to be modelled or generated
directive- : [[checkForUnintendedBracket]] | [[glossary]] | [[generate]] | [[suboption]] | [[distribute]] | [[generate_path]] | [[filter]] | [[useStatement]] | [[namespace]] | [[requirement]] | [[reqImplementation]] | [[tracerDirective]] | [[entity]] | [[debug]] | [[strictness]] | [[toplevelExtracode]] | [[toplevelException]]
// A glossary item is used to fine tune pluralization during code generation
glossary : glossary { [[word]]* }
word : [singular] : [plural] ;
distribute : distributable [=distributeTech:RMI|WS]? [=distributePattern:0|1|2|3]? [=distributeVal:on|off|forced] ;
// A high level of strictness will cause warnings to be issued when base language code
// is found, where it might not have been intended. Strictness can also be used
// To either suppress certain messages, or to declare that they should be present.
// NOTE: This is currently under development
strictness- : strictness ( [=strictness:modelOnly|noExtraCode|none] | [[strictnessMessage]] | [[strictnessDisableAuto]] ) ;
strictnessMessage : [=message:allow|ignore|expect|disallow] [messageNumber]
strictnessDisableAuto : disable [**expression]
// The generate clause can be used to generate multiple outputs
// The --override is used to say that subsequent generate statements will be ignored
generate : generate [=language:Java|Nothing|Php|RTCpp|SimpleCpp|Ruby|Python|Cpp|Json|FeatureModelJson|StructureDiagram|Yuml|Violet|Umlet|Simulate|TextUml|Scxml|GvStateDiagram|GvClassDiagram|GvFeatureDiagram|GvClassTraitDiagram|GvEntityRelationshipDiagram|Alloy|NuSMV|NuSMVOptimizer|Papyrus|Ecore|Xmi|Xtext|Sql|StateTables|EventSequence|InstanceDiagram|Umple|UmpleSelf|USE|Test|SimpleMetrics|PlainRequirementsDoc|Uigu2|ExternalGrammar|Mermaid] ( [=suboptionIndicator:-s|--suboption] " [**suboption] " )* ;
generate_path : generate [=language:Java|Nothing|Php|RTCpp|SimpleCpp|Ruby|Python|Cpp|Json|FeatureModelJson|StructureDiagram|Yuml|Violet|Umlet|Simulate|TextUml|Scxml|GvStateDiagram|GvClassDiagram|GvFeatureDiagram|GvClassTraitDiagram|GvEntityRelationshipDiagram|Alloy|NuSMV|NuSMVOptimizer|Papyrus|Ecore|Xmi|Xtext|Sql|StateTables|EventSequence|InstanceDiagram|Umple|UmpleSelf|USE|Test|SimpleMetrics|PlainRequirementsDoc|Uigu2|ExternalGrammar|Mermaid] " [**output] " [=override:--override|--override-all]? ( [=suboptionIndicator:-s|--suboption] " [**suboption] " )* ;
suboption : suboption "[**value] " ;
// Use statements allow incorporation of other Umple files. See [*UseStatements*]
useStatement : use [use] ( , [extraUse] )*
toplevelExtracode : top [top] [[moreCode]]
// Namespaces divide the code into logical groups. See [*NamespaceDirectives*]
namespace- : namespace [namespace] [[namespaceoption]]? ;
namespaceoption : [=option:--redefine]
// The main top level elements to be found in an Umple file
entity- : [[mixsetIsFeature]] | [[requireStatement]] | [[mixsetDefinition]] | [[classDefinition]] | [[traitDefinition]] | [[fixml]] | [[interfaceDefinition]] | [[externalDefinition]] | [[associationDefinition]] | [[associationClassDefinition]] | [[stateMachineDefinition]] | [[templateDefinition]] | [[enumerationDefinition]] | [[toplevelCodeInjection]]
// Comments follow the same conventions as C-family languages. [*UmpleComments*]
comment- : [[inlineComment]] | [[multilineComment]] | [[annotationComment]]
inlineComment- : // [*inlineComment]
multilineComment- : /* [**multilineComment] */
reqIdentifier : [name]
requirement : req [reqIdentifier] ( ( [[userStory]] ) | ( [[useCase]] ) | ( [[quality]] ) | ( [[plainReq]] ) )
quality- : [=reqLanguage:quality|Quality] { [**reqContent] }
plainReq- : [reqLanguage]? { [**reqContent] }
userStory- : [=reqLanguage:userStory|userstory] { ( [[userStoryTags]] | [**reqContent] ) }
userStoryTags- : ( who { [*whoContent] } )? ( when { [*whenContent] } )? ( what { [*whatContent] } )? ( why { [*whyContent] } )?
useCase- : [=reqLanguage:useCase|usecase] { ( [[useCaseTags]] | [**reqContent] ) }
useCaseTags- : ( [[userStoryTags]] | [[useCaseStep]] )*
useCaseStep- : ( userStep [useCaseId] { [*useCaseStepContent] } ) | ( systemResponse [useCaseId] { [*useCaseStepContent] } )
reqRef : [reqIdentifier] (OPEN_ROUND_BRACKET [qualityClassName] CLOSE_ROUND_BRACKET)?
reqImplementation : implementsReq [[reqRef]] (, [[reqRef]])* ;
//Matches all forms of Java annotations including those with parentheses and values in quotes
annotationComment- : [!annotationComment:@[a-zA-Z_][a-zA-Z0-9_-]*(\((("(\w|\s|-)*")|\w|\s|=|,|\.)*\))?]
// The Debug statement turns on debugging in code generation. For developer use only
debug- : [=debug] ;
// Instructs a class or method to be abstract
abstract- : [=abstract] ;