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