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    PortUsage(Node<PortUsage>),
334}
335
336/// Port usage: `port` name `:` type multiplicity? `:>` subsets? `redefines`? body.
337#[derive(Debug, Clone, PartialEq, Eq)]
338pub struct PortUsage {
339    pub name: String,
340    pub type_name: Option<String>,
341    pub multiplicity: Option<String>,
342    /// Subsets feature and optional value expression.
343    pub subsets: Option<(String, Option<Node<Expression>>)>,
344    pub redefines: Option<String>,
345    /// References target after `::>` / `references`.
346    pub references: Option<String>,
347    /// Crosses target after `=>` / `crosses`.
348    pub crosses: Option<String>,
349    pub body: PortBody,
350    /// Span of the usage name (for semantic tokens).
351    pub name_span: Option<Span>,
352    /// Span of the type reference after `:`, if present (for semantic tokens).
353    pub type_ref_span: Option<Span>,
354}
355
356/// Body of a port usage: `;` or `{` PortBodyElement* `}`.
357#[derive(Debug, Clone, PartialEq, Eq)]
358pub enum PortBody {
359    Semicolon,
360    Brace {
361        elements: Vec<Node<PortBodyElement>>,
362    },
363}
364
365/// Element inside a port usage body.
366#[derive(Debug, Clone, PartialEq, Eq)]
367#[allow(clippy::large_enum_variant)]
368pub enum PortBodyElement {
369    Error(Node<ParseErrorNode>),
370    InOutDecl(Node<InOutDecl>),
371    PortUsage(Node<PortUsage>),
372    Other(String),
373}
374
375/// Connect statement in interface def or usage: `connect` from `to` to body.
376#[derive(Debug, Clone, PartialEq, Eq)]
377pub struct ConnectStmt {
378    pub from: Node<Expression>,
379    pub to: Node<Expression>,
380    pub body: ConnectBody,
381}
382
383// ---------------------------------------------------------------------------
384// Interface
385// ---------------------------------------------------------------------------
386
387/// Interface definition: `interface def` Identification body.
388#[derive(Debug, Clone, PartialEq, Eq)]
389pub struct InterfaceDef {
390    pub identification: Identification,
391    pub specializes: Option<String>,
392    pub specializes_span: Option<Span>,
393    pub body: InterfaceDefBody,
394}
395
396/// Body of an interface definition: `;` or `{` InterfaceDefBodyElement* `}`.
397#[derive(Debug, Clone, PartialEq, Eq)]
398pub enum InterfaceDefBody {
399    Semicolon,
400    Brace {
401        elements: Vec<Node<InterfaceDefBodyElement>>,
402    },
403}
404
405/// Element inside an interface definition body.
406#[derive(Debug, Clone, PartialEq, Eq)]
407pub enum InterfaceDefBodyElement {
408    Doc(Node<DocComment>),
409    EndDecl(Node<EndDecl>),
410    RefDecl(Node<RefDecl>),
411    ConnectStmt(Node<ConnectStmt>),
412}
413
414/// End declaration in interface def: `end` name `:` type `;`.
415#[derive(Debug, Clone, PartialEq, Eq)]
416pub struct EndDecl {
417    pub name: String,
418    pub type_name: String,
419    pub uses_derived_syntax: bool,
420    /// Span of the name (for semantic tokens).
421    pub name_span: Option<Span>,
422    /// Span of the type after `:` (for semantic tokens).
423    pub type_ref_span: Option<Span>,
424}
425
426/// Ref declaration in interface def: `ref` name `:` type body.
427#[derive(Debug, Clone, PartialEq, Eq)]
428pub struct RefDecl {
429    pub name: String,
430    pub type_name: String,
431    /// Optional binding value: `= expr` (SysML shorthand binding for references).
432    pub value: Option<Node<Expression>>,
433    pub body: RefBody,
434    /// Span of the name (for semantic tokens).
435    pub name_span: Option<Span>,
436    /// Span of the type after `:` (for semantic tokens).
437    pub type_ref_span: Option<Span>,
438}
439
440/// Body of a ref declaration: `;` or `{` ... `}`.
441#[derive(Debug, Clone, PartialEq, Eq)]
442pub enum RefBody {
443    Semicolon,
444    Brace,
445}
446
447// ---------------------------------------------------------------------------
448// Connection (Phase 2)
449// ---------------------------------------------------------------------------
450
451/// Connection definition: `connection def` Identification body (BNF ConnectionDefinition).
452#[derive(Debug, Clone, PartialEq, Eq)]
453pub struct ConnectionDef {
454    pub annotation: Option<String>,
455    pub identification: Identification,
456    pub specializes: Option<String>,
457    pub specializes_span: Option<Span>,
458    pub body: ConnectionDefBody,
459}
460
461/// Body of a connection definition: `;` or `{` end/ref/connect* `}`.
462#[derive(Debug, Clone, PartialEq, Eq)]
463pub enum ConnectionDefBody {
464    Semicolon,
465    Brace {
466        elements: Vec<Node<ConnectionDefBodyElement>>,
467    },
468}
469
470#[derive(Debug, Clone, PartialEq, Eq)]
471pub enum ConnectionDefBodyElement {
472    EndDecl(Node<EndDecl>),
473    RefDecl(Node<RefDecl>),
474    ConnectStmt(Node<ConnectStmt>),
475}
476
477// ---------------------------------------------------------------------------
478// Metadata (Phase 2)
479// ---------------------------------------------------------------------------
480
481/// Metadata definition: `metadata def` Identification body (BNF MetadataDefinition).
482#[derive(Debug, Clone, PartialEq, Eq)]
483pub struct MetadataDef {
484    pub is_abstract: bool,
485    pub identification: Identification,
486    pub specializes: Option<String>,
487    pub specializes_span: Option<Span>,
488    pub body: AttributeBody,
489}
490
491/// Metadata usage: `metadata` name (`:` type)? body (BNF MetadataUsage).
492#[derive(Debug, Clone, PartialEq, Eq)]
493pub struct MetadataUsage {
494    pub name: String,
495    pub type_name: Option<String>,
496    pub body: AttributeBody,
497}
498
499// ---------------------------------------------------------------------------
500// Enumeration (Phase 2)
501// ---------------------------------------------------------------------------
502
503/// Enumeration definition: `enum def` Identification EnumerationBody (BNF EnumerationDefinition).
504#[derive(Debug, Clone, PartialEq, Eq)]
505pub struct EnumDef {
506    pub identification: Identification,
507    pub specializes: Option<String>,
508    pub specializes_span: Option<Span>,
509    pub body: EnumerationBody,
510}
511
512#[derive(Debug, Clone, PartialEq, Eq)]
513pub enum EnumerationBody {
514    Semicolon,
515    Brace { values: Vec<String> },
516}
517
518// ---------------------------------------------------------------------------
519// Occurrence (Phase 2)
520// ---------------------------------------------------------------------------
521
522/// Occurrence definition: `occurrence def` Identification body (BNF OccurrenceDefinition).
523#[derive(Debug, Clone, PartialEq, Eq)]
524pub struct OccurrenceDef {
525    pub is_abstract: bool,
526    pub identification: Identification,
527    pub specializes: Option<String>,
528    pub specializes_span: Option<Span>,
529    pub body: DefinitionBody,
530}
531
532/// Occurrence usage: `occurrence` name (`:` type)? body, with optional individual/portion modifiers.
533#[derive(Debug, Clone, PartialEq, Eq)]
534pub struct OccurrenceUsage {
535    pub is_individual: bool,
536    pub is_then: bool,
537    pub portion_kind: Option<String>,
538    pub name: String,
539    pub type_name: Option<String>,
540    pub subsets: Option<String>,
541    pub redefines: Option<String>,
542    pub references: Option<String>,
543    pub crosses: Option<String>,
544    pub body: OccurrenceUsageBody,
545}
546
547#[derive(Debug, Clone, PartialEq, Eq)]
548pub enum OccurrenceUsageBody {
549    Semicolon,
550    Brace {
551        elements: Vec<Node<OccurrenceBodyElement>>,
552    },
553}
554
555/// Occurrence-level assert member: `assert constraint` body.
556#[derive(Debug, Clone, PartialEq, Eq)]
557pub struct AssertConstraintMember {
558    pub body: ConstraintDefBody,
559}
560
561#[derive(Debug, Clone, PartialEq, Eq)]
562#[allow(clippy::large_enum_variant)]
563pub enum OccurrenceBodyElement {
564    Error(Node<ParseErrorNode>),
565    Doc(Node<DocComment>),
566    Annotation(Node<Annotation>),
567    AssertConstraint(Node<AssertConstraintMember>),
568    Other(String),
569    AttributeUsage(Node<AttributeUsage>),
570    PartUsage(Box<Node<PartUsage>>),
571    OccurrenceUsage(Box<Node<OccurrenceUsage>>),
572}
573
574// ---------------------------------------------------------------------------
575// Library Package (Phase 2)
576// ---------------------------------------------------------------------------
577
578/// Generic definition body: `;` or `{` DefinitionBodyElement* `}`.
579#[derive(Debug, Clone, PartialEq, Eq)]
580pub enum DefinitionBody {
581    Semicolon,
582    Brace {
583        elements: Vec<Node<DefinitionBodyElement>>,
584    },
585}
586
587#[derive(Debug, Clone, PartialEq, Eq)]
588#[allow(clippy::large_enum_variant)]
589pub enum DefinitionBodyElement {
590    Error(Node<ParseErrorNode>),
591    Doc(Node<DocComment>),
592    OccurrenceMember(Node<OccurrenceBodyElement>),
593    Other(String),
594}
595// ---------------------------------------------------------------------------
596// Part usage body: bind, interface usage, connect
597// ---------------------------------------------------------------------------
598
599/// Bind: `bind` left `=` right (`;` or `{ }`).
600#[derive(Debug, Clone, PartialEq, Eq)]
601pub struct Bind {
602    pub left: Node<Expression>,
603    pub right: Node<Expression>,
604    /// Optional body after the bind (semicolon or brace); 3a fixture uses `bind x = y { }`.
605    pub body: Option<ConnectBody>,
606}
607
608/// Interface usage: typed+connect or connection form.
609#[derive(Debug, Clone, PartialEq, Eq)]
610pub enum InterfaceUsage {
611    /// `interface` `:Type`? `connect` from `to` to body; optional body with ref redefs.
612    TypedConnect {
613        interface_type: Option<String>,
614        from: Node<Expression>,
615        to: Node<Expression>,
616        body: ConnectBody,
617        body_elements: Vec<Node<InterfaceUsageBodyElement>>,
618    },
619    /// `interface` from `to` to body.
620    Connection {
621        from: Node<Expression>,
622        to: Node<Expression>,
623        body_elements: Vec<Node<InterfaceUsageBodyElement>>,
624    },
625}
626
627/// Element in interface usage body (e.g. ref redefinition).
628#[derive(Debug, Clone, PartialEq, Eq)]
629pub enum InterfaceUsageBodyElement {
630    /// `ref` `:>>` name `=` value body.
631    RefRedef {
632        name: String,
633        value: Node<Expression>,
634        body: RefBody,
635    },
636}
637
638/// Connect at part usage level: `connect` from `to` to body.
639#[derive(Debug, Clone, PartialEq, Eq)]
640pub struct Connect {
641    pub from: Node<Expression>,
642    pub to: Node<Expression>,
643    pub body: ConnectBody,
644}
645
646// ---------------------------------------------------------------------------
647// Alias
648// ---------------------------------------------------------------------------
649
650/// Alias definition: `alias` Identification `for` qualified_name body.
651#[derive(Debug, Clone, PartialEq, Eq)]
652pub struct AliasDef {
653    pub identification: Identification,
654    pub target: String,
655    pub body: AliasBody,
656}
657
658/// Body of an alias definition: `;` or `{` ... `}`.
659#[derive(Debug, Clone, PartialEq, Eq)]
660pub enum AliasBody {
661    Semicolon,
662    Brace,
663}