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