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