@@ -537,6 +537,7 @@ int yyverilogerror(const char *error)
537
537
/* Others */
538
538
%token TOK_ENDOFFILE
539
539
%token TOK_NON_TYPE_IDENTIFIER
540
+ %token TOK_CLASS_IDENTIFIER
540
541
%token TOK_PACKAGE_IDENTIFIER
541
542
%token TOK_TYPE_IDENTIFIER
542
543
%token TOK_NUMBER // number , any base
@@ -819,12 +820,13 @@ checker_port_direction_opt:
819
820
;
820
821
821
822
class_declaration:
822
- TOK_CLASS class_identifier
823
+ TOK_CLASS any_identifier
823
824
' ;'
824
825
{
825
826
init ($$, ID_verilog_class);
826
- stack_expr ($$).set (ID_base_name, stack_expr ($2 ).id ());
827
- push_scope (stack_expr ($2 ).id (), " ::" , verilog_scopet::CLASS);
827
+ auto base_name = stack_expr ($2 ).get (ID_base_name);
828
+ stack_expr ($$).set (ID_base_name, base_name);
829
+ push_scope (base_name, " ::" , verilog_scopet::CLASS);
828
830
}
829
831
class_item_brace
830
832
TOK_ENDCLASS
@@ -1550,7 +1552,7 @@ data_type:
1550
1552
{ stack_expr ($1 ).id (ID_typedef_type);
1551
1553
add_as_subtype (stack_type ($2 ), stack_type ($1 ));
1552
1554
$$ = $2 ; }
1553
- // | class_type
1555
+ | class_type
1554
1556
| TOK_EVENT
1555
1557
{ init ($$, ID_verilog_event); }
1556
1558
/*
@@ -4380,7 +4382,14 @@ non_type_identifier: TOK_NON_TYPE_IDENTIFIER
4380
4382
4381
4383
block_identifier: TOK_NON_TYPE_IDENTIFIER;
4382
4384
4383
- class_identifier: TOK_NON_TYPE_IDENTIFIER;
4385
+ class_identifier: TOK_CLASS_IDENTIFIER
4386
+ {
4387
+ init ($$, ID_verilog_class_type);
4388
+ auto base_name = stack_expr ($1 ).id ();
4389
+ stack_expr ($$).set (ID_base_name, base_name);
4390
+ stack_expr ($$).set (ID_identifier, PARSER.scopes .current_scope ().prefix +id2string (base_name));
4391
+ }
4392
+ ;
4384
4393
4385
4394
constraint_identifier: TOK_NON_TYPE_IDENTIFIER;
4386
4395
0 commit comments