@@ -176,7 +176,6 @@ def prod(f):
176176@prod
177177def device (t ):
178178 'dml : DEVICE objident SEMI maybe_bitorder device_statements'
179- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
180179 t [0 ] = ast .dml (site (t ), t [2 ], t [5 ])
181180
182181# Entry point for imported files
@@ -291,7 +290,6 @@ def array_list(t):
291290@prod
292291def object_regarray (t ):
293292 'object : REGISTER objident array_list sizespec offsetspec maybe_istemplate object_spec'
294- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
295293 t [0 ] = ast .object_ (site (t ), t [2 ], 'register' , t [3 ],
296294 t [4 ] + t [5 ] + t [6 ] + t [7 ])
297295
@@ -308,7 +306,6 @@ def bitrangespec_empty(t):
308306@prod_dml14
309307def object_field (t ):
310308 'object : FIELD objident array_list bitrangespec maybe_istemplate object_spec'
311- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
312309 t [0 ] = ast .object_ (site (t ), t [2 ], 'field' , t [3 ], t [4 ] + t [5 ] + t [6 ])
313310
314311def endian_translate_bit (expr , width , bitorder ):
@@ -457,13 +454,11 @@ def object3(t):
457454 | GROUP objident array_list maybe_istemplate object_spec
458455 | PORT objident array_list maybe_istemplate object_spec
459456 | IMPLEMENT objident array_list maybe_istemplate object_spec'''
460- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
461457 t [0 ] = ast .object_ (site (t ), t [2 ], t [1 ], t [3 ], t [4 ] + t [5 ])
462458
463459@prod_dml14
464460def object_subdevice (t ):
465461 '''object : SUBDEVICE objident array_list maybe_istemplate object_spec'''
466- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
467462 t [0 ] = ast .object_ (site (t ), t [2 ], t [1 ], t [3 ], t [4 ] + t [5 ])
468463
469464@prod_dml12
@@ -587,7 +582,6 @@ def method_qualifiers_check(site, qualifiers, inp, outp, throws, default):
587582def object_method (t ):
588583 '''method : method_qualifiers METHOD objident method_params_typed maybe_default compound_statement'''
589584 name = t [3 ]
590- ident_enforce_not_discard_ref (site (t , 3 ), name )
591585 (inp , outp , throws ) = t [4 ]
592586 body = t [6 ]
593587 (inp , outp ) = method_qualifiers_check (site (t ), t [1 ], inp , outp , throws ,
@@ -600,7 +594,6 @@ def object_method(t):
600594def object_inline_method (t ):
601595 '''method : INLINE METHOD objident method_params_maybe_untyped maybe_default compound_statement'''
602596 name = t [3 ]
603- ident_enforce_not_discard_ref (site (t , 3 ), name )
604597 (inp , outp , throws ) = t [4 ]
605598 if all (typ for (_ , asite , name , typ ) in inp ):
606599 # inline annotation would have no effect for fully typed methods.
@@ -649,13 +642,11 @@ def arraydef2(t):
649642@prod_dml14
650643def arraydef (t ):
651644 '''arraydef : ident LT expression'''
652- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
653645 t [0 ] = (t [1 ], t [3 ])
654646
655647@prod_dml14
656648def arraydef_implicit (t ):
657649 '''arraydef : ident LT ELLIPSIS'''
658- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
659650 t [0 ] = (t [1 ], None )
660651
661652# Traits
@@ -754,18 +745,15 @@ def trait_method(t):
754745@prod
755746def shared_method_abstract (t ):
756747 '''shared_method : ident method_params_typed SEMI'''
757- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
758748 t [0 ] = (t [1 ], t [2 ], True , None , site (t , 3 ))
759749@prod
760750def shared_method_default (t ):
761751 '''shared_method : ident method_params_typed DEFAULT compound_statement'''
762- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
763752 t [0 ] = (t [1 ], t [2 ], True , t [4 ], lex_end_site (t , - 1 ))
764753
765754@prod
766755def shared_method_final (t ):
767756 '''shared_method : ident method_params_typed compound_statement'''
768- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
769757 t [0 ] = (t [1 ], t [2 ], False , t [3 ], lex_end_site (t , - 1 ))
770758
771759@prod_dml12
@@ -796,7 +784,6 @@ def template(t):
796784@prod_dml14
797785def template (t ):
798786 'toplevel : TEMPLATE objident maybe_istemplate LBRACE template_stmts RBRACE'
799- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
800787 ises = [s for s in t [5 ] if s .kind == 'is' ]
801788 shared_methods = [s for s in t [5 ] if s .kind == 'sharedmethod' ]
802789 if ises and shared_methods :
@@ -825,15 +812,13 @@ def impl_header(t):
825812@prod
826813def loggroup (t ):
827814 'toplevel : LOGGROUP ident SEMI'
828- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
829815 t [0 ] = ast .loggroup (site (t ), t [2 ])
830816
831817# constant/extern
832818
833819@prod
834820def constant (t ):
835821 'toplevel : CONSTANT ident EQUALS expression SEMI'
836- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
837822 t [0 ] = ast .constant (site (t ), t [2 ], t [4 ])
838823 if logging .show_porting :
839824 report (PCONSTANT (site (t )))
@@ -1034,7 +1019,6 @@ def object_else_if(t):
10341019@prod
10351020def object_parameter (t ):
10361021 '''parameter : param_ objident paramspec'''
1037- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
10381022 if logging .show_porting :
10391023 if t [2 ] == 'hard_reset_value' :
10401024 report (PHARD_RESET_VALUE (site (t , 2 )))
@@ -1047,7 +1031,6 @@ def object_parameter(t):
10471031@prod_dml14
10481032def object_typedparam (t ):
10491033 '''parameter : param_ objident COLON ctypedecl SEMI'''
1050- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
10511034 t [0 ] = ast .typedparam (site (t ), site (t , 2 ), t [2 ], t [4 ])
10521035
10531036@prod
@@ -1224,7 +1207,6 @@ def cdecl_or_ident_decl(t):
12241207@prod_dml14
12251208def cdecl_or_ident_inline (t ):
12261209 '''cdecl_or_ident : INLINE ident'''
1227- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
12281210 t [0 ] = ast .cdecl (site (t ), t [2 ], None )
12291211
12301212# A C-like declaration with required identifier name
@@ -1327,7 +1309,6 @@ def cdecl3(t):
13271309@prod_dml14
13281310def cdecl3 (t ):
13291311 'cdecl3 : ident'
1330- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
13311312 t [0 ] = [t [1 ]]
13321313
13331314@prod
@@ -2230,7 +2211,6 @@ def ident_list_nonempty(t):
22302211@prod_dml14
22312212def ident_list_one (t ):
22322213 'nonempty_ident_list : ident'
2233- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
22342214 t [0 ] = [(site (t , 1 ), t [1 ])]
22352215
22362216@prod_dml14
@@ -2246,7 +2226,6 @@ def statement_delay_hook(t):
22462226@prod_dml14
22472227def statement_delay_hook_one_msg_param (t ):
22482228 'statement_except_hashif : AFTER expression ARROW ident COLON expression SEMI %prec bind'
2249- ident_enforce_not_discard_ref (site (t , 4 ), t [4 ])
22502229 t [0 ] = ast .afteronhook (site (t ), t [2 ], [(site (t , 4 ), t [4 ])], t [6 ])
22512230
22522231
@@ -2371,27 +2350,23 @@ def hashselect(t):
23712350@prod
23722351def select (t ):
23732352 'statement_except_hashif : hashselect ident IN LPAREN expression RPAREN WHERE LPAREN expression RPAREN statement hashelse statement'
2374- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
23752353 t [0 ] = ast .select (site (t ), t [2 ], t [5 ], t [9 ], t [11 ], t [13 ])
23762354
23772355@prod_dml12
23782356def foreach (t ):
23792357 'statement_except_hashif : FOREACH ident IN LPAREN expression RPAREN statement'
2380- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
23812358 t [0 ] = ast .foreach_dml12 (site (t ), t [2 ], t [5 ], t [7 ])
23822359 if logging .show_porting :
23832360 report (PHASH (site (t )))
23842361
23852362@prod_dml14
23862363def foreach (t ):
23872364 'statement_except_hashif : FOREACH ident IN LPAREN expression RPAREN statement'
2388- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
23892365 t [0 ] = ast .foreach (site (t ), t [2 ], t [5 ], t [7 ])
23902366
23912367@prod_dml14
23922368def hashforeach (t ):
23932369 'statement_except_hashif : HASHFOREACH ident IN LPAREN expression RPAREN statement'
2394- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
23952370 t [0 ] = ast .hashforeach (site (t ), t [2 ], t [5 ], t [7 ])
23962371
23972372@prod_dml12
@@ -2422,7 +2397,6 @@ def case_statement_default(t):
24222397@prod_dml14
24232398def goto_statement (t ):
24242399 'statement_except_hashif : GOTO ident SEMI'
2425- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
24262400 # Restricted goto should be implemented, see SIMICS-6130
24272401 report (ESYNTAX (site (t ), 'goto' ,
24282402 'goto statements are not yet implemented in DML 1.4' ))
@@ -2599,7 +2573,6 @@ def simple_array_list(t):
25992573@prod_dml14
26002574def hook_decl (t ):
26012575 '''hook_decl : HOOK LPAREN cdecl_list RPAREN ident simple_array_list SEMI'''
2602- ident_enforce_not_discard_ref (site (t , 5 ), t [5 ])
26032576 cdecl_list_enforce_unnamed (t [3 ])
26042577 if t [6 ]:
26052578 # Hook arrays are an internal feature, as their design depends on if we
@@ -2665,11 +2638,6 @@ def ident(t):
26652638def ident (t ):
26662639 t [0 ] = t [1 ]
26672640
2668- def ident_enforce_not_discard_ref (site , ident ):
2669- if (str (ident ) == '_'
2670- and site .dml_version () != (1 , 2 )
2671- and compat .discard_ref_shadowing not in dml .globals .enabled_compat ):
2672- report (ESYNTAX (site , '_' , "reserved identifier" ))
26732641@prod_dml14
26742642@lex .TOKEN (ident_rule ('ident_or_underscore' ,
26752643 dmllex14 .reserved_idents + ('ID' , '_' )))
0 commit comments