@formicoidea/labre-framework-uml 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +384 -0
- package/dist/actions.d.ts +430 -0
- package/dist/actions.js +724 -0
- package/dist/background.d.ts +153 -0
- package/dist/background.js +557 -0
- package/dist/board-hit.d.ts +137 -0
- package/dist/board-hit.js +191 -0
- package/dist/commands-manifest.d.ts +19 -0
- package/dist/commands-manifest.js +571 -0
- package/dist/commands.d.ts +4 -0
- package/dist/commands.js +983 -0
- package/dist/component.d.ts +521 -0
- package/dist/component.js +708 -0
- package/dist/consts.d.ts +365 -0
- package/dist/consts.js +463 -0
- package/dist/descriptor.d.ts +12 -0
- package/dist/descriptor.js +10 -0
- package/dist/drawio-decode.d.ts +32 -0
- package/dist/drawio-decode.js +96 -0
- package/dist/drawio-import.d.ts +133 -0
- package/dist/drawio-import.js +885 -0
- package/dist/edge-morph.d.ts +154 -0
- package/dist/edge-morph.js +153 -0
- package/dist/edge-styles.d.ts +78 -0
- package/dist/edge-styles.js +210 -0
- package/dist/effects.d.ts +9 -0
- package/dist/effects.js +6 -0
- package/dist/element-renderer.d.ts +64 -0
- package/dist/element-renderer.js +114 -0
- package/dist/element-view.d.ts +234 -0
- package/dist/element-view.js +430 -0
- package/dist/export.d.ts +61 -0
- package/dist/export.js +41 -0
- package/dist/filename.d.ts +17 -0
- package/dist/filename.js +26 -0
- package/dist/frame-tag.d.ts +70 -0
- package/dist/frame-tag.js +78 -0
- package/dist/grammar.d.ts +695 -0
- package/dist/grammar.js +1436 -0
- package/dist/import.d.ts +306 -0
- package/dist/import.js +1270 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +67 -0
- package/dist/interchange.d.ts +125 -0
- package/dist/interchange.js +372 -0
- package/dist/keywords.d.ts +204 -0
- package/dist/keywords.js +361 -0
- package/dist/kinds.d.ts +73 -0
- package/dist/kinds.js +91 -0
- package/dist/legend.d.ts +30 -0
- package/dist/legend.js +255 -0
- package/dist/model.d.ts +862 -0
- package/dist/model.js +1316 -0
- package/dist/morph.d.ts +178 -0
- package/dist/morph.js +496 -0
- package/dist/node/act-glyphs.d.ts +30 -0
- package/dist/node/act-glyphs.js +142 -0
- package/dist/node/compartment-watcher.d.ts +107 -0
- package/dist/node/compartment-watcher.js +163 -0
- package/dist/node/fit.d.ts +85 -0
- package/dist/node/fit.js +129 -0
- package/dist/node/node-renderer.d.ts +49 -0
- package/dist/node/node-renderer.js +611 -0
- package/dist/node/node-view.d.ts +51 -0
- package/dist/node/node-view.js +89 -0
- package/dist/node/paint.d.ts +84 -0
- package/dist/node/paint.js +143 -0
- package/dist/node/sd-glyphs.d.ts +36 -0
- package/dist/node/sd-glyphs.js +79 -0
- package/dist/node/stm-glyphs.d.ts +22 -0
- package/dist/node/stm-glyphs.js +111 -0
- package/dist/node/tier-metrics.d.ts +38 -0
- package/dist/node/tier-metrics.js +45 -0
- package/dist/operators.d.ts +45 -0
- package/dist/operators.js +75 -0
- package/dist/plantuml-import.d.ts +113 -0
- package/dist/plantuml-import.js +1723 -0
- package/dist/plantuml.d.ts +94 -0
- package/dist/plantuml.js +985 -0
- package/dist/presets.d.ts +149 -0
- package/dist/presets.js +302 -0
- package/dist/profiles.d.ts +2 -0
- package/dist/profiles.js +358 -0
- package/dist/reading.d.ts +160 -0
- package/dist/reading.js +648 -0
- package/dist/roles.d.ts +257 -0
- package/dist/roles.js +997 -0
- package/dist/rules.d.ts +267 -0
- package/dist/rules.js +3090 -0
- package/dist/templates.d.ts +2 -0
- package/dist/templates.js +197 -0
- package/dist/toolbar/config.d.ts +228 -0
- package/dist/toolbar/config.js +833 -0
- package/dist/toolbar/icons.d.ts +440 -0
- package/dist/toolbar/icons.js +711 -0
- package/dist/toolbar/senior-tool.d.ts +11 -0
- package/dist/toolbar/senior-tool.js +21 -0
- package/dist/toolbar/uml-menu.d.ts +17 -0
- package/dist/toolbar/uml-menu.js +20 -0
- package/dist/toolbar/uml-senior-button.d.ts +18 -0
- package/dist/toolbar/uml-senior-button.js +22 -0
- package/dist/translations.d.ts +27 -0
- package/dist/translations.js +117 -0
- package/dist/view.d.ts +33 -0
- package/dist/view.js +236 -0
- package/dist/xmi-import.d.ts +174 -0
- package/dist/xmi-import.js +2268 -0
- package/dist/xmi.d.ts +61 -0
- package/dist/xmi.js +1860 -0
- package/dist/xml-reader.d.ts +157 -0
- package/dist/xml-reader.js +430 -0
- package/dist/xml.d.ts +72 -0
- package/dist/xml.js +96 -0
- package/package.json +38 -0
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The UML member grammar, as pure parsers.
|
|
3
|
+
*
|
|
4
|
+
* ## What these read
|
|
5
|
+
*
|
|
6
|
+
* Nine BNFs, transcribed from UML 2.5.1 and cited where they are used. The
|
|
7
|
+
* first three are phase 1's, and they are the STRUCTURAL half — what a
|
|
8
|
+
* compartment of a classifier says. Three more arrived with the behaviour sheets
|
|
9
|
+
* and are the same discipline applied to a LINE rather than to a box: what a
|
|
10
|
+
* transition, an activity edge and a state's internal compartment say. The
|
|
11
|
+
* seventh is what is written beside ONE END of a line. The last two are the
|
|
12
|
+
* sequence sheet's, and they are the same discipline applied to an INTERACTION:
|
|
13
|
+
* what a lifeline's head says and what an arrow between two of them says.
|
|
14
|
+
*
|
|
15
|
+
* - **§9.5.4** (printed p. 113) — a Property:
|
|
16
|
+
* `[<visibility>] [`/`] <name> [`:` <prop-type>] [`[` <multiplicity-range> `]`]
|
|
17
|
+
* [`=` <default>] [`{` <prop-modifier> [`,` <prop-modifier>]* `}`]`
|
|
18
|
+
* - **§9.6.4** (p. 117) — an Operation:
|
|
19
|
+
* `[<visibility>] <name> `(` [<parameter-list>] `)` [`:` [<return-type>]
|
|
20
|
+
* [`[` <multiplicity-range> `]`] [`{` <oper-property>* `}`]]`, with
|
|
21
|
+
* `<parameter>` from §9.4.4 (p. 110):
|
|
22
|
+
* `[<direction>] <parameter-name> `:` <type-expression>
|
|
23
|
+
* [`[`<multiplicity-range>`]`] [`=` <default>]`
|
|
24
|
+
* - **§7.5.4** (p. 34) — a multiplicity range: `[ <lower> `..` ] <upper>`
|
|
25
|
+
* - **§11.5.4** (p. 201) — what may be written beside an Association end: a
|
|
26
|
+
* name string, a multiplicity, a `<prop-modifier>` in braces, a
|
|
27
|
+
* `<visibility>` symbol
|
|
28
|
+
* - **§14.2.4.8** (p. 331) — a Transition label:
|
|
29
|
+
* `[<trigger> [`,` <trigger>]*] [`[` <guard> `]`] [`/` <behavior-expression>]`,
|
|
30
|
+
* with `<trigger>` from §13.3.4 (p. 293): a call or signal event's name, a
|
|
31
|
+
* `when` change event, an `after` / `at` time event, or the bare `all`
|
|
32
|
+
* - **§15.2.4** (p. 379) — an ActivityEdge's annotations: a name near the
|
|
33
|
+
* arrow, a guard "as text in square brackets near tail of the line", and
|
|
34
|
+
* `weight-annotation ::= `{` `weight` `=` <value-specification> `}``
|
|
35
|
+
* - **§14.2.4.4** (p. 320) — a State's internal activities:
|
|
36
|
+
* `<behavior-type-label> [`/` <behavior-expression>]`, the label being one of
|
|
37
|
+
* `entry`, `do` and `exit`
|
|
38
|
+
* - **§17.3.4** (p. 572) — a Lifeline head:
|
|
39
|
+
* `[<connectable-element-name> [`[` <selector> `]`]] [`:`
|
|
40
|
+
* <connectable-element-type>] [<decomposition>]`, or the bare `self`
|
|
41
|
+
* - **§17.4.4** (p. 576) — a Message label, request and reply together:
|
|
42
|
+
* `[<assignment-target> `=`] <message-name> [`(` [<argument-list>] `)`]
|
|
43
|
+
* [`:` <value-specification>]`, or the bare `*`
|
|
44
|
+
*
|
|
45
|
+
* ## Why they never throw
|
|
46
|
+
*
|
|
47
|
+
* A compartment is FREE TEXT an architect types while thinking. Half of it is a
|
|
48
|
+
* half-finished line at any moment, and a parser that threw would turn a
|
|
49
|
+
* keystroke into a broken export. So every entry point degrades: a line the
|
|
50
|
+
* grammar does not recognise comes back as `{ name: <the line> }` and travels
|
|
51
|
+
* through the exporters as an element named exactly what the author wrote. The
|
|
52
|
+
* picture keeps saying what it said; the file says the same thing, less
|
|
53
|
+
* structured.
|
|
54
|
+
*
|
|
55
|
+
* ## Purity
|
|
56
|
+
*
|
|
57
|
+
* Strings in, plain records out. No `std`, no DOM, no clock, no randomness — the
|
|
58
|
+
* same discipline `c4/export.ts` and `bpmn/export.ts` hold, and for the same
|
|
59
|
+
* reason: a host can call these, a test can call them with literals, and the
|
|
60
|
+
* same compartment always parses to the same record.
|
|
61
|
+
*/
|
|
62
|
+
/** The four VisibilityKind values UML's `<visibility>` terminal can spell. */
|
|
63
|
+
export type UmlVisibility = 'public' | 'private' | 'protected' | 'package';
|
|
64
|
+
/**
|
|
65
|
+
* A visibility marker as its VisibilityKind — `undefined` for anything else.
|
|
66
|
+
*
|
|
67
|
+
* `~` is `package` and not "default": §7.4 gives all four a glyph, and an
|
|
68
|
+
* omitted marker means the author has not said, which is a different statement
|
|
69
|
+
* from package visibility and is why the callers leave the field absent.
|
|
70
|
+
*/
|
|
71
|
+
export declare function visibilityOf(marker: string): UmlVisibility | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* A multiplicity range — `0..*` as `{ lower: 0, upper: '*' }`.
|
|
74
|
+
*
|
|
75
|
+
* `upper` is `number | '*'` rather than a number with `Infinity` or `-1` as a
|
|
76
|
+
* sentinel, because `*` is what the file has to say: XMI writes it as the
|
|
77
|
+
* `value` of a `LiteralUnlimitedNatural`, and PlantUML prints it. A sentinel
|
|
78
|
+
* would have to be translated back at both ends and is one convention away from
|
|
79
|
+
* a `-1` reaching a document.
|
|
80
|
+
*/
|
|
81
|
+
export interface UmlMultiplicity {
|
|
82
|
+
lower: number;
|
|
83
|
+
upper: number | '*';
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A multiplicity range, brackets optional — `undefined` when it is not one.
|
|
87
|
+
*
|
|
88
|
+
* §7.5.4's `[ <lower> '..' ] <upper>`, plus the two readings the clause states
|
|
89
|
+
* around it:
|
|
90
|
+
*
|
|
91
|
+
* - a bare `<upper>` means `lower = upper` — `1` is exactly one;
|
|
92
|
+
* - `*` is the unlimited upper bound, and a bare `*` is §7.5.4's shorthand for
|
|
93
|
+
* `0..*` (the clause's own "0..* … may be abbreviated to *").
|
|
94
|
+
*
|
|
95
|
+
* The brackets are stripped rather than required, because the SAME range is
|
|
96
|
+
* written both ways depending on where it sits: `[0..1]` inside a property line
|
|
97
|
+
* (§9.5.4 puts it in brackets) and `0..1` beside an association end (§11.5.4
|
|
98
|
+
* does not). One parser, both call sites.
|
|
99
|
+
*
|
|
100
|
+
* `<lower>` and `<upper>` are ValueSpecifications in the metamodel, so `n..m`
|
|
101
|
+
* with symbolic bounds is legal UML. It parses to `undefined` here on purpose:
|
|
102
|
+
* this module's callers write bounds into files as integers, and a made-up
|
|
103
|
+
* integer for `n` would be a fact the author never stated. A symbolic range
|
|
104
|
+
* survives instead as part of the line's own text.
|
|
105
|
+
*/
|
|
106
|
+
export declare function parseMultiplicity(raw: string): UmlMultiplicity | undefined;
|
|
107
|
+
/** One line of an attribute compartment, as the grammar reads it. */
|
|
108
|
+
export interface UmlProperty {
|
|
109
|
+
/** Absent when the author wrote no marker — see {@link visibilityOf}. */
|
|
110
|
+
visibility?: UmlVisibility;
|
|
111
|
+
/** The `/` of §9.5.4: this Property is derived. */
|
|
112
|
+
isDerived: boolean;
|
|
113
|
+
name: string;
|
|
114
|
+
/** `<prop-type>` — the name of a Classifier, resolved by the exporters. */
|
|
115
|
+
type?: string;
|
|
116
|
+
multiplicity?: UmlMultiplicity;
|
|
117
|
+
/** `<default>`, verbatim: it is an expression, and we do not evaluate it. */
|
|
118
|
+
defaultValue?: string;
|
|
119
|
+
/** `<prop-modifier>`s, in order, each trimmed and otherwise verbatim. */
|
|
120
|
+
modifiers: string[];
|
|
121
|
+
/**
|
|
122
|
+
* `true` only when `{static}` was written.
|
|
123
|
+
*
|
|
124
|
+
* A static feature is UNDERLINED in UML (§9.2.4), and an underline is not a
|
|
125
|
+
* character: nothing in a plain-text compartment can carry it, so it cannot be
|
|
126
|
+
* detected here. `{static}` is the spelling that survives a text round-trip,
|
|
127
|
+
* and the field is absent rather than `false` when nothing said so — "not
|
|
128
|
+
* stated" and "stated not static" are different, and only one of them is in
|
|
129
|
+
* the line.
|
|
130
|
+
*/
|
|
131
|
+
isStatic?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* One attribute line, per §9.5.4.
|
|
135
|
+
*
|
|
136
|
+
* Parsed from the RIGHT, which is what makes the optional parts optional: the
|
|
137
|
+
* modifier group, then the default, then the multiplicity, then the type — each
|
|
138
|
+
* peeled off the tail it is the last thing on. Parsing left to right would have
|
|
139
|
+
* to guess where the name ends, and a name with a space in it (`order date`) is
|
|
140
|
+
* legal UML.
|
|
141
|
+
*
|
|
142
|
+
* `=` is split on its FIRST occurrence, because §9.5.4 puts the default last of
|
|
143
|
+
* the three and an expression may contain `==`. A `:` inside a default —
|
|
144
|
+
* `= {a: 1}` — therefore survives, since the type split happens on what is left
|
|
145
|
+
* after the default is gone.
|
|
146
|
+
*
|
|
147
|
+
* A line the grammar cannot see structure in keeps all of itself:
|
|
148
|
+
* `parseProperty('???')` is a property NAMED `???`. That is the degradation
|
|
149
|
+
* contract at the top of this file, and it is what lets a compartment be typed
|
|
150
|
+
* into rather than filled in.
|
|
151
|
+
*/
|
|
152
|
+
export declare function parseProperty(line: string): UmlProperty;
|
|
153
|
+
/** `<direction>` — §9.4.4's three, plus the one XMI writes for a result. */
|
|
154
|
+
export type UmlParameterDirection = 'in' | 'out' | 'inout' | 'return';
|
|
155
|
+
/** One entry of a `<parameter-list>`. */
|
|
156
|
+
export interface UmlParameter {
|
|
157
|
+
/**
|
|
158
|
+
* Absent when the author wrote none. §9.4.4 says an omitted direction
|
|
159
|
+
* "defaults to `in`", and the DEFAULT is applied by the writer that needs one
|
|
160
|
+
* rather than invented here: the parsers report what the line says.
|
|
161
|
+
*/
|
|
162
|
+
direction?: UmlParameterDirection;
|
|
163
|
+
name: string;
|
|
164
|
+
type?: string;
|
|
165
|
+
multiplicity?: UmlMultiplicity;
|
|
166
|
+
defaultValue?: string;
|
|
167
|
+
}
|
|
168
|
+
/** One line of an operation compartment, as the grammar reads it. */
|
|
169
|
+
export interface UmlOperation {
|
|
170
|
+
visibility?: UmlVisibility;
|
|
171
|
+
name: string;
|
|
172
|
+
parameters: UmlParameter[];
|
|
173
|
+
returnType?: string;
|
|
174
|
+
returnMultiplicity?: UmlMultiplicity;
|
|
175
|
+
/** `<oper-property>`s — `query`, `redefines x`, `ordered`, a constraint. */
|
|
176
|
+
modifiers: string[];
|
|
177
|
+
/** See {@link UmlProperty.isStatic}: `{static}`, never an underline. */
|
|
178
|
+
isStatic?: boolean;
|
|
179
|
+
/** `{abstract}` — §9.2.4's text alternative to an italic name. */
|
|
180
|
+
isAbstract?: boolean;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* One operation line, per §9.6.4.
|
|
184
|
+
*
|
|
185
|
+
* The parentheses are the anchor: everything before the `(` is the visibility
|
|
186
|
+
* and the name, everything inside is the `<parameter-list>`, and everything
|
|
187
|
+
* after is the optional return part and the `<oper-property>` group. A line with
|
|
188
|
+
* no parentheses is not an operation the grammar can see — it degrades to a
|
|
189
|
+
* NAME, exactly as a property does, and an author halfway through typing
|
|
190
|
+
* `place` keeps their word.
|
|
191
|
+
*
|
|
192
|
+
* `{abstract}` is reported separately from `modifiers` (which keeps it too),
|
|
193
|
+
* because §9.2.4's marker decides a metamodel FLAG — `isAbstract` on the
|
|
194
|
+
* Operation — where the rest of the group is notation a writer passes through.
|
|
195
|
+
*/
|
|
196
|
+
export declare function parseOperation(line: string): UmlOperation;
|
|
197
|
+
/**
|
|
198
|
+
* The lines of a compartment that SAY something — trimmed, in order.
|
|
199
|
+
*
|
|
200
|
+
* Two kinds of line are dropped and both are notation rather than content:
|
|
201
|
+
*
|
|
202
|
+
* - a blank line, which is spacing;
|
|
203
|
+
* - an ellipsis — `...` or `…` — which is §9.2.4's ELISION marker. It means
|
|
204
|
+
* "there are more features, not shown", and a file that wrote it back as a
|
|
205
|
+
* property named `...` would turn "some are hidden" into "one is called dot
|
|
206
|
+
* dot dot".
|
|
207
|
+
*/
|
|
208
|
+
export declare function parseCompartment(text: string | undefined | null): string[];
|
|
209
|
+
/**
|
|
210
|
+
* What is written BESIDE one end of an association line.
|
|
211
|
+
*
|
|
212
|
+
* §11.5.4 (printed p. 201) names exactly what may sit there: "A name string may
|
|
213
|
+
* be placed near the end of the line to show the name of the Association end",
|
|
214
|
+
* and "various other notations can be placed near the end of the line as
|
|
215
|
+
* follows: a multiplicity … a `<prop-modifier>` enclosed in curly braces … a
|
|
216
|
+
* `<visibility>` symbol".
|
|
217
|
+
*
|
|
218
|
+
* Three of the four are read; the modifier group is not, and that is the same
|
|
219
|
+
* call {@link parseActivityEdge} makes about `{stream}` — it is notation this
|
|
220
|
+
* pack does not model, and folding it into the role would rename the end. It
|
|
221
|
+
* survives in {@link raw}, which is why {@link raw} is not optional: whatever
|
|
222
|
+
* the author typed is kept verbatim, so a label the grammar reads as nothing at
|
|
223
|
+
* all is still the author's words on the board and in the file.
|
|
224
|
+
*/
|
|
225
|
+
export interface UmlAssociationEnd {
|
|
226
|
+
/** §7.5.4's range, brackets optional — `0..*`, `1`, `[0..1]`. */
|
|
227
|
+
multiplicity?: UmlMultiplicity;
|
|
228
|
+
/** The end's NAME — the Property the far classifier sees (§11.5.4). */
|
|
229
|
+
role?: string;
|
|
230
|
+
/** Absent when the author wrote no marker — see {@link visibilityOf}. */
|
|
231
|
+
visibility?: UmlVisibility;
|
|
232
|
+
/** Exactly what was written beside the end, trimmed. Never absent. */
|
|
233
|
+
raw: string;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* `0..* items` → a multiplicity and a role; `- owner` → a private role.
|
|
237
|
+
*
|
|
238
|
+
* MULTIPLICITY FIRST, and only from the leading token: §11.5.4 places both a
|
|
239
|
+
* name and a range beside the end with no separator between them, so something
|
|
240
|
+
* has to decide which half is which, and the leading token is the half that can
|
|
241
|
+
* be decided WITHOUT guessing — `0..*`, `1`, `*` and `[0..1]` are a closed
|
|
242
|
+
* grammar (§7.5.4), and a word is not. A leading token that does not parse as a
|
|
243
|
+
* range therefore stays part of the name, which is what keeps `1st choice` an
|
|
244
|
+
* end called "1st choice" rather than a multiplicity of one.
|
|
245
|
+
*
|
|
246
|
+
* The visibility marker is read on either side of the range — `- owner` and
|
|
247
|
+
* `+ 0..1 a` both — because §11.5.4 lists the three adornments without fixing an
|
|
248
|
+
* order between them, and an author who writes the marker first is writing the
|
|
249
|
+
* order §9.5.4 uses for a property.
|
|
250
|
+
*
|
|
251
|
+
* Never throws and never returns nothing: an end label is free text an architect
|
|
252
|
+
* typed beside a line, and the same degradation the rest of this module holds to
|
|
253
|
+
* applies — a label the grammar recognises nothing in comes back as `{ raw }`
|
|
254
|
+
* plus a role that is the whole of it.
|
|
255
|
+
*/
|
|
256
|
+
export declare function parseEndLabel(label: string | undefined | null): UmlAssociationEnd;
|
|
257
|
+
/** The glyph §7.4 gives a VisibilityKind — the inverse of {@link visibilityOf}. */
|
|
258
|
+
export declare function visibilityMarker(visibility: UmlVisibility): string;
|
|
259
|
+
/**
|
|
260
|
+
* §7.5.4's range, spelled the way a diagram spells it — `1`, `0..1`, `0..*`.
|
|
261
|
+
*
|
|
262
|
+
* Only ONE of the clause's two abbreviations is used: an exact range is written
|
|
263
|
+
* as the single bound (`1..1` is `1`, which is how every diagram in the
|
|
264
|
+
* specification writes it), and an unbounded one is written in full (`0..*`
|
|
265
|
+
* rather than the bare `*` §7.5.4 also permits). The asymmetry is deliberate —
|
|
266
|
+
* `*` is the spelling that reads as "unfinished" beside a line, and the full
|
|
267
|
+
* form is what PlantUML, Papyrus and draw.io all print. Both parse back to the
|
|
268
|
+
* same record, so nothing is lost either way; this is the one that is read.
|
|
269
|
+
*/
|
|
270
|
+
export declare function formatMultiplicity(multiplicity: UmlMultiplicity): string;
|
|
271
|
+
/**
|
|
272
|
+
* An end's adornments, back in one string — `0..* -items`.
|
|
273
|
+
*
|
|
274
|
+
* The inverse of {@link parseEndLabel}, in §11.5.4's own order: the range, then
|
|
275
|
+
* the visibility glyph, then the name. An end the grammar read nothing
|
|
276
|
+
* structural out of prints its {@link UmlAssociationEnd.raw} instead, so a label
|
|
277
|
+
* this module does not understand still comes back exactly as it was typed —
|
|
278
|
+
* the whole point of keeping `raw`.
|
|
279
|
+
*/
|
|
280
|
+
export declare function formatEndLabel(end: UmlAssociationEnd): string;
|
|
281
|
+
/**
|
|
282
|
+
* WHICH of §13.3.4's five notations a trigger is written in.
|
|
283
|
+
*
|
|
284
|
+
* `call-or-signal` is one value for two metaclasses, and the specification is
|
|
285
|
+
* the reason: "SignalEvent triggers and CallEvent triggers are not
|
|
286
|
+
* distinguishable by syntax and must be discriminated by their declaration
|
|
287
|
+
* elsewhere" (§14.2.4.8). A canvas holds no such declaration, so a parser that
|
|
288
|
+
* returned one of the two would be inventing the half of the fact the notation
|
|
289
|
+
* does not carry. The XMI writer therefore mints the one metaclass that is true
|
|
290
|
+
* of both readings, and the drawing keeps what the author typed.
|
|
291
|
+
*/
|
|
292
|
+
export type UmlTriggerKind = 'call-or-signal' | 'any-receive' | 'change' | 'relative-time' | 'absolute-time';
|
|
293
|
+
/** One `<trigger>` of §13.3.4, classified and kept whole. */
|
|
294
|
+
export interface UmlTrigger {
|
|
295
|
+
kind: UmlTriggerKind;
|
|
296
|
+
/** The trigger as the author wrote it, trimmed — what a writer prints back. */
|
|
297
|
+
text: string;
|
|
298
|
+
/**
|
|
299
|
+
* What follows the KEYWORD: `5 seconds` after an `after`, `Jan 1` after an
|
|
300
|
+
* `at`, `stock = 0` after a `when`. Absent for `all`, which has no argument,
|
|
301
|
+
* and for a call or signal event, whose payload is {@link UmlTrigger.name}.
|
|
302
|
+
*/
|
|
303
|
+
expression?: string;
|
|
304
|
+
/** The Operation's or the Signal's name — a call or signal event only. */
|
|
305
|
+
name?: string;
|
|
306
|
+
/** `(a, b)`'s contents, verbatim — §13.3.4's `<assignment-specification>`. */
|
|
307
|
+
assignment?: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* One trigger, classified per §13.3.4.
|
|
311
|
+
*
|
|
312
|
+
* Total and never throwing, exactly like every parser above it: a word the
|
|
313
|
+
* clause has no notation for is a `call-or-signal`, which is the reading
|
|
314
|
+
* §14.2.4.8 itself gives to an undecorated name. So the fallback is the
|
|
315
|
+
* specification's own default rather than an error state.
|
|
316
|
+
*
|
|
317
|
+
* The keywords are matched case-insensitively and reported LOWERCASE in
|
|
318
|
+
* {@link UmlTrigger.kind} while {@link UmlTrigger.text} keeps the author's
|
|
319
|
+
* capitals: the classification is a fact about the notation, the text is a fact
|
|
320
|
+
* about the drawing, and neither should be made to speak for the other.
|
|
321
|
+
*/
|
|
322
|
+
export declare function parseTrigger(raw: string): UmlTrigger;
|
|
323
|
+
/**
|
|
324
|
+
* The inside of a `[…]` guard — `undefined` when there is nothing in it.
|
|
325
|
+
*
|
|
326
|
+
* The brackets are OPTIONAL on the way in, for the same reason
|
|
327
|
+
* {@link parseMultiplicity} strips its own: the same guard is written both ways
|
|
328
|
+
* depending on where it sits. §15.2.4 puts an activity edge's guard in brackets
|
|
329
|
+
* beside the line and §14.2.4.8 puts a transition's in brackets inside the
|
|
330
|
+
* label, while a caller that has already split a label on its brackets holds the
|
|
331
|
+
* bare expression. One parser, both call sites.
|
|
332
|
+
*/
|
|
333
|
+
export declare function parseGuard(raw: string | undefined | null): string | undefined;
|
|
334
|
+
/** A transition label, as §14.2.4.8's three optional parts. */
|
|
335
|
+
export interface UmlTransitionLabel {
|
|
336
|
+
/** `<trigger> [',' <trigger>]*`, in order, each trimmed and verbatim. */
|
|
337
|
+
triggers: string[];
|
|
338
|
+
/** `'[' <guard> ']'`, without its brackets. */
|
|
339
|
+
guard?: string;
|
|
340
|
+
/** `'/' <behavior-expression>` — an expression, kept exactly as written. */
|
|
341
|
+
effect?: string;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* One transition label, per §14.2.4.8:
|
|
345
|
+
*
|
|
346
|
+
* `[<trigger> [',' <trigger>]*] ['[' <guard> ']'] ['/' <behavior-expression>]`
|
|
347
|
+
*
|
|
348
|
+
* Every part is optional and an empty label is a legal transition — §14.2.4.8's
|
|
349
|
+
* outermost brackets say so, and a completion transition (one that fires when
|
|
350
|
+
* its source state finishes) is written with no label at all. So the empty
|
|
351
|
+
* string parses to `{ triggers: [] }` rather than to a trigger named nothing.
|
|
352
|
+
*
|
|
353
|
+
* ## Read left to right, and anchored on the GUARD
|
|
354
|
+
*
|
|
355
|
+
* The guard is the only part with a delimiter at both ends, so it is found
|
|
356
|
+
* first: the first top-level `[` opens it and its matching `]` closes it.
|
|
357
|
+
* Everything before is the trigger list, and the first top-level `/` after it
|
|
358
|
+
* opens the effect. A label with no guard splits on its first top-level `/`
|
|
359
|
+
* instead, which is the same rule with the anchor missing.
|
|
360
|
+
*
|
|
361
|
+
* ## The one degradation, stated
|
|
362
|
+
*
|
|
363
|
+
* A bare change event holding a slash — `when x/2 > 1`, with no guard and no
|
|
364
|
+
* effect — reads its `/` as the effect separator and comes back as the trigger
|
|
365
|
+
* `when x` with the effect `2 > 1`. §13.3.4's `<value-specification>` is an
|
|
366
|
+
* arbitrary expression and the notation gives it no delimiters, so no reading of
|
|
367
|
+
* a flat string can tell the two apart; bracketing the expression, which is
|
|
368
|
+
* legal, resolves it. Stated here rather than discovered in an export.
|
|
369
|
+
*/
|
|
370
|
+
export declare function parseTransition(label: string | undefined | null): UmlTransitionLabel;
|
|
371
|
+
/** What an activity edge's label says — §15.2.4's name, guard and weight. */
|
|
372
|
+
export interface UmlActivityEdgeLabel {
|
|
373
|
+
/** The edge's own name, "notated near the arrow" (§15.2.4). */
|
|
374
|
+
name?: string;
|
|
375
|
+
/** "Guards are shown as text in square brackets near tail of the line." */
|
|
376
|
+
guard?: string;
|
|
377
|
+
/**
|
|
378
|
+
* `{weight = <value-specification>}`, as the VALUE alone.
|
|
379
|
+
*
|
|
380
|
+
* A string rather than a number because §15.2.4's own grammar admits `*` for
|
|
381
|
+
* an unlimited weight and a ValueSpecification for everything else — an
|
|
382
|
+
* expression, a constant, the name of a Property. The same call
|
|
383
|
+
* {@link UmlMultiplicity} makes about `*`, one clause over.
|
|
384
|
+
*/
|
|
385
|
+
weight?: string;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* One activity edge's centre label, split into what §15.2.4 writes around a
|
|
389
|
+
* line.
|
|
390
|
+
*
|
|
391
|
+
* Three annotations sharing one text, because this canvas gives a connector ONE
|
|
392
|
+
* label (`docs/adr/0018`) where the notation places three things at three points
|
|
393
|
+
* along the arrow. The delimiters are the notation's own — brackets for the
|
|
394
|
+
* guard, braces for the weight — so an author who writes
|
|
395
|
+
* `ready [stock > 0] {weight = 2}` gets all three read back, and one who writes
|
|
396
|
+
* only a word gets a named edge.
|
|
397
|
+
*
|
|
398
|
+
* Whatever is left once the bracketed and braced groups are lifted out is the
|
|
399
|
+
* NAME, which is why a label with no delimiters is a name and not a guard: a
|
|
400
|
+
* guard is bracketed in §15.2.4 and inventing one from a bare word would put a
|
|
401
|
+
* condition in a file that the drawing does not show.
|
|
402
|
+
*
|
|
403
|
+
* A braced group that is not a `weight-annotation` — `{stream}`, `{ordered}` —
|
|
404
|
+
* is dropped rather than folded into the name: it is notation this pack does not
|
|
405
|
+
* model, and gluing it onto the edge's name would rename the edge.
|
|
406
|
+
*/
|
|
407
|
+
export declare function parseActivityEdge(label: string | undefined | null): UmlActivityEdgeLabel;
|
|
408
|
+
/** Which of §14.2.4.4's three `<behavior-type-label>`s a line carries. */
|
|
409
|
+
export type UmlStateBehaviorKind = 'entry' | 'do' | 'exit';
|
|
410
|
+
/** One line of a state's internal activities compartment. */
|
|
411
|
+
export interface UmlStateBehavior {
|
|
412
|
+
kind: UmlStateBehaviorKind;
|
|
413
|
+
/**
|
|
414
|
+
* `<behavior-expression>` — absent when the author wrote the label and no
|
|
415
|
+
* expression, which is a line somebody is halfway through.
|
|
416
|
+
*/
|
|
417
|
+
expression?: string;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* `entry / x`, `do / y`, `exit / z` — §14.2.4.4's internal activities.
|
|
421
|
+
*
|
|
422
|
+
* `undefined` for every other line, and that is what makes the reading safe: a
|
|
423
|
+
* state's compartment holds internal TRANSITIONS too (§14.2.4.4's next
|
|
424
|
+
* compartment, `{<trigger>}* ['[' <guard> ']'] [/<behavior-expression>]`) and
|
|
425
|
+
* ordinary prose besides. Only the three labels the clause names are lifted out;
|
|
426
|
+
* everything else stays a line of the compartment, which is what
|
|
427
|
+
* {@link parseCompartment} already hands over.
|
|
428
|
+
*
|
|
429
|
+
* The separator is optional on the way in — `entry x` reads as `entry / x` —
|
|
430
|
+
* because the slash is the one character of this syntax an author routinely
|
|
431
|
+
* forgets, and the label alone is unambiguous about what the rest of the line
|
|
432
|
+
* is.
|
|
433
|
+
*/
|
|
434
|
+
export declare function parseStateBehavior(line: string): UmlStateBehavior | undefined;
|
|
435
|
+
/**
|
|
436
|
+
* §15.2.4's three annotations, back in one string — `name [guard] {weight = w}`.
|
|
437
|
+
*
|
|
438
|
+
* The inverse of {@link parseActivityEdge}, and it lives beside it for the
|
|
439
|
+
* reason every parser and printer pair should: the notation is one grammar, and
|
|
440
|
+
* two files spelling it separately is how a guard comes back without its
|
|
441
|
+
* brackets. Read by the PlantUML writer (which puts it on the arrow) and by the
|
|
442
|
+
* importers' materializer (which puts it in the connector's centre label), so a
|
|
443
|
+
* flow drawn from a file and one exported to one carry the same words.
|
|
444
|
+
*/
|
|
445
|
+
export declare function formatActivityEdgeLabel(label: UmlActivityEdgeLabel): string;
|
|
446
|
+
/**
|
|
447
|
+
* §14.2.4.8's label, back in one string — `trigger1, trigger2 [guard] / effect`.
|
|
448
|
+
*
|
|
449
|
+
* The inverse of {@link parseTransition}, and a round trip rather than the
|
|
450
|
+
* author's own text passed through: the model holds the parsed parts, and
|
|
451
|
+
* printing them in the BNF's own order is what makes a label somebody typed
|
|
452
|
+
* loosely — a guard before its trigger, a missing space — come out spelled the
|
|
453
|
+
* way the clause spells it.
|
|
454
|
+
*/
|
|
455
|
+
export declare function formatTransitionLabel(label: UmlTransitionLabel): string;
|
|
456
|
+
/**
|
|
457
|
+
* The STRICT half of this module, and the `label-syntax` rules' whole verdict.
|
|
458
|
+
*
|
|
459
|
+
* Everything above degrades: a line the grammar cannot see structure in comes
|
|
460
|
+
* back as `{ name: <the line> }` and travels through the exporters as an element
|
|
461
|
+
* named exactly what the author wrote. That is the right answer for a WRITER —
|
|
462
|
+
* the picture keeps saying what it said — and it is no answer at all for a
|
|
463
|
+
* CHECKER, which is being asked precisely whether the degradation happened.
|
|
464
|
+
*
|
|
465
|
+
* So the checkers below re-ask the same question with the opposite bias, and
|
|
466
|
+
* they change nothing about the parsers: `parseProperty`, `parseOperation`,
|
|
467
|
+
* `parseTransition` and `parseMultiplicity` return exactly what they returned
|
|
468
|
+
* before this section existed, and the exporters read exactly what they read.
|
|
469
|
+
*
|
|
470
|
+
* ## The one rule every checker follows
|
|
471
|
+
*
|
|
472
|
+
* **A line is `ok: false` when the lenient parse LOST something.** Not when it
|
|
473
|
+
* is terse, not when it omits an optional part — §9.5.4 makes everything but
|
|
474
|
+
* `<name>` optional and a bare `balance` is a conformant Property — but when a
|
|
475
|
+
* part the author actually WROTE is not in the record: a `:` with no type after
|
|
476
|
+
* it, a `[…]` that is not a multiplicity range, an operation with no parameter
|
|
477
|
+
* list, a `/` with no behaviour behind it. Those are the cases where the drawing
|
|
478
|
+
* and the exported file stop saying the same thing, and they are the only ones
|
|
479
|
+
* a user can act on.
|
|
480
|
+
*
|
|
481
|
+
* That rule is what keeps these checks honest about the specification. A stricter
|
|
482
|
+
* reading — "an attribute must carry a type" — would indict a conformant line,
|
|
483
|
+
* and the `provenance: 'standard'` these rules declare would be claiming UML
|
|
484
|
+
* forbids what UML does not.
|
|
485
|
+
*
|
|
486
|
+
* ## The reason is a FRAGMENT, in English
|
|
487
|
+
*
|
|
488
|
+
* The engine prints it after the offending line (`validation.ts`
|
|
489
|
+
* `evaluateLabelSyntax`), so the two read as one sentence. The framework owns
|
|
490
|
+
* the word, as it owns every other `*Fallback` it ships.
|
|
491
|
+
*/
|
|
492
|
+
export interface UmlSyntaxCheck {
|
|
493
|
+
/** The line is spelled the way the clause spells it. */
|
|
494
|
+
ok: boolean;
|
|
495
|
+
/** Why it is not, when it is not — see the header. */
|
|
496
|
+
reason?: string;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* One attribute line, checked against §9.5.4 —
|
|
500
|
+
* `[<visibility>] ['/'] <name> [':' <type>] ['[' <mult> ']'] ['=' <default>]
|
|
501
|
+
* ['{' <modifiers> '}']`.
|
|
502
|
+
*
|
|
503
|
+
* Built on {@link parseProperty} and changing nothing about it. An empty line is
|
|
504
|
+
* `ok`: the family that calls this never passes one, and a total function is
|
|
505
|
+
* easier to reason about than one with a precondition.
|
|
506
|
+
*
|
|
507
|
+
* ## The parenthesis case, and why it is worth its own sentence
|
|
508
|
+
*
|
|
509
|
+
* `place(order)` typed into the ATTRIBUTES compartment is the single most common
|
|
510
|
+
* mistake this rule catches, and it is not a spelling mistake — it is a line in
|
|
511
|
+
* the wrong box. The check runs on what is left once the default value is peeled
|
|
512
|
+
* off, so `origin : Point = Point(0, 0)` keeps its parentheses and its silence.
|
|
513
|
+
*/
|
|
514
|
+
export declare function checkPropertyLine(line: string): UmlSyntaxCheck;
|
|
515
|
+
/**
|
|
516
|
+
* One operation line, checked against §9.6.4 —
|
|
517
|
+
* `[<visibility>] <name> '(' [<parameter-list>] ')' [':' [<return-type>]
|
|
518
|
+
* ['[' <mult> ']'] ['{' <oper-property>* '}']]`.
|
|
519
|
+
*
|
|
520
|
+
* Built on {@link parseOperation} and changing nothing about it. This is the one
|
|
521
|
+
* checker with a genuine FALL-BACK to report: a line with no parentheses is not
|
|
522
|
+
* an operation the grammar can see at all, and `parseOperation` says so by
|
|
523
|
+
* returning the whole line as a name. An author halfway through typing `place`
|
|
524
|
+
* gets that silence from the rule's `audit` severity, not from the grammar.
|
|
525
|
+
*/
|
|
526
|
+
export declare function checkOperationLine(line: string): UmlSyntaxCheck;
|
|
527
|
+
/**
|
|
528
|
+
* One transition label, checked against §14.2.4.8 —
|
|
529
|
+
* `[<trigger> [',' <trigger>]*] ['[' <guard> ']'] ['/' <behavior-expression>]`.
|
|
530
|
+
*
|
|
531
|
+
* Built on {@link parseTransition} and changing nothing about it. An EMPTY label
|
|
532
|
+
* is `ok` and that is the clause's own reading: a completion transition — one
|
|
533
|
+
* that fires when its source state finishes — is written with no label at all,
|
|
534
|
+
* so a rule indicting the empty string would indict half the state machines ever
|
|
535
|
+
* drawn.
|
|
536
|
+
*
|
|
537
|
+
* The parser's two documented tolerances are exactly what this reports: an
|
|
538
|
+
* unclosed `[` ("a guard somebody is still typing") and a `/` with nothing
|
|
539
|
+
* behind it.
|
|
540
|
+
*/
|
|
541
|
+
export declare function checkTransitionLabel(label: string | undefined | null): UmlSyntaxCheck;
|
|
542
|
+
/**
|
|
543
|
+
* One multiplicity, checked against §7.5.4 — `[<lower> '..'] <upper>`, brackets
|
|
544
|
+
* optional.
|
|
545
|
+
*
|
|
546
|
+
* The thinnest of the four: {@link parseMultiplicity} already answers
|
|
547
|
+
* `undefined` for everything that is not a range, so this is that answer with a
|
|
548
|
+
* sentence attached. The one case worth naming is the SYMBOLIC range — `n..m` is
|
|
549
|
+
* legal UML and parses to `undefined` here on purpose (the module's callers write
|
|
550
|
+
* integer bounds into files, and inventing one for `n` would be a fact the author
|
|
551
|
+
* never stated), so the reason says what the writers can hold rather than what
|
|
552
|
+
* the specification permits.
|
|
553
|
+
*/
|
|
554
|
+
export declare function checkMultiplicity(raw: string): UmlSyntaxCheck;
|
|
555
|
+
/**
|
|
556
|
+
* The multiplicity an ASSOCIATION END's label opens with, when it opens with one
|
|
557
|
+
* at all — §11.5.4 beside §7.5.4.
|
|
558
|
+
*
|
|
559
|
+
* Reads the label exactly as {@link parseEndLabel} does (visibility marker off
|
|
560
|
+
* the front, then the leading token, brackets optional) and then asks
|
|
561
|
+
* {@link checkMultiplicity} about that token — but only when the token is an
|
|
562
|
+
* attempt at a range. Everything else on an end label is the ROLE name, which is
|
|
563
|
+
* free text and has no syntax to be wrong about.
|
|
564
|
+
*
|
|
565
|
+
* So `0..*`, `1`, `[0..1]` and `0..* items` are silent, `1..n` and `0...*` are
|
|
566
|
+
* reported, and `items`, `- owner` and `1st choice` are none of this rule's
|
|
567
|
+
* business.
|
|
568
|
+
*/
|
|
569
|
+
export declare function checkEndLabelMultiplicity(label: string | undefined | null): UmlSyntaxCheck;
|
|
570
|
+
/**
|
|
571
|
+
* What a LIFELINE's head says, per §17.3.4 —
|
|
572
|
+
* `[<name> ['[' <selector> ']']] [':' <type>]`.
|
|
573
|
+
*
|
|
574
|
+
* Every part is optional, and the specification means it: `: Order` is an
|
|
575
|
+
* anonymous participant of a known type, `o` is a named one of no stated type,
|
|
576
|
+
* and `self` is the object that encloses the Interaction (which this parser
|
|
577
|
+
* reads as a lifeline NAMED `self` — the grammar's own alternative, kept as
|
|
578
|
+
* words rather than promoted to a flag nothing here would read).
|
|
579
|
+
*
|
|
580
|
+
* `<decomposition>` — §17.3.4's trailing `ref <interactionident> [strict]` — is
|
|
581
|
+
* NOT modelled: an interaction use is drawn on this canvas as a fragment with
|
|
582
|
+
* the `ref` operator (ADR 0022), so a decomposition written into a head has no
|
|
583
|
+
* second home and stays part of whichever part it was typed into.
|
|
584
|
+
*/
|
|
585
|
+
export interface UmlLifelineIdent {
|
|
586
|
+
/** `<connectable-element-name>`. Absent when the head names no participant. */
|
|
587
|
+
name?: string;
|
|
588
|
+
/** `<connectable-element-type>` — what follows the `:`. */
|
|
589
|
+
type?: string;
|
|
590
|
+
/** `<selector>` — the expression inside the `[ ]` after the name. */
|
|
591
|
+
selector?: string;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* One lifeline head, per §17.3.4.
|
|
595
|
+
*
|
|
596
|
+
* Peeled from the RIGHT like every other parser here: the `:` type first (the
|
|
597
|
+
* last of the three parts), then the trailing `[ ]` selector, and what is left
|
|
598
|
+
* is the name. Splitting on the FIRST top-level `:` keeps a type expression that
|
|
599
|
+
* carries one of its own (`: Map[String, Int]`) whole, and the depth count is
|
|
600
|
+
* what keeps a selector holding a colon (`accounts[k : Key]`) out of the split.
|
|
601
|
+
*
|
|
602
|
+
* Degrades like the rest of this module: a head the grammar cannot see structure
|
|
603
|
+
* in is a lifeline NAMED exactly what the author wrote, and an empty head is an
|
|
604
|
+
* empty record rather than a throw — §17.3.4 says a `<lifelineident>` cannot be
|
|
605
|
+
* empty, and reporting that is `label-presence`'s job and not a parser's.
|
|
606
|
+
*/
|
|
607
|
+
export declare function parseLifelineIdent(text: string | undefined | null): UmlLifelineIdent;
|
|
608
|
+
/**
|
|
609
|
+
* What a MESSAGE's label says, per §17.4.4 — the request and the reply
|
|
610
|
+
* productions read as ONE shape, because an arrow on this canvas carries one
|
|
611
|
+
* text and the reader is not told which of the two grammars to use.
|
|
612
|
+
*
|
|
613
|
+
* `<request-message-label> ::= <message-name> ['(' [<input-argument-list>] ')']`
|
|
614
|
+
* is the reply production minus the assignment target and the return value, so a
|
|
615
|
+
* parser for the wider one reads both and a request label simply comes back with
|
|
616
|
+
* those two absent. The rule that reads this (`uml.message-syntax`) is written
|
|
617
|
+
* on `uml:message`, the parent of all five sorts, for exactly that reason.
|
|
618
|
+
*/
|
|
619
|
+
export interface UmlMessageLabel {
|
|
620
|
+
/** `<assignment-target>` — what is written before the `=`. */
|
|
621
|
+
assign?: string;
|
|
622
|
+
/**
|
|
623
|
+
* `<message-name>`. Always present, `''` when the label has none: the checker
|
|
624
|
+
* is what reports that, and a caller writing a file wants one slot to read.
|
|
625
|
+
*/
|
|
626
|
+
name: string;
|
|
627
|
+
/**
|
|
628
|
+
* The argument list, RAW and in order — `[]` for `m()`, absent for `m`.
|
|
629
|
+
*
|
|
630
|
+
* The distinction is the clause's own: §17.4.4 says an empty pair of
|
|
631
|
+
* parentheses may still be written after the name, so "no list at all" and
|
|
632
|
+
* "an empty list" are two things an author typed differently and a writer
|
|
633
|
+
* should be able to tell apart.
|
|
634
|
+
*
|
|
635
|
+
* Each entry is the text between two top-level commas, trimmed — never parsed
|
|
636
|
+
* further. §17.4.4 admits four spellings of an argument (`v`, `-`, `n = v`,
|
|
637
|
+
* `n : v`) and what a writer does with them differs per format, so the split
|
|
638
|
+
* is shared and the reading is not.
|
|
639
|
+
*/
|
|
640
|
+
args?: string[];
|
|
641
|
+
/** `<value-specification>` — what follows the `:` at the very end. */
|
|
642
|
+
returnValue?: string;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* One message label, per §17.4.4.
|
|
646
|
+
*
|
|
647
|
+
* The parentheses are the anchor, exactly as they are for an operation
|
|
648
|
+
* ({@link parseOperation}): everything before the `(` is the assignment target
|
|
649
|
+
* and the name, everything inside is the argument list, and everything after is
|
|
650
|
+
* the optional `: <value-specification>`. A label with no parentheses is split
|
|
651
|
+
* on its first top-level `:` instead, so `ok : true` still says what it says.
|
|
652
|
+
*
|
|
653
|
+
* `*` — §17.4.4's shorthand for "a message of any type" — comes back as a
|
|
654
|
+
* message NAMED `*`. That is the degradation contract of this module rather than
|
|
655
|
+
* a reading of the clause: the shorthand stands for a combined fragment this
|
|
656
|
+
* canvas does not draw (ADR 0022), so the honest thing is to keep the author's
|
|
657
|
+
* character and let the writers pass it through.
|
|
658
|
+
*/
|
|
659
|
+
export declare function parseMessageLabel(text: string | undefined | null): UmlMessageLabel;
|
|
660
|
+
/**
|
|
661
|
+
* One lifeline head, checked against §17.3.4 —
|
|
662
|
+
* `[<name> ['[' <selector> ']']] [':' <type>]`.
|
|
663
|
+
*
|
|
664
|
+
* Built on {@link parseLifelineIdent} and changing nothing about it. An empty
|
|
665
|
+
* head is `ok` here even though §17.3.4 says a `<lifelineident>` cannot be
|
|
666
|
+
* empty: the family that calls this never passes an empty line, and "this
|
|
667
|
+
* lifeline has no name" is a question `label-presence` already asks with its own
|
|
668
|
+
* id and its own sentence (`uml.unnamed-lifeline`). Two rules reporting one
|
|
669
|
+
* emptied head would be two brackets on one word to fix.
|
|
670
|
+
*
|
|
671
|
+
* ## The parenthesis case
|
|
672
|
+
*
|
|
673
|
+
* `place(order)` typed into a lifeline head is a MESSAGE label written on the
|
|
674
|
+
* wrong artefact, which is the same mistake — and the same sentence — that
|
|
675
|
+
* {@link checkPropertyLine} catches when an operation is typed into an attribute
|
|
676
|
+
* compartment. §17.3.4 gives a head no parentheses at all.
|
|
677
|
+
*/
|
|
678
|
+
export declare function checkLifelineIdent(line: string | undefined | null): UmlSyntaxCheck;
|
|
679
|
+
/**
|
|
680
|
+
* One message label, checked against §17.4.4 — the request and the reply
|
|
681
|
+
* productions together, since the arrow carries one text.
|
|
682
|
+
*
|
|
683
|
+
* Built on {@link parseMessageLabel} and changing nothing about it. An EMPTY
|
|
684
|
+
* label is `ok`, and that is the clause's own reading twice over: §17.4.4 makes
|
|
685
|
+
* the label optional, and a sequence diagram is drawn arrows-first with the
|
|
686
|
+
* words added afterwards. `*` is `ok` for the same reason
|
|
687
|
+
* {@link parseMessageLabel} keeps it — it is a spelling the specification
|
|
688
|
+
* prints.
|
|
689
|
+
*
|
|
690
|
+
* Reports exactly the four ways the lenient parse LOSES something: a bracket
|
|
691
|
+
* still open, an argument between two commas, text after the `)` that is neither
|
|
692
|
+
* a return value nor nothing, and a `:` or an `=` with nothing on the side that
|
|
693
|
+
* has to carry words.
|
|
694
|
+
*/
|
|
695
|
+
export declare function checkMessageLabel(line: string | undefined | null): UmlSyntaxCheck;
|