Skip to main content

sysml_v2_parser/ast/
structure.rs

1use super::behavior::{Allocate, InOut, InOutDecl, StateDefBody, StateUsage};
2use super::common::{CommentAnnotation, ConnectBody, DocComment, Identification, ParseErrorNode};
3use super::requirement::{EnumerationUsage, ItemUsage, RequirementUsage, Satisfy};
4use super::view::{CalcUsage, ConstraintDefBody};
5use crate::ast::core::{Expression, Node, Span};
6
7/// Part definition: `part def` Identification (`:>` specializes)? Body.
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub struct PartDef {
10    /// Optional `abstract` or `variation` prefix (BNF BasicDefinitionPrefix).
11    pub definition_prefix: Option<DefinitionPrefix>,
12    /// Whether this is an `individual part def`.
13    pub is_individual: bool,
14    pub identification: Identification,
15    /// Supertype after `:>`, e.g. Some("Axle") for `part def FrontAxle :> Axle`.
16    pub specializes: Option<String>,
17    /// Span of the `:> <type>` fragment (for semantic tokens), when present.
18    pub specializes_span: Option<Span>,
19    pub body: PartDefBody,
20}
21
22/// BNF BasicDefinitionPrefix: `abstract` | `variation`.
23#[derive(Debug, Clone, PartialEq, Eq)]
24pub enum DefinitionPrefix {
25    Abstract,
26    Variation,
27}
28
29/// Body of a part definition: `;` or `{` PartDefBodyElement* `}`.
30#[derive(Debug, Clone, PartialEq, Eq)]
31pub enum PartDefBody {
32    Semicolon,
33    Brace {
34        elements: Vec<Node<PartDefBodyElement>>,
35    },
36}
37
38/// Element inside a part definition body.
39#[derive(Debug, Clone, PartialEq, Eq)]
40pub enum PartDefBodyElement {
41    Error(Node<ParseErrorNode>),
42    Doc(Node<DocComment>),
43    Comment(Node<CommentAnnotation>),
44    Annotation(Node<Annotation>),
45    MetadataKeywordUsage(Node<MetadataKeywordUsage>),
46    Other(String),
47    AttributeDef(Node<AttributeDef>),
48    AttributeUsage(Node<AttributeUsage>),
49    RequirementUsage(Node<RequirementUsage>),
50    ItemDef(Node<ItemDef>),
51    ItemUsage(Node<ItemUsage>),
52    Ref(Node<RefDecl>),
53    PortUsage(Node<PortUsage>),
54    PartUsage(Box<Node<PartUsage>>),
55    PartDef(Node<PartDef>),
56    OccurrenceUsage(Box<Node<OccurrenceUsage>>),
57    InterfaceDef(Node<InterfaceDef>),
58    InterfaceUsage(Node<InterfaceUsage>),
59    Connect(Node<Connect>),
60    /// `connection` usage member inside a part definition body.
61    Connection(Node<ConnectionUsageMember>),
62    Perform(Node<Perform>),
63    Allocate(Node<Allocate>),
64    OpaqueMember(Node<OpaqueMemberDecl>),
65    /// `exhibit state` name `:` type (`;` or body).
66    ExhibitState(Node<ExhibitState>),
67    /// Calculation usage (`calc` keyword) inside a part definition body.
68    CalcUsage(Node<CalcUsage>),
69    /// Enumeration usage (`enum` keyword) inside a part definition body.
70    EnumerationUsage(Node<EnumerationUsage>),
71}
72
73/// Library-tolerant part member preserved without forcing it into an unrelated node shape.
74#[derive(Debug, Clone, PartialEq, Eq)]
75pub struct OpaqueMemberDecl {
76    pub keyword: String,
77    pub name: String,
78    pub text: String,
79    pub body: AttributeBody,
80}
81
82/// Connection usage member inside part definitions.
83#[derive(Debug, Clone, PartialEq, Eq)]
84pub struct ConnectionUsageMember {
85    pub name: Option<String>,
86    pub type_name: Option<String>,
87    pub body: ConnectionDefBody,
88    pub subsets: Option<String>,
89    pub redefines: Option<String>,
90}
91
92/// Exhibit state usage: `exhibit state` name `:` type (`;` or body).
93#[derive(Debug, Clone, PartialEq, Eq)]
94pub struct ExhibitState {
95    pub name: String,
96    pub type_name: Option<String>,
97    pub redefines: Option<String>,
98    pub body: StateDefBody,
99}
100
101/// Attribute definition: `attribute` [`def`] name (`:>` | `:` type)? (`=` value)? body.
102#[derive(Debug, Clone, PartialEq, Eq)]
103pub struct AttributeDef {
104    pub name: String,
105    /// Type after `:>`, e.g. Some("ISQ::mass").
106    pub typing: Option<String>,
107    /// Default or binding after `=` / `:=` / `default =` before the body terminator.
108    pub value: Option<Node<Expression>>,
109    pub body: AttributeBody,
110    /// Span of the defined name (for semantic tokens).
111    pub name_span: Option<Span>,
112    /// Span of the type after `:>`, if present (for semantic tokens).
113    pub typing_span: Option<Span>,
114    /// Span of the default/binding expression value, when present.
115    pub value_span: Option<Span>,
116}
117
118/// Body of an attribute (def or usage): `;` or `{` AttributeBodyElement* `}`.
119#[derive(Debug, Clone, PartialEq, Eq)]
120pub enum AttributeBody {
121    Semicolon,
122    Brace {
123        elements: Vec<Node<AttributeBodyElement>>,
124    },
125}
126
127#[derive(Debug, Clone, PartialEq, Eq)]
128pub enum AttributeBodyElement {
129    Error(Node<ParseErrorNode>),
130    Doc(Node<DocComment>),
131    AttributeDef(Node<AttributeDef>),
132    AttributeUsage(Node<AttributeUsage>),
133    Other(String),
134}
135
136/// Item definition: `item def` Identification body (for events, etc.).
137#[derive(Debug, Clone, PartialEq, Eq)]
138pub struct ItemDef {
139    pub identification: Identification,
140    pub specializes: Option<String>,
141    pub specializes_span: Option<Span>,
142    pub body: AttributeBody,
143}
144
145/// Individual definition: `individual def` Identification `:>` type body.
146#[derive(Debug, Clone, PartialEq, Eq)]
147pub struct IndividualDef {
148    pub identification: Identification,
149    pub specializes: Option<String>,
150    pub specializes_span: Option<Span>,
151    pub body: AttributeBody,
152}
153
154/// Part usage: `part` name `:` type multiplicity? `ordered`? (`redefines`|`:>>`)? value? body.
155#[derive(Debug, Clone, PartialEq, Eq)]
156pub struct PartUsage {
157    pub is_individual: bool,
158    pub name: String,
159    /// Type after `:`, e.g. "Vehicle", "AxleAssembly".
160    pub type_name: String,
161    /// Multiplicity, e.g. Some("[2]").
162    pub multiplicity: Option<String>,
163    pub ordered: bool,
164    /// Optional `subsets` feature and value expression.
165    pub subsets: Option<(String, Option<Node<Expression>>)>,
166    /// Redefines target, e.g. Some("frontAxleAssembly") or Some("vehicle1::mass").
167    pub redefines: Option<String>,
168    /// Value expression (= expr, default = expr, := expr).
169    pub value: Option<Node<Expression>>,
170    pub body: PartUsageBody,
171    /// Span of the usage name (for semantic tokens).
172    pub name_span: Option<Span>,
173    /// Span of the type reference after `:` (for semantic tokens).
174    pub type_ref_span: Option<Span>,
175}
176
177/// Body of a part usage: `;` or `{` PartUsageBodyElement* `}`.
178#[derive(Debug, Clone, PartialEq, Eq)]
179pub enum PartUsageBody {
180    Semicolon,
181    Brace {
182        elements: Vec<Node<PartUsageBodyElement>>,
183    },
184}
185
186/// Metadata annotation on usage: `@` Name (`:` Type)? MetadataBody (e.g. `@Security;` or `@Safety{isMandatory = true;}`).
187#[derive(Debug, Clone, PartialEq, Eq)]
188pub struct MetadataAnnotation {
189    pub name: String,
190    pub type_name: Option<String>,
191    pub body: ConnectBody,
192    pub head_span: Option<Span>,
193    pub type_span: Option<Span>,
194}
195
196/// User-defined metadata keyword usage: `#keyword` (`:` Type)? body.
197#[derive(Debug, Clone, PartialEq, Eq)]
198pub struct MetadataKeywordUsage {
199    pub keyword: String,
200    pub type_name: Option<String>,
201    pub body: ConnectBody,
202    pub keyword_span: Span,
203    pub type_span: Option<Span>,
204}
205
206/// Generic annotation or metadata usage captured in body scopes.
207#[derive(Debug, Clone, PartialEq, Eq)]
208pub struct Annotation {
209    pub sigil: String,
210    pub head: String,
211    pub type_name: Option<String>,
212    pub body: ConnectBody,
213    pub head_span: Option<Span>,
214    pub type_span: Option<Span>,
215}
216
217/// Element inside a part usage body.
218#[derive(Debug, Clone, PartialEq, Eq)]
219pub enum PartUsageBodyElement {
220    Error(Node<ParseErrorNode>),
221    Doc(Node<DocComment>),
222    Annotation(Node<Annotation>),
223    AttributeUsage(Node<AttributeUsage>),
224    EnumerationUsage(Node<EnumerationUsage>),
225    PartUsage(Box<Node<PartUsage>>),
226    OccurrenceUsage(Box<Node<OccurrenceUsage>>),
227    PortUsage(Node<PortUsage>),
228    Bind(Node<Bind>),
229    /// `ref` name `:` type body (reference binding in part usage).
230    Ref(Node<RefDecl>),
231    InterfaceUsage(Node<InterfaceUsage>),
232    Connect(Node<Connect>),
233    Perform(Node<Perform>),
234    Allocate(Node<Allocate>),
235    Satisfy(Node<Satisfy>),
236    StateUsage(Node<StateUsage>),
237    MetadataAnnotation(Node<MetadataAnnotation>),
238    MetadataKeywordUsage(Node<MetadataKeywordUsage>),
239}
240
241/// Enacted performance: `perform` action_path `{` body `}` inside a part usage.
242#[derive(Debug, Clone, PartialEq, Eq)]
243pub struct Perform {
244    /// Qualified action name (e.g. "provide power" or "provide power.generate torque").
245    pub action_name: String,
246    /// Type after `:` in "perform action name : Type" form.
247    pub type_name: Option<String>,
248    pub body: PerformBody,
249}
250
251/// Body of a perform: `;` or `{` PerformBodyElement* `}`.
252#[derive(Debug, Clone, PartialEq, Eq)]
253pub enum PerformBody {
254    Semicolon,
255    Brace {
256        elements: Vec<Node<PerformBodyElement>>,
257    },
258}
259
260/// Element inside a perform body: doc comment or in/out binding.
261#[derive(Debug, Clone, PartialEq, Eq)]
262pub enum PerformBodyElement {
263    Doc(Node<DocComment>),
264    InOut(Node<PerformInOutBinding>),
265}
266
267/// In/out binding inside a perform body: `in` name `=` expr `;` or `out` name `=` expr `;`.
268#[derive(Debug, Clone, PartialEq, Eq)]
269pub struct PerformInOutBinding {
270    pub direction: InOut,
271    pub name: String,
272    pub value: Node<Expression>,
273}
274
275/// Attribute usage: `attribute` name (`:>` | `:` type)? `redefines`? value? body.
276#[derive(Debug, Clone, PartialEq, Eq)]
277pub struct AttributeUsage {
278    pub name: String,
279    /// Type after `:` or `:>`, e.g. Some("MassValue").
280    pub typing: Option<String>,
281    /// Subsets target after `:>` / `subsets`.
282    pub subsets: Option<String>,
283    /// Redefines target, e.g. Some("Vehicle::mass").
284    pub redefines: Option<String>,
285    /// References target after `::>` / `references`.
286    pub references: Option<String>,
287    /// Crosses target after `=>` / `crosses`.
288    pub crosses: Option<String>,
289    /// Value expression.
290    pub value: Option<Node<Expression>>,
291    pub body: AttributeBody,
292    /// Span of the usage name (for semantic tokens).
293    pub name_span: Option<Span>,
294    /// Span of the type after `:` / `:>`, if present (for semantic tokens).
295    pub typing_span: Option<Span>,
296    /// Span of the redefines target after `redefines`, if present (for semantic tokens).
297    pub redefines_span: Option<Span>,
298    /// Direction prefix when parsed as `in`/`out`/`inout attribute ...` (e.g. in port def bodies).
299    pub direction: Option<InOut>,
300}
301
302// ---------------------------------------------------------------------------
303// Port
304// ---------------------------------------------------------------------------
305
306/// Port definition: `port def` Identification body.
307#[derive(Debug, Clone, PartialEq, Eq)]
308pub struct PortDef {
309    pub identification: Identification,
310    /// Supertype after `:>`, e.g. Some("ClutchPort") for `port def ManualClutchPort :> ClutchPort`.
311    pub specializes: Option<String>,
312    pub specializes_span: Option<Span>,
313    pub body: PortDefBody,
314}
315
316/// Body of a port definition: `;` or `{` PortDefBodyElement* `}`.
317#[derive(Debug, Clone, PartialEq, Eq)]
318pub enum PortDefBody {
319    Semicolon,
320    Brace {
321        elements: Vec<Node<PortDefBodyElement>>,
322    },
323}
324
325/// Element inside a port definition body (in/out declarations or nested port usages).
326#[derive(Debug, Clone, PartialEq, Eq)]
327pub enum PortDefBodyElement {
328    InOutDecl(Node<InOutDecl>),
329    Doc(Node<DocComment>),
330    Error(Node<ParseErrorNode>),
331    AttributeDef(Node<AttributeDef>),
332    AttributeUsage(Node<AttributeUsage>),
333    ItemUsage(Node<ItemUsage>),
334    PortUsage(Node<PortUsage>),
335}
336
337/// Port usage: `port` name `:` type multiplicity? `:>` subsets? `redefines`? body.
338#[derive(Debug, Clone, PartialEq, Eq)]
339pub struct PortUsage {
340    pub name: String,
341    pub type_name: Option<String>,
342    pub multiplicity: Option<String>,
343    /// Subsets feature and optional value expression.
344    pub subsets: Option<(String, Option<Node<Expression>>)>,
345    pub redefines: Option<String>,
346    /// References target after `::>` / `references`.
347    pub references: Option<String>,
348    /// Crosses target after `=>` / `crosses`.
349    pub crosses: Option<String>,
350    pub body: PortBody,
351    /// Span of the usage name (for semantic tokens).
352    pub name_span: Option<Span>,
353    /// Span of the type reference after `:`, if present (for semantic tokens).
354    pub type_ref_span: Option<Span>,
355}
356
357/// Body of a port usage: `;` or `{` PortBodyElement* `}`.
358#[derive(Debug, Clone, PartialEq, Eq)]
359pub enum PortBody {
360    Semicolon,
361    Brace {
362        elements: Vec<Node<PortBodyElement>>,
363    },
364}
365
366/// Element inside a port usage body.
367#[derive(Debug, Clone, PartialEq, Eq)]
368#[allow(clippy::large_enum_variant)]
369pub enum PortBodyElement {
370    Error(Node<ParseErrorNode>),
371    InOutDecl(Node<InOutDecl>),
372    PortUsage(Node<PortUsage>),
373    Other(String),
374}
375
376/// Connect statement in interface def or usage: `connect` from `to` to body.
377#[derive(Debug, Clone, PartialEq, Eq)]
378pub struct ConnectStmt {
379    pub from: Node<Expression>,
380    pub to: Node<Expression>,
381    pub body: ConnectBody,
382}
383
384// ---------------------------------------------------------------------------
385// Interface
386// ---------------------------------------------------------------------------
387
388/// Interface definition: `interface def` Identification body.
389#[derive(Debug, Clone, PartialEq, Eq)]
390pub struct InterfaceDef {
391    pub identification: Identification,
392    pub specializes: Option<String>,
393    pub specializes_span: Option<Span>,
394    pub body: InterfaceDefBody,
395}
396
397/// Body of an interface definition: `;` or `{` InterfaceDefBodyElement* `}`.
398#[derive(Debug, Clone, PartialEq, Eq)]
399pub enum InterfaceDefBody {
400    Semicolon,
401    Brace {
402        elements: Vec<Node<InterfaceDefBodyElement>>,
403    },
404}
405
406/// Element inside an interface definition body.
407#[derive(Debug, Clone, PartialEq, Eq)]
408pub enum InterfaceDefBodyElement {
409    Doc(Node<DocComment>),
410    EndDecl(Node<EndDecl>),
411    RefDecl(Node<RefDecl>),
412    ConnectStmt(Node<ConnectStmt>),
413}
414
415/// End declaration in interface def: `end` name `:` type `;`.
416#[derive(Debug, Clone, PartialEq, Eq)]
417pub struct EndDecl {
418    pub name: String,
419    pub type_name: String,
420    pub uses_derived_syntax: bool,
421    /// Span of the name (for semantic tokens).
422    pub name_span: Option<Span>,
423    /// Span of the type after `:` (for semantic tokens).
424    pub type_ref_span: Option<Span>,
425}
426
427/// Ref declaration in interface def: `ref` name `:` type body.
428#[derive(Debug, Clone, PartialEq, Eq)]
429pub struct RefDecl {
430    pub name: String,
431    pub type_name: String,
432    /// Optional binding value: `= expr` (SysML shorthand binding for references).
433    pub value: Option<Node<Expression>>,
434    pub body: RefBody,
435    /// Span of the name (for semantic tokens).
436    pub name_span: Option<Span>,
437    /// Span of the type after `:` (for semantic tokens).
438    pub type_ref_span: Option<Span>,
439}
440
441/// Body of a ref declaration: `;` or `{` ... `}`.
442#[derive(Debug, Clone, PartialEq, Eq)]
443pub enum RefBody {
444    Semicolon,
445    Brace,
446}
447
448// ---------------------------------------------------------------------------
449// Connection (Phase 2)
450// ---------------------------------------------------------------------------
451
452/// Connection definition: `connection def` Identification body (BNF ConnectionDefinition).
453#[derive(Debug, Clone, PartialEq, Eq)]
454pub struct ConnectionDef {
455    pub annotation: Option<String>,
456    pub identification: Identification,
457    pub specializes: Option<String>,
458    pub specializes_span: Option<Span>,
459    pub body: ConnectionDefBody,
460}
461
462/// Body of a connection definition: `;` or `{` end/ref/connect* `}`.
463#[derive(Debug, Clone, PartialEq, Eq)]
464pub enum ConnectionDefBody {
465    Semicolon,
466    Brace {
467        elements: Vec<Node<ConnectionDefBodyElement>>,
468    },
469}
470
471#[derive(Debug, Clone, PartialEq, Eq)]
472pub enum ConnectionDefBodyElement {
473    EndDecl(Node<EndDecl>),
474    RefDecl(Node<RefDecl>),
475    ConnectStmt(Node<ConnectStmt>),
476}
477
478// ---------------------------------------------------------------------------
479// Metadata (Phase 2)
480// ---------------------------------------------------------------------------
481
482/// Metadata definition: `metadata def` Identification body (BNF MetadataDefinition).
483#[derive(Debug, Clone, PartialEq, Eq)]
484pub struct MetadataDef {
485    pub is_abstract: bool,
486    pub identification: Identification,
487    pub specializes: Option<String>,
488    pub specializes_span: Option<Span>,
489    pub body: AttributeBody,
490}
491
492/// Metadata usage: `metadata` name (`:` type)? body (BNF MetadataUsage).
493#[derive(Debug, Clone, PartialEq, Eq)]
494pub struct MetadataUsage {
495    pub name: String,
496    pub type_name: Option<String>,
497    pub body: AttributeBody,
498}
499
500// ---------------------------------------------------------------------------
501// Enumeration (Phase 2)
502// ---------------------------------------------------------------------------
503
504/// Enumeration definition: `enum def` Identification EnumerationBody (BNF EnumerationDefinition).
505#[derive(Debug, Clone, PartialEq, Eq)]
506pub struct EnumDef {
507    pub identification: Identification,
508    pub specializes: Option<String>,
509    pub specializes_span: Option<Span>,
510    pub body: EnumerationBody,
511}
512
513#[derive(Debug, Clone, PartialEq, Eq)]
514pub enum EnumerationBody {
515    Semicolon,
516    Brace { values: Vec<String> },
517}
518
519// ---------------------------------------------------------------------------
520// Occurrence (Phase 2)
521// ---------------------------------------------------------------------------
522
523/// Occurrence definition: `occurrence def` Identification body (BNF OccurrenceDefinition).
524#[derive(Debug, Clone, PartialEq, Eq)]
525pub struct OccurrenceDef {
526    pub is_abstract: bool,
527    pub identification: Identification,
528    pub specializes: Option<String>,
529    pub specializes_span: Option<Span>,
530    pub body: DefinitionBody,
531}
532
533/// Occurrence usage: `occurrence` name (`:` type)? body, with optional individual/portion modifiers.
534#[derive(Debug, Clone, PartialEq, Eq)]
535pub struct OccurrenceUsage {
536    pub is_individual: bool,
537    pub is_then: bool,
538    pub portion_kind: Option<String>,
539    pub name: String,
540    pub type_name: Option<String>,
541    pub subsets: Option<String>,
542    pub redefines: Option<String>,
543    pub references: Option<String>,
544    pub crosses: Option<String>,
545    pub body: OccurrenceUsageBody,
546}
547
548#[derive(Debug, Clone, PartialEq, Eq)]
549pub enum OccurrenceUsageBody {
550    Semicolon,
551    Brace {
552        elements: Vec<Node<OccurrenceBodyElement>>,
553    },
554}
555
556/// Occurrence-level assert member: `assert constraint` body.
557#[derive(Debug, Clone, PartialEq, Eq)]
558pub struct AssertConstraintMember {
559    pub body: ConstraintDefBody,
560}
561
562#[derive(Debug, Clone, PartialEq, Eq)]
563#[allow(clippy::large_enum_variant)]
564pub enum OccurrenceBodyElement {
565    Error(Node<ParseErrorNode>),
566    Doc(Node<DocComment>),
567    Annotation(Node<Annotation>),
568    AssertConstraint(Node<AssertConstraintMember>),
569    Other(String),
570    AttributeUsage(Node<AttributeUsage>),
571    PartUsage(Box<Node<PartUsage>>),
572    OccurrenceUsage(Box<Node<OccurrenceUsage>>),
573}
574
575// ---------------------------------------------------------------------------
576// Library Package (Phase 2)
577// ---------------------------------------------------------------------------
578
579/// Generic definition body: `;` or `{` DefinitionBodyElement* `}`.
580#[derive(Debug, Clone, PartialEq, Eq)]
581pub enum DefinitionBody {
582    Semicolon,
583    Brace {
584        elements: Vec<Node<DefinitionBodyElement>>,
585    },
586}
587
588#[derive(Debug, Clone, PartialEq, Eq)]
589#[allow(clippy::large_enum_variant)]
590pub enum DefinitionBodyElement {
591    Error(Node<ParseErrorNode>),
592    Doc(Node<DocComment>),
593    OccurrenceMember(Node<OccurrenceBodyElement>),
594    Other(String),
595}
596// ---------------------------------------------------------------------------
597// Part usage body: bind, interface usage, connect
598// ---------------------------------------------------------------------------
599
600/// Bind: `bind` left `=` right (`;` or `{ }`).
601#[derive(Debug, Clone, PartialEq, Eq)]
602pub struct Bind {
603    pub left: Node<Expression>,
604    pub right: Node<Expression>,
605    /// Optional body after the bind (semicolon or brace); 3a fixture uses `bind x = y { }`.
606    pub body: Option<ConnectBody>,
607}
608
609/// Interface usage: typed+connect or connection form.
610#[derive(Debug, Clone, PartialEq, Eq)]
611pub enum InterfaceUsage {
612    /// `interface` `:Type`? `connect` from `to` to body; optional body with ref redefs.
613    TypedConnect {
614        interface_type: Option<String>,
615        from: Node<Expression>,
616        to: Node<Expression>,
617        body: ConnectBody,
618        body_elements: Vec<Node<InterfaceUsageBodyElement>>,
619    },
620    /// `interface` from `to` to body.
621    Connection {
622        from: Node<Expression>,
623        to: Node<Expression>,
624        body_elements: Vec<Node<InterfaceUsageBodyElement>>,
625    },
626}
627
628/// Element in interface usage body (e.g. ref redefinition).
629#[derive(Debug, Clone, PartialEq, Eq)]
630pub enum InterfaceUsageBodyElement {
631    /// `ref` `:>>` name `=` value body.
632    RefRedef {
633        name: String,
634        value: Node<Expression>,
635        body: RefBody,
636    },
637}
638
639/// Connect at part usage level: `connect` from `to` to body.
640#[derive(Debug, Clone, PartialEq, Eq)]
641pub struct Connect {
642    pub from: Node<Expression>,
643    pub to: Node<Expression>,
644    pub body: ConnectBody,
645}
646
647// ---------------------------------------------------------------------------
648// Alias
649// ---------------------------------------------------------------------------
650
651/// Alias definition: `alias` Identification `for` qualified_name body.
652#[derive(Debug, Clone, PartialEq, Eq)]
653pub struct AliasDef {
654    pub identification: Identification,
655    pub target: String,
656    pub body: AliasBody,
657}
658
659/// Body of an alias definition: `;` or `{` ... `}`.
660#[derive(Debug, Clone, PartialEq, Eq)]
661pub enum AliasBody {
662    Semicolon,
663    Brace,
664}