sv_parser_syntaxtree/expressions/
subroutine_calls.rs

1use crate::*;
2
3// -----------------------------------------------------------------------------
4
5#[derive(Clone, Debug, PartialEq, Node)]
6pub struct ConstantFunctionCall {
7    pub nodes: (FunctionSubroutineCall,),
8}
9
10#[derive(Clone, Debug, PartialEq, Node)]
11pub struct TfCall {
12    pub nodes: (
13        PsOrHierarchicalTfIdentifier,
14        Vec<AttributeInstance>,
15        Option<Paren<ListOfArguments>>,
16    ),
17}
18
19#[derive(Clone, Debug, PartialEq, Node)]
20pub enum SystemTfCall {
21    ArgOptionl(Box<SystemTfCallArgOptional>),
22    ArgDataType(Box<SystemTfCallArgDataType>),
23    ArgExpression(Box<SystemTfCallArgExpression>),
24}
25
26#[derive(Clone, Debug, PartialEq, Node)]
27pub struct SystemTfCallArgOptional {
28    pub nodes: (SystemTfIdentifier, Option<Paren<ListOfArguments>>),
29}
30
31#[derive(Clone, Debug, PartialEq, Node)]
32pub struct SystemTfCallArgDataType {
33    pub nodes: (
34        SystemTfIdentifier,
35        Paren<(DataType, Option<(Symbol, Expression)>)>,
36    ),
37}
38
39#[derive(Clone, Debug, PartialEq, Node)]
40pub struct SystemTfCallArgExpression {
41    pub nodes: (
42        SystemTfIdentifier,
43        Paren<(
44            List<Symbol, Option<Expression>>,
45            Option<(Symbol, Option<ClockingEvent>)>,
46        )>,
47    ),
48}
49
50#[derive(Clone, Debug, PartialEq, Node)]
51pub enum SubroutineCall {
52    TfCall(Box<TfCall>),
53    SystemTfCall(Box<SystemTfCall>),
54    MethodCall(Box<MethodCall>),
55    Randomize(Box<SubroutineCallRandomize>),
56}
57
58#[derive(Clone, Debug, PartialEq, Node)]
59pub struct SubroutineCallRandomize {
60    pub nodes: (Option<(Keyword, Symbol)>, RandomizeCall),
61}
62
63#[derive(Clone, Debug, PartialEq, Node)]
64pub struct FunctionSubroutineCall {
65    pub nodes: (SubroutineCall,),
66}
67
68#[derive(Clone, Debug, PartialEq, Node)]
69pub enum ListOfArguments {
70    Ordered(Box<ListOfArgumentsOrdered>),
71    Named(Box<ListOfArgumentsNamed>),
72}
73
74#[derive(Clone, Debug, PartialEq, Node)]
75pub struct ListOfArgumentsOrdered {
76    pub nodes: (
77        List<Symbol, Option<Expression>>,
78        Vec<(Symbol, Symbol, Identifier, Paren<Option<Expression>>)>,
79    ),
80}
81
82#[derive(Clone, Debug, PartialEq, Node)]
83pub struct ListOfArgumentsNamed {
84    pub nodes: (
85        Symbol,
86        Identifier,
87        Paren<Option<Expression>>,
88        Vec<(Symbol, Symbol, Identifier, Paren<Option<Expression>>)>,
89    ),
90}
91
92#[derive(Clone, Debug, PartialEq, Node)]
93pub struct MethodCall {
94    pub nodes: (MethodCallRoot, Symbol, MethodCallBody),
95}
96
97#[derive(Clone, Debug, PartialEq, Node)]
98pub enum MethodCallBody {
99    User(Box<MethodCallBodyUser>),
100    BuiltInMethodCall(Box<BuiltInMethodCall>),
101}
102
103#[derive(Clone, Debug, PartialEq, Node)]
104pub struct MethodCallBodyUser {
105    pub nodes: (
106        MethodIdentifier,
107        Vec<AttributeInstance>,
108        Option<Paren<ListOfArguments>>,
109    ),
110}
111
112#[derive(Clone, Debug, PartialEq, Node)]
113pub enum BuiltInMethodCall {
114    ArrayManipulationCall(Box<ArrayManipulationCall>),
115    RandomizeCall(Box<RandomizeCall>),
116}
117
118#[derive(Clone, Debug, PartialEq, Node)]
119pub struct ArrayManipulationCall {
120    pub nodes: (
121        ArrayMethodName,
122        Vec<AttributeInstance>,
123        Option<Paren<ListOfArguments>>,
124        Option<(Keyword, Paren<Expression>)>,
125    ),
126}
127
128#[derive(Clone, Debug, PartialEq, Node)]
129pub struct RandomizeCall {
130    pub nodes: (
131        Keyword,
132        Vec<AttributeInstance>,
133        Option<Paren<Option<VariableIdentifierListOrNull>>>,
134        Option<(
135            Keyword,
136            Option<Paren<Option<IdentifierList>>>,
137            ConstraintBlock,
138        )>,
139    ),
140}
141
142#[derive(Clone, Debug, PartialEq, Node)]
143pub enum VariableIdentifierListOrNull {
144    VariableIdentifierList(Box<VariableIdentifierList>),
145    Null(Box<Keyword>),
146}
147
148#[derive(Clone, Debug, PartialEq, Node)]
149pub enum MethodCallRoot {
150    Primary(Box<Primary>),
151    ImplicitClassHandle(Box<ImplicitClassHandle>),
152}
153
154#[derive(Clone, Debug, PartialEq, Node)]
155pub enum ArrayMethodName {
156    MethodIdentifier(Box<MethodIdentifier>),
157    Unique(Box<Keyword>),
158    And(Box<Keyword>),
159    Or(Box<Keyword>),
160    Xor(Box<Keyword>),
161}