sv_parser_syntaxtree/expressions/
primaries.rs

1use crate::*;
2
3// -----------------------------------------------------------------------------
4
5#[derive(Clone, Debug, PartialEq, Node)]
6pub enum ConstantPrimary {
7    PrimaryLiteral(Box<PrimaryLiteral>),
8    PsParameter(Box<ConstantPrimaryPsParameter>),
9    Specparam(Box<ConstantPrimarySpecparam>),
10    GenvarIdentifier(Box<GenvarIdentifier>),
11    FormalPort(Box<ConstantPrimaryFormalPort>),
12    Enum(Box<ConstantPrimaryEnum>),
13    Concatenation(Box<ConstantPrimaryConcatenation>),
14    MultipleConcatenation(Box<ConstantPrimaryMultipleConcatenation>),
15    ConstantFunctionCall(Box<ConstantFunctionCall>),
16    ConstantLetExpression(Box<ConstantLetExpression>),
17    MintypmaxExpression(Box<ConstantPrimaryMintypmaxExpression>),
18    ConstantCast(Box<ConstantCast>),
19    ConstantAssignmentPatternExpression(Box<ConstantAssignmentPatternExpression>),
20    TypeReference(Box<TypeReference>),
21    Null(Box<Keyword>),
22    Dollar(Box<Keyword>),
23}
24
25#[derive(Clone, Debug, PartialEq, Node)]
26pub struct ConstantPrimaryPsParameter {
27    pub nodes: (PsParameterIdentifier, ConstantSelect),
28}
29
30#[derive(Clone, Debug, PartialEq, Node)]
31pub struct ConstantPrimarySpecparam {
32    pub nodes: (
33        SpecparamIdentifier,
34        Option<Bracket<ConstantRangeExpression>>,
35    ),
36}
37
38#[derive(Clone, Debug, PartialEq, Node)]
39pub struct ConstantPrimaryFormalPort {
40    pub nodes: (FormalPortIdentifier, ConstantSelect),
41}
42
43#[derive(Clone, Debug, PartialEq, Node)]
44pub struct ConstantPrimaryEnum {
45    pub nodes: (PackageScopeOrClassScope, EnumIdentifier),
46}
47
48#[derive(Clone, Debug, PartialEq, Node)]
49pub struct ConstantPrimaryConcatenation {
50    pub nodes: (
51        ConstantConcatenation,
52        Option<Bracket<ConstantRangeExpression>>,
53    ),
54}
55
56#[derive(Clone, Debug, PartialEq, Node)]
57pub struct ConstantPrimaryMultipleConcatenation {
58    pub nodes: (
59        ConstantMultipleConcatenation,
60        Option<Bracket<ConstantRangeExpression>>,
61    ),
62}
63
64#[derive(Clone, Debug, PartialEq, Node)]
65pub struct ConstantPrimaryMintypmaxExpression {
66    pub nodes: (Paren<ConstantMintypmaxExpression>,),
67}
68
69#[derive(Clone, Debug, PartialEq, Node)]
70pub enum ModulePathPrimary {
71    Number(Box<Number>),
72    Identifier(Box<Identifier>),
73    ModulePathConcatenation(Box<ModulePathConcatenation>),
74    ModulePathMultipleConcatenation(Box<ModulePathMultipleConcatenation>),
75    FunctionSubroutineCall(Box<FunctionSubroutineCall>),
76    Mintypmax(Box<ModulePathPrimaryMintypmax>),
77}
78
79#[derive(Clone, Debug, PartialEq, Node)]
80pub struct ModulePathPrimaryMintypmax {
81    pub nodes: (Paren<ModulePathMintypmaxExpression>,),
82}
83
84#[derive(Clone, Debug, PartialEq, Node)]
85pub enum Primary {
86    PrimaryLiteral(Box<PrimaryLiteral>),
87    Hierarchical(Box<PrimaryHierarchical>),
88    EmptyUnpackedArrayConcatenation(Box<EmptyUnpackedArrayConcatenation>),
89    Concatenation(Box<PrimaryConcatenation>),
90    MultipleConcatenation(Box<PrimaryMultipleConcatenation>),
91    FunctionSubroutineCall(Box<FunctionSubroutineCall>),
92    LetExpression(Box<LetExpression>),
93    MintypmaxExpression(Box<PrimaryMintypmaxExpression>),
94    Cast(Box<Cast>),
95    AssignmentPatternExpression(Box<AssignmentPatternExpression>),
96    StreamingConcatenation(Box<StreamingConcatenation>),
97    SequenceMethodCall(Box<SequenceMethodCall>),
98    This(Box<Keyword>),
99    Dollar(Box<Keyword>),
100    Null(Box<Keyword>),
101}
102
103#[derive(Clone, Debug, PartialEq, Node)]
104pub struct PrimaryHierarchical {
105    pub nodes: (
106        Option<ClassQualifierOrPackageScope>,
107        HierarchicalIdentifier,
108        Select,
109    ),
110}
111
112#[derive(Clone, Debug, PartialEq, Node)]
113pub struct PrimaryConcatenation {
114    pub nodes: (Concatenation, Option<Bracket<RangeExpression>>),
115}
116
117#[derive(Clone, Debug, PartialEq, Node)]
118pub struct PrimaryMultipleConcatenation {
119    pub nodes: (MultipleConcatenation, Option<Bracket<RangeExpression>>),
120}
121
122#[derive(Clone, Debug, PartialEq, Node)]
123pub struct PrimaryMintypmaxExpression {
124    pub nodes: (Paren<MintypmaxExpression>,),
125}
126
127#[derive(Clone, Debug, PartialEq, Node)]
128pub enum ClassQualifierOrPackageScope {
129    ClassQualifier(Box<ClassQualifier>),
130    PackageScope(Box<PackageScope>),
131}
132
133#[derive(Clone, Debug, PartialEq, Node)]
134pub struct ClassQualifier {
135    pub nodes: (Option<Local>, Option<ImplicitClassHandleOrClassScope>),
136}
137
138#[derive(Clone, Debug, PartialEq, Node)]
139pub enum RangeExpression {
140    Expression(Box<Expression>),
141    PartSelectRange(Box<PartSelectRange>),
142}
143
144#[derive(Clone, Debug, PartialEq, Node)]
145pub enum PrimaryLiteral {
146    Number(Box<Number>),
147    TimeLiteral(Box<TimeLiteral>),
148    UnbasedUnsizedLiteral(Box<UnbasedUnsizedLiteral>),
149    StringLiteral(Box<StringLiteral>),
150}
151
152#[derive(Clone, Debug, PartialEq, Node)]
153pub enum TimeLiteral {
154    Unsigned(Box<TimeLiteralUnsigned>),
155    FixedPoint(Box<TimeLiteralFixedPoint>),
156}
157
158#[derive(Clone, Debug, PartialEq, Node)]
159pub struct TimeLiteralUnsigned {
160    pub nodes: (UnsignedNumber, TimeUnit),
161}
162
163#[derive(Clone, Debug, PartialEq, Node)]
164pub struct TimeLiteralFixedPoint {
165    pub nodes: (FixedPointNumber, TimeUnit),
166}
167
168#[derive(Clone, Debug, PartialEq, Node)]
169pub enum TimeUnit {
170    S(Box<Keyword>),
171    MS(Box<Keyword>),
172    US(Box<Keyword>),
173    NS(Box<Keyword>),
174    PS(Box<Keyword>),
175    FS(Box<Keyword>),
176}
177
178#[derive(Clone, Debug, PartialEq, Node)]
179pub enum ImplicitClassHandle {
180    This(Box<Keyword>),
181    Super(Box<Keyword>),
182    ThisSuper(Box<(Keyword, Symbol, Keyword)>),
183}
184
185#[derive(Clone, Debug, PartialEq, Node)]
186pub struct BitSelect {
187    pub nodes: (Vec<Bracket<Expression>>,),
188}
189
190#[derive(Clone, Debug, PartialEq, Node)]
191pub struct Select {
192    pub nodes: (
193        Option<(
194            Vec<(Symbol, MemberIdentifier, BitSelect)>,
195            Symbol,
196            MemberIdentifier,
197        )>,
198        BitSelect,
199        Option<Bracket<PartSelectRange>>,
200    ),
201}
202
203#[derive(Clone, Debug, PartialEq, Node)]
204pub struct NonrangeSelect {
205    pub nodes: (
206        Option<(
207            Vec<(Symbol, MemberIdentifier, BitSelect)>,
208            Symbol,
209            MemberIdentifier,
210        )>,
211        BitSelect,
212    ),
213}
214
215#[derive(Clone, Debug, PartialEq, Node)]
216pub struct ConstantBitSelect {
217    pub nodes: (Vec<Bracket<ConstantExpression>>,),
218}
219
220#[derive(Clone, Debug, PartialEq, Node)]
221pub struct ConstantSelect {
222    pub nodes: (
223        Option<(
224            Vec<(Symbol, MemberIdentifier, ConstantBitSelect)>,
225            Symbol,
226            MemberIdentifier,
227        )>,
228        ConstantBitSelect,
229        Option<Bracket<ConstantPartSelectRange>>,
230    ),
231}
232
233#[derive(Clone, Debug, PartialEq, Node)]
234pub struct ConstantCast {
235    pub nodes: (CastingType, Symbol, Paren<ConstantExpression>),
236}
237
238#[derive(Clone, Debug, PartialEq, Node)]
239pub struct ConstantLetExpression {
240    pub nodes: (LetExpression,),
241}
242
243#[derive(Clone, Debug, PartialEq, Node)]
244pub struct Cast {
245    pub nodes: (CastingType, Symbol, Paren<Expression>),
246}