28
28
#define mts (x, y ) stack_expr(x).move_to_sub((irept &)stack_expr(y))
29
29
#define swapop (x, y ) stack_expr(x).operands().swap(stack_expr(y).operands())
30
30
#define addswap (x, y, z ) stack_expr(x).add(y).swap(stack_expr(z))
31
- #define push_scope (x, y ) PARSER.scopes.push_scope(x, y )
31
+ #define push_scope (name, separator, kind ) PARSER.scopes.push_scope(name, separator, kind )
32
32
#define pop_scope () PARSER.scopes.pop_scope();
33
33
34
34
int yyveriloglex ();
@@ -644,7 +644,7 @@ module_identifier_with_scope:
644
644
module_identifier
645
645
{
646
646
$$ = $1 ;
647
- push_scope (stack_expr($1 ).id(), ".");
647
+ push_scope (stack_expr($1 ).id(), ".", verilog_scopet::MODULE );
648
648
}
649
649
;
650
650
@@ -823,7 +823,7 @@ class_declaration:
823
823
{
824
824
init ($$, ID_verilog_class);
825
825
stack_expr ($$).set (ID_base_name, stack_expr ($2 ).id ());
826
- push_scope (stack_expr ($2 ).id (), " ::" );
826
+ push_scope (stack_expr ($2 ).id (), " ::" , verilog_scopet::CLASS );
827
827
}
828
828
class_item_brace
829
829
TOK_ENDCLASS
@@ -839,7 +839,7 @@ package_declaration:
839
839
lifetime_opt
840
840
package_identifier ' ;'
841
841
{
842
- push_scope (stack_expr ($5 ).id (), " ::" );
842
+ push_scope (stack_expr ($5 ).id (), " ::" , verilog_scopet::PACKAGE );
843
843
}
844
844
timeunits_declaration_opt
845
845
package_item_brace
@@ -1447,7 +1447,7 @@ type_declaration:
1447
1447
data_type any_identifier ' ;'
1448
1448
{ $$ = $2 ;
1449
1449
// add to the scope as a type name
1450
- auto &name = PARSER.scopes .add_name (stack_expr ($4 ).get (ID_identifier), " " );
1450
+ auto &name = PARSER.scopes .add_name (stack_expr ($4 ).get (ID_identifier), " " , verilog_scopet::TYPEDEF );
1451
1451
name.is_type = true ;
1452
1452
addswap ($$, ID_type, $3 );
1453
1453
stack_expr ($4 ).id (ID_declarator);
@@ -1571,7 +1571,7 @@ enum_name_declaration:
1571
1571
TOK_NON_TYPE_IDENTIFIER enum_name_value_opt
1572
1572
{
1573
1573
init ($$);
1574
- auto &scope = PARSER.scopes .add_name (stack_expr ($1 ).id (), " " );
1574
+ auto &scope = PARSER.scopes .add_name (stack_expr ($1 ).id (), " " , verilog_scopet::ENUM_NAME );
1575
1575
stack_expr ($$).set (ID_base_name, scope.base_name ());
1576
1576
stack_expr ($$).set (ID_identifier, scope.identifier ());
1577
1577
stack_expr ($$).add (ID_value).swap (stack_expr ($2 ));
@@ -2139,7 +2139,7 @@ function_declaration: TOK_FUNCTION lifetime_opt function_body_declaration
2139
2139
function_body_declaration:
2140
2140
function_data_type_or_implicit
2141
2141
function_identifier
2142
- { push_scope (stack_expr ($2 ).get (ID_identifier), " ." ); }
2142
+ { push_scope (stack_expr ($2 ).get (ID_identifier), " ." , verilog_scopet::FUNCTION ); }
2143
2143
' ;'
2144
2144
tf_item_declaration_brace statement
2145
2145
TOK_ENDFUNCTION
@@ -2154,7 +2154,7 @@ function_body_declaration:
2154
2154
}
2155
2155
| function_data_type_or_implicit
2156
2156
function_identifier
2157
- { push_scope (stack_expr ($2 ).get (ID_identifier), " ." ); }
2157
+ { push_scope (stack_expr ($2 ).get (ID_identifier), " ." , verilog_scopet::FUNCTION ); }
2158
2158
' (' tf_port_list_opt ' )' ' ;'
2159
2159
tf_item_declaration_brace statement
2160
2160
TOK_ENDFUNCTION
@@ -2195,7 +2195,7 @@ function_prototype: TOK_FUNCTION data_type_or_void function_identifier
2195
2195
2196
2196
task_declaration:
2197
2197
TOK_TASK task_identifier
2198
- { push_scope (stack_expr ($2 ).get (ID_identifier), " ." ); }
2198
+ { push_scope (stack_expr ($2 ).get (ID_identifier), " ." , verilog_scopet::TASK ); }
2199
2199
' ;'
2200
2200
tf_item_declaration_brace
2201
2201
statement_or_null TOK_ENDTASK
@@ -2207,7 +2207,7 @@ task_declaration:
2207
2207
pop_scope ();
2208
2208
}
2209
2209
| TOK_TASK task_identifier
2210
- { push_scope (stack_expr ($2 ).get (ID_identifier), " ." ); }
2210
+ { push_scope (stack_expr ($2 ).get (ID_identifier), " ." , verilog_scopet::TASK ); }
2211
2211
' (' tf_port_list_opt ' )' ' ;'
2212
2212
tf_item_declaration_brace
2213
2213
statement_or_null TOK_ENDTASK
@@ -3387,7 +3387,7 @@ seq_block:
3387
3387
TOK_END
3388
3388
{ init ($$, ID_block); swapop ($$, $2 ); }
3389
3389
| TOK_BEGIN TOK_COLON block_identifier
3390
- { push_scope (stack_expr ($3 ).id (), " ." ); }
3390
+ { push_scope (stack_expr ($3 ).id (), " ." , verilog_scopet::BLOCK ); }
3391
3391
block_item_declaration_or_statement_or_null_brace
3392
3392
TOK_END
3393
3393
{ init ($$, ID_block);
0 commit comments