-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.ebnf
74 lines (52 loc) · 2.63 KB
/
class.ebnf
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
/* Иструмент: https://bnfplayground.pauliankline.com/ */
/* Общие */
/* ----------------------------------------------------------------------- */
/* элементарные (или встроенные) конструкции */
<whs> ::= " "
<nln> ::= "\n"
/* допустимые значения для типа char, не только: */
<any_char> ::= ([A-Z] | [a-z] | [0-9] | "_")+
/* допустимые для идентификатора значения PlantUML: */
<ids_char> ::= ([A-Z] | [a-z] | [0-9] | "_")+
/* --- */
<string> ::= <any_char>+
<node_id> ::= <ids_char>+
<optwhs> ::= <whs>*
<reqwhs> ::= <whs>+
<end_curly_brace> ::= "}"
/* Class */
/* ----------------------------------------------------------------------- */
/* стрелка */
<left_arrow_head> ::= "<" | "<|" | "*" | "o"
<rght_arrow_head> ::= ">" | "|>" | "*" | "o"
<arrow_direction> ::= ("l" | "r" | "d" | "u") | ("left" | "right" | "down" | "up")
<arrow_body> ::= ("." | "-")+ <arrow_direction> ("." | "-")+
<arrow> ::= <left_arrow_head>? <arrow_body> <rght_arrow_head>?
/* составные конструкции (не используются напрямую) */
<node> ::= <node_id>
<member_mark> ::= "+" | "#" | "-"
/* составные конструкции (то из чего состоит диаграмма/то что вводит пользователь) */
<enduml> ::= "@enduml"
<startuml> ::= "@startuml"
<directive> ::= <startuml> | <enduml>
/* --- */
<beg_interface> ::= "interface" <reqwhs> <node_id> "{"
<interface_member_func> ::= "+"? <ids_char>+ "(" (<ids_char>+ ",")+ ")"
<interface_body> ::= (<interface_member_func> <nln>)+
<interface> ::= <beg_interface> <nln> <interface_body> <end_curly_brace>
<beg_class> ::= "class" <reqwhs> <node_id> "{"
<class_member_data> ::= <member_mark> <ids_char>+ ":" <ids_char>+
<class_member_func> ::= <member_mark> <ids_char>+ "(" (<ids_char>+ ",")+ ")" <reqwhs> ":" <ids_char>+
<class_member> ::= <class_member_data> | <class_member_func>
<class_body> ::= (<class_member> <nln>)+
<class> ::= <beg_class> <nln> <class_body> <end_curly_brace>
<beg_enum> ::= "enum" <reqwhs> <node_id> "{"
<enum_value> ::= <ids_char>+
<enum_body> ::= (<enum_value> <nln>)+
<enum> ::= <beg_enum> <nln> (<enum_value> <nln>)+ <end_curly_brace>
<short_node> ::= ("class" | "enum" | "interface") <reqwhs> <node_id>
<whole_node> ::= <class> | <enum> | <interface>
/* --- */
<connection> ::= <node> <reqwhs> <arrow> <reqwhs> <node>
/* --- */
<diagram> ::= <startuml> <nln> ((<whole_node> | <short_node> | <connection>) <nln>)* <enduml>