@@ -176,7 +176,6 @@ def prod(f):
176
176
@prod
177
177
def device (t ):
178
178
'dml : DEVICE objident SEMI maybe_bitorder device_statements'
179
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
180
179
t [0 ] = ast .dml (site (t ), t [2 ], t [5 ])
181
180
182
181
# Entry point for imported files
@@ -291,7 +290,6 @@ def array_list(t):
291
290
@prod
292
291
def object_regarray (t ):
293
292
'object : REGISTER objident array_list sizespec offsetspec maybe_istemplate object_spec'
294
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
295
293
t [0 ] = ast .object_ (site (t ), t [2 ], 'register' , t [3 ],
296
294
t [4 ] + t [5 ] + t [6 ] + t [7 ])
297
295
@@ -308,7 +306,6 @@ def bitrangespec_empty(t):
308
306
@prod_dml14
309
307
def object_field (t ):
310
308
'object : FIELD objident array_list bitrangespec maybe_istemplate object_spec'
311
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
312
309
t [0 ] = ast .object_ (site (t ), t [2 ], 'field' , t [3 ], t [4 ] + t [5 ] + t [6 ])
313
310
314
311
def endian_translate_bit (expr , width , bitorder ):
@@ -457,13 +454,11 @@ def object3(t):
457
454
| GROUP objident array_list maybe_istemplate object_spec
458
455
| PORT objident array_list maybe_istemplate object_spec
459
456
| IMPLEMENT objident array_list maybe_istemplate object_spec'''
460
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
461
457
t [0 ] = ast .object_ (site (t ), t [2 ], t [1 ], t [3 ], t [4 ] + t [5 ])
462
458
463
459
@prod_dml14
464
460
def object_subdevice (t ):
465
461
'''object : SUBDEVICE objident array_list maybe_istemplate object_spec'''
466
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
467
462
t [0 ] = ast .object_ (site (t ), t [2 ], t [1 ], t [3 ], t [4 ] + t [5 ])
468
463
469
464
@prod_dml12
@@ -587,7 +582,6 @@ def method_qualifiers_check(site, qualifiers, inp, outp, throws, default):
587
582
def object_method (t ):
588
583
'''method : method_qualifiers METHOD objident method_params_typed maybe_default compound_statement'''
589
584
name = t [3 ]
590
- ident_enforce_not_discard_ref (site (t , 3 ), name )
591
585
(inp , outp , throws ) = t [4 ]
592
586
body = t [6 ]
593
587
(inp , outp ) = method_qualifiers_check (site (t ), t [1 ], inp , outp , throws ,
@@ -600,7 +594,6 @@ def object_method(t):
600
594
def object_inline_method (t ):
601
595
'''method : INLINE METHOD objident method_params_maybe_untyped maybe_default compound_statement'''
602
596
name = t [3 ]
603
- ident_enforce_not_discard_ref (site (t , 3 ), name )
604
597
(inp , outp , throws ) = t [4 ]
605
598
if all (typ for (_ , asite , name , typ ) in inp ):
606
599
# inline annotation would have no effect for fully typed methods.
@@ -649,13 +642,11 @@ def arraydef2(t):
649
642
@prod_dml14
650
643
def arraydef (t ):
651
644
'''arraydef : ident LT expression'''
652
- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
653
645
t [0 ] = (t [1 ], t [3 ])
654
646
655
647
@prod_dml14
656
648
def arraydef_implicit (t ):
657
649
'''arraydef : ident LT ELLIPSIS'''
658
- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
659
650
t [0 ] = (t [1 ], None )
660
651
661
652
# Traits
@@ -754,18 +745,15 @@ def trait_method(t):
754
745
@prod
755
746
def shared_method_abstract (t ):
756
747
'''shared_method : ident method_params_typed SEMI'''
757
- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
758
748
t [0 ] = (t [1 ], t [2 ], True , None , site (t , 3 ))
759
749
@prod
760
750
def shared_method_default (t ):
761
751
'''shared_method : ident method_params_typed DEFAULT compound_statement'''
762
- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
763
752
t [0 ] = (t [1 ], t [2 ], True , t [4 ], lex_end_site (t , - 1 ))
764
753
765
754
@prod
766
755
def shared_method_final (t ):
767
756
'''shared_method : ident method_params_typed compound_statement'''
768
- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
769
757
t [0 ] = (t [1 ], t [2 ], False , t [3 ], lex_end_site (t , - 1 ))
770
758
771
759
@prod_dml12
@@ -796,7 +784,6 @@ def template(t):
796
784
@prod_dml14
797
785
def template (t ):
798
786
'toplevel : TEMPLATE objident maybe_istemplate LBRACE template_stmts RBRACE'
799
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
800
787
ises = [s for s in t [5 ] if s .kind == 'is' ]
801
788
shared_methods = [s for s in t [5 ] if s .kind == 'sharedmethod' ]
802
789
if ises and shared_methods :
@@ -825,15 +812,13 @@ def impl_header(t):
825
812
@prod
826
813
def loggroup (t ):
827
814
'toplevel : LOGGROUP ident SEMI'
828
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
829
815
t [0 ] = ast .loggroup (site (t ), t [2 ])
830
816
831
817
# constant/extern
832
818
833
819
@prod
834
820
def constant (t ):
835
821
'toplevel : CONSTANT ident EQUALS expression SEMI'
836
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
837
822
t [0 ] = ast .constant (site (t ), t [2 ], t [4 ])
838
823
if logging .show_porting :
839
824
report (PCONSTANT (site (t )))
@@ -1034,7 +1019,6 @@ def object_else_if(t):
1034
1019
@prod
1035
1020
def object_parameter (t ):
1036
1021
'''parameter : param_ objident paramspec'''
1037
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
1038
1022
if logging .show_porting :
1039
1023
if t [2 ] == 'hard_reset_value' :
1040
1024
report (PHARD_RESET_VALUE (site (t , 2 )))
@@ -1047,7 +1031,6 @@ def object_parameter(t):
1047
1031
@prod_dml14
1048
1032
def object_typedparam (t ):
1049
1033
'''parameter : param_ objident COLON ctypedecl SEMI'''
1050
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
1051
1034
t [0 ] = ast .typedparam (site (t ), site (t , 2 ), t [2 ], t [4 ])
1052
1035
1053
1036
@prod
@@ -1224,7 +1207,6 @@ def cdecl_or_ident_decl(t):
1224
1207
@prod_dml14
1225
1208
def cdecl_or_ident_inline (t ):
1226
1209
'''cdecl_or_ident : INLINE ident'''
1227
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
1228
1210
t [0 ] = ast .cdecl (site (t ), t [2 ], None )
1229
1211
1230
1212
# A C-like declaration with required identifier name
@@ -1327,7 +1309,6 @@ def cdecl3(t):
1327
1309
@prod_dml14
1328
1310
def cdecl3 (t ):
1329
1311
'cdecl3 : ident'
1330
- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
1331
1312
t [0 ] = [t [1 ]]
1332
1313
1333
1314
@prod
@@ -2230,7 +2211,6 @@ def ident_list_nonempty(t):
2230
2211
@prod_dml14
2231
2212
def ident_list_one (t ):
2232
2213
'nonempty_ident_list : ident'
2233
- ident_enforce_not_discard_ref (site (t , 1 ), t [1 ])
2234
2214
t [0 ] = [(site (t , 1 ), t [1 ])]
2235
2215
2236
2216
@prod_dml14
@@ -2246,7 +2226,6 @@ def statement_delay_hook(t):
2246
2226
@prod_dml14
2247
2227
def statement_delay_hook_one_msg_param (t ):
2248
2228
'statement_except_hashif : AFTER expression ARROW ident COLON expression SEMI %prec bind'
2249
- ident_enforce_not_discard_ref (site (t , 4 ), t [4 ])
2250
2229
t [0 ] = ast .afteronhook (site (t ), t [2 ], [(site (t , 4 ), t [4 ])], t [6 ])
2251
2230
2252
2231
@@ -2371,27 +2350,23 @@ def hashselect(t):
2371
2350
@prod
2372
2351
def select (t ):
2373
2352
'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 ])
2375
2353
t [0 ] = ast .select (site (t ), t [2 ], t [5 ], t [9 ], t [11 ], t [13 ])
2376
2354
2377
2355
@prod_dml12
2378
2356
def foreach (t ):
2379
2357
'statement_except_hashif : FOREACH ident IN LPAREN expression RPAREN statement'
2380
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
2381
2358
t [0 ] = ast .foreach_dml12 (site (t ), t [2 ], t [5 ], t [7 ])
2382
2359
if logging .show_porting :
2383
2360
report (PHASH (site (t )))
2384
2361
2385
2362
@prod_dml14
2386
2363
def foreach (t ):
2387
2364
'statement_except_hashif : FOREACH ident IN LPAREN expression RPAREN statement'
2388
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
2389
2365
t [0 ] = ast .foreach (site (t ), t [2 ], t [5 ], t [7 ])
2390
2366
2391
2367
@prod_dml14
2392
2368
def hashforeach (t ):
2393
2369
'statement_except_hashif : HASHFOREACH ident IN LPAREN expression RPAREN statement'
2394
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
2395
2370
t [0 ] = ast .hashforeach (site (t ), t [2 ], t [5 ], t [7 ])
2396
2371
2397
2372
@prod_dml12
@@ -2422,7 +2397,6 @@ def case_statement_default(t):
2422
2397
@prod_dml14
2423
2398
def goto_statement (t ):
2424
2399
'statement_except_hashif : GOTO ident SEMI'
2425
- ident_enforce_not_discard_ref (site (t , 2 ), t [2 ])
2426
2400
# Restricted goto should be implemented, see SIMICS-6130
2427
2401
report (ESYNTAX (site (t ), 'goto' ,
2428
2402
'goto statements are not yet implemented in DML 1.4' ))
@@ -2599,7 +2573,6 @@ def simple_array_list(t):
2599
2573
@prod_dml14
2600
2574
def hook_decl (t ):
2601
2575
'''hook_decl : HOOK LPAREN cdecl_list RPAREN ident simple_array_list SEMI'''
2602
- ident_enforce_not_discard_ref (site (t , 5 ), t [5 ])
2603
2576
cdecl_list_enforce_unnamed (t [3 ])
2604
2577
if t [6 ]:
2605
2578
# Hook arrays are an internal feature, as their design depends on if we
@@ -2665,11 +2638,6 @@ def ident(t):
2665
2638
def ident (t ):
2666
2639
t [0 ] = t [1 ]
2667
2640
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" ))
2673
2641
@prod_dml14
2674
2642
@lex .TOKEN (ident_rule ('ident_or_underscore' ,
2675
2643
dmllex14 .reserved_idents + ('ID' , '_' )))
0 commit comments