@@ -106,7 +106,7 @@ module.exports = grammar({
106
106
) ,
107
107
108
108
_top_level_item : $ => prec ( 2 , choice (
109
- seq ( $ . include_statement , $ . _end_of_statement ) ,
109
+ $ . include_statement ,
110
110
$ . program ,
111
111
$ . module ,
112
112
$ . submodule ,
@@ -285,7 +285,7 @@ module.exports = grammar({
285
285
$ . end_program_statement
286
286
) ,
287
287
288
- program_statement : $ => seq ( caseInsensitive ( 'program' ) , $ . _name ) ,
288
+ program_statement : $ => seq ( caseInsensitive ( 'program' ) , $ . _name , $ . _end_of_statement ) ,
289
289
end_program_statement : $ => blockStructureEnding ( $ , 'program' ) ,
290
290
291
291
module : $ => seq (
@@ -301,7 +301,7 @@ module.exports = grammar({
301
301
$ . end_module_statement
302
302
) ,
303
303
304
- module_statement : $ => seq ( caseInsensitive ( 'module' ) , $ . _name ) ,
304
+ module_statement : $ => seq ( caseInsensitive ( 'module' ) , $ . _name , $ . _end_of_statement ) ,
305
305
end_module_statement : $ => blockStructureEnding ( $ , 'module' ) ,
306
306
307
307
submodule : $ => seq (
@@ -325,7 +325,8 @@ module.exports = grammar({
325
325
':' , field ( 'parent' , $ . module_name )
326
326
) ) ,
327
327
')' ,
328
- $ . _name
328
+ $ . _name ,
329
+ $ . _end_of_statement ,
329
330
) ,
330
331
end_submodule_statement : $ => blockStructureEnding ( $ , 'submodule' ) ,
331
332
module_name : $ => $ . _name ,
@@ -334,6 +335,7 @@ module.exports = grammar({
334
335
$ . interface_statement ,
335
336
repeat ( choice (
336
337
$ . _interface_items ,
338
+ $ . include_statement ,
337
339
$ . preproc_include ,
338
340
$ . preproc_def ,
339
341
$ . preproc_function_def ,
@@ -419,7 +421,8 @@ module.exports = grammar({
419
421
caseInsensitive ( 'subroutine' ) ,
420
422
field ( 'name' , $ . _name ) ,
421
423
optional ( field ( 'parameters' , $ . _parameters ) ) ,
422
- optional ( $ . language_binding )
424
+ optional ( $ . language_binding ) ,
425
+ $ . _end_of_statement ,
423
426
) ,
424
427
425
428
end_subroutine_statement : $ => blockStructureEnding ( $ , 'subroutine' ) ,
@@ -429,7 +432,8 @@ module.exports = grammar({
429
432
module_procedure_statement : $ => seq (
430
433
optional ( $ . _callable_interface_qualifers ) ,
431
434
seq ( caseInsensitive ( 'module' ) , caseInsensitive ( 'procedure' ) ) ,
432
- field ( 'name' , $ . _name )
435
+ field ( 'name' , $ . _name ) ,
436
+ $ . _end_of_statement ,
433
437
) ,
434
438
435
439
end_module_procedure_statement : $ => blockStructureEnding ( $ , 'procedure' ) ,
@@ -444,7 +448,8 @@ module.exports = grammar({
444
448
optional ( repeat ( choice (
445
449
$ . language_binding ,
446
450
$ . function_result
447
- ) ) )
451
+ ) ) ) ,
452
+ $ . _end_of_statement ,
448
453
) ,
449
454
450
455
language_binding : $ => seq (
@@ -520,7 +525,7 @@ module.exports = grammar({
520
525
// Variable Declarations
521
526
522
527
_specification_part : $ => prec ( 1 , choice (
523
- prec ( 1 , seq ( $ . include_statement , $ . _end_of_statement ) ) ,
528
+ $ . include_statement ,
524
529
seq ( $ . use_statement , $ . _end_of_statement ) ,
525
530
seq ( $ . implicit_statement , $ . _end_of_statement ) ,
526
531
seq ( $ . save_statement , $ . _end_of_statement ) ,
@@ -544,6 +549,8 @@ module.exports = grammar({
544
549
$ . preproc_def ,
545
550
$ . preproc_function_def ,
546
551
$ . preproc_call ,
552
+ alias ( $ . preproc_if_in_specification_part , $ . preproc_if ) ,
553
+ alias ( $ . preproc_ifdef_in_specification_part , $ . preproc_ifdef ) ,
547
554
';' ,
548
555
) ) ,
549
556
@@ -683,7 +690,7 @@ module.exports = grammar({
683
690
alias ( caseInsensitive ( 'sequence' ) , $ . sequence_statement ) ,
684
691
$ . _end_of_statement
685
692
) ,
686
- seq ( $ . include_statement , $ . _end_of_statement ) ,
693
+ $ . include_statement ,
687
694
seq ( $ . variable_declaration , $ . _end_of_statement ) ,
688
695
$ . preproc_include ,
689
696
$ . preproc_def ,
@@ -738,6 +745,7 @@ module.exports = grammar({
738
745
$ . public_statement ,
739
746
$ . private_statement ,
740
747
$ . procedure_statement ,
748
+ $ . include_statement ,
741
749
alias ( $ . preproc_if_in_bound_procedures , $ . preproc_if ) ,
742
750
alias ( $ . preproc_ifdef_in_bound_procedures , $ . preproc_ifdef ) ,
743
751
) ) ,
@@ -850,7 +858,10 @@ module.exports = grammar({
850
858
sized_declarator : $ => prec . right ( 1 , seq (
851
859
$ . identifier ,
852
860
choice (
853
- alias ( $ . argument_list , $ . size ) ,
861
+ seq (
862
+ alias ( $ . argument_list , $ . size ) ,
863
+ optional ( $ . character_length ) ,
864
+ ) ,
854
865
$ . character_length
855
866
)
856
867
) ) ,
@@ -1035,6 +1046,7 @@ module.exports = grammar({
1035
1046
$ . _statements ,
1036
1047
$ . _end_of_statement
1037
1048
) ,
1049
+ $ . include_statement ,
1038
1050
';'
1039
1051
) ,
1040
1052
@@ -1044,7 +1056,6 @@ module.exports = grammar({
1044
1056
$ . call_expression ,
1045
1057
$ . subroutine_call ,
1046
1058
$ . keyword_statement ,
1047
- $ . include_statement ,
1048
1059
$ . if_statement ,
1049
1060
$ . arithmetic_if_statement ,
1050
1061
$ . where_statement ,
@@ -1144,10 +1155,11 @@ module.exports = grammar({
1144
1155
)
1145
1156
) ,
1146
1157
1147
- include_statement : $ => seq (
1158
+ include_statement : $ => prec ( 1 , seq (
1148
1159
caseInsensitive ( 'include' ) ,
1149
- field ( "path" , alias ( $ . string_literal , $ . filename ) )
1150
- ) ,
1160
+ field ( "path" , alias ( $ . string_literal , $ . filename ) ) ,
1161
+ $ . _end_of_statement ,
1162
+ ) ) ,
1151
1163
1152
1164
data_statement : $ => seq (
1153
1165
caseInsensitive ( 'data' ) ,
@@ -1652,7 +1664,8 @@ module.exports = grammar({
1652
1664
enum_statement : $ => seq (
1653
1665
caseInsensitive ( 'enum' ) ,
1654
1666
',' ,
1655
- $ . language_binding
1667
+ $ . language_binding ,
1668
+ $ . _end_of_statement ,
1656
1669
) ,
1657
1670
1658
1671
enumeration_type : $ => seq (
@@ -2192,6 +2205,7 @@ module.exports = grammar({
2192
2205
caseInsensitive ( 'format' ) ,
2193
2206
caseInsensitive ( 'go' ) ,
2194
2207
caseInsensitive ( 'if' ) ,
2208
+ prec ( - 1 , caseInsensitive ( 'include' ) ) ,
2195
2209
caseInsensitive ( 'inquire' ) ,
2196
2210
caseInsensitive ( 'intrinsic' ) ,
2197
2211
caseInsensitive ( 'kind' ) ,
@@ -2202,6 +2216,7 @@ module.exports = grammar({
2202
2216
caseInsensitive ( 'optional' ) ,
2203
2217
caseInsensitive ( 'parameter' ) ,
2204
2218
caseInsensitive ( 'pointer' ) ,
2219
+ prec ( - 1 , caseInsensitive ( 'print' ) ) ,
2205
2220
caseInsensitive ( 'private' ) ,
2206
2221
caseInsensitive ( 'public' ) ,
2207
2222
prec ( - 1 , caseInsensitive ( 'rank' ) ) ,
@@ -2216,8 +2231,10 @@ module.exports = grammar({
2216
2231
caseInsensitive ( 'sync' ) ,
2217
2232
caseInsensitive ( 'target' ) ,
2218
2233
caseInsensitive ( 'texture' ) ,
2234
+ prec ( - 1 , caseInsensitive ( 'type' ) ) ,
2219
2235
caseInsensitive ( 'unlock' ) ,
2220
2236
caseInsensitive ( 'value' ) ,
2237
+ prec ( - 1 , caseInsensitive ( 'where' ) ) ,
2221
2238
caseInsensitive ( 'write' ) ,
2222
2239
) ,
2223
2240
@@ -2372,7 +2389,6 @@ function preprocessor(command) {
2372
2389
function procedure ( $ , start_statement , end_statement ) {
2373
2390
return seq (
2374
2391
start_statement ,
2375
- $ . _end_of_statement ,
2376
2392
repeat (
2377
2393
choice (
2378
2394
$ . _specification_part ,
0 commit comments