-
Notifications
You must be signed in to change notification settings - Fork 0
/
plant_uml_grammar.tx
125 lines (104 loc) · 1.72 KB
/
plant_uml_grammar.tx
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Plant:
'@startuml' (classes+=Class | packages+=Package | enums+=Enum |relations+=Relation)* '@enduml'
;
Relation:
(Heritage|Composition)
;
Composition:
contenant=[Class] ('*--'|(range_contenant=Range '*--')) (range_contenu=Range)? contenu=[Class] (':'label=ID)?
|
contenu=[Class] (range_contenu=Range)? '--*' (range_contenant=Range)? contenant=[Class] (':'label=ID)?
;
Heritage:
contenant=[Class] (range_contenant=Range)? '<--' (range_contenu=Range)? contenu=[Class] (':'label=ID)?
|
contenu=[Class] (range_contenu=Range)? '-->' (range_contenant=Range)? contenant=[Class] (':'label=ID)?
;
Range:
((Int|'*')'..'(Int|'*'))|Int|'*'
;
Int:
/[0-9]*/
;
Class:
type=Class_type
name = ID
(
'{'
attributes*= Attribute
'}'
)?
;
Enum:
'enum'
name = ID
(
'{'
labels*= ID
'}'
)?
;
Attribute:
Method|Value
;
Class_type:
'class' | 'abstract class' | 'interface'
;
Value:
ValueWithType|ValueWithoutType
;
ValueWithType:
(visibility=Visibility)?
(access=Access)?
type=ID
name=ID
;
ValueWithoutType:
(visibility=Visibility)?
(access=Access)?
name=ID
;
Parameter:
type=ID name=ID | name=ID
;
Method:
MethodWithType|MethodWithoutType
;
MethodWithType:
(visibility=Visibility)?
(access=Access)?
type=ID
name=ID
'('
(params+=Parameter[','])?
')'
;
MethodWithoutType:
(visibility=Visibility)?
(access=Access)?
name=ID
'('
(params+=Parameter[','])?
')'
;
Visibility:
'+' | '-'
;
Access:
'{' ('static' | 'abstract') '}'
;
Package:
'package'
path*=ID['.']
(
'{'
(
( classes+=Class )
|
( packages+=Package )
|
( enums+=Enum )
)*
'}'
)?
;