Skip to content

Commit d7135cd

Browse files
authored
Merge pull request stadelmanma#131 from stadelmanma/more-bug-fixes
More bug fixes
2 parents 21b7408 + 0a1c77a commit d7135cd

File tree

8 files changed

+587436
-519132
lines changed

8 files changed

+587436
-519132
lines changed

grammar.js

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ module.exports = grammar({
106106
),
107107

108108
_top_level_item: $ => prec(2, choice(
109-
seq($.include_statement, $._end_of_statement),
109+
$.include_statement,
110110
$.program,
111111
$.module,
112112
$.submodule,
@@ -285,7 +285,7 @@ module.exports = grammar({
285285
$.end_program_statement
286286
),
287287

288-
program_statement: $ => seq(caseInsensitive('program'), $._name),
288+
program_statement: $ => seq(caseInsensitive('program'), $._name, $._end_of_statement),
289289
end_program_statement: $ => blockStructureEnding($, 'program'),
290290

291291
module: $ => seq(
@@ -301,7 +301,7 @@ module.exports = grammar({
301301
$.end_module_statement
302302
),
303303

304-
module_statement: $ => seq(caseInsensitive('module'), $._name),
304+
module_statement: $ => seq(caseInsensitive('module'), $._name, $._end_of_statement),
305305
end_module_statement: $ => blockStructureEnding($, 'module'),
306306

307307
submodule: $ => seq(
@@ -325,7 +325,8 @@ module.exports = grammar({
325325
':', field('parent', $.module_name)
326326
)),
327327
')',
328-
$._name
328+
$._name,
329+
$._end_of_statement,
329330
),
330331
end_submodule_statement: $ => blockStructureEnding($, 'submodule'),
331332
module_name: $ => $._name,
@@ -334,6 +335,7 @@ module.exports = grammar({
334335
$.interface_statement,
335336
repeat(choice(
336337
$._interface_items,
338+
$.include_statement,
337339
$.preproc_include,
338340
$.preproc_def,
339341
$.preproc_function_def,
@@ -419,7 +421,8 @@ module.exports = grammar({
419421
caseInsensitive('subroutine'),
420422
field('name', $._name),
421423
optional(field('parameters',$._parameters)),
422-
optional($.language_binding)
424+
optional($.language_binding),
425+
$._end_of_statement,
423426
),
424427

425428
end_subroutine_statement: $ => blockStructureEnding($, 'subroutine'),
@@ -429,7 +432,8 @@ module.exports = grammar({
429432
module_procedure_statement: $ => seq(
430433
optional($._callable_interface_qualifers),
431434
seq(caseInsensitive('module'), caseInsensitive('procedure')),
432-
field('name', $._name)
435+
field('name', $._name),
436+
$._end_of_statement,
433437
),
434438

435439
end_module_procedure_statement: $ => blockStructureEnding($, 'procedure'),
@@ -444,7 +448,8 @@ module.exports = grammar({
444448
optional(repeat(choice(
445449
$.language_binding,
446450
$.function_result
447-
)))
451+
))),
452+
$._end_of_statement,
448453
),
449454

450455
language_binding: $ => seq(
@@ -520,7 +525,7 @@ module.exports = grammar({
520525
// Variable Declarations
521526

522527
_specification_part: $ => prec(1, choice(
523-
prec(1, seq($.include_statement, $._end_of_statement)),
528+
$.include_statement,
524529
seq($.use_statement, $._end_of_statement),
525530
seq($.implicit_statement, $._end_of_statement),
526531
seq($.save_statement, $._end_of_statement),
@@ -544,6 +549,8 @@ module.exports = grammar({
544549
$.preproc_def,
545550
$.preproc_function_def,
546551
$.preproc_call,
552+
alias($.preproc_if_in_specification_part, $.preproc_if),
553+
alias($.preproc_ifdef_in_specification_part, $.preproc_ifdef),
547554
';',
548555
)),
549556

@@ -683,7 +690,7 @@ module.exports = grammar({
683690
alias(caseInsensitive('sequence'), $.sequence_statement),
684691
$._end_of_statement
685692
),
686-
seq($.include_statement, $._end_of_statement),
693+
$.include_statement,
687694
seq($.variable_declaration, $._end_of_statement),
688695
$.preproc_include,
689696
$.preproc_def,
@@ -738,6 +745,7 @@ module.exports = grammar({
738745
$.public_statement,
739746
$.private_statement,
740747
$.procedure_statement,
748+
$.include_statement,
741749
alias($.preproc_if_in_bound_procedures, $.preproc_if),
742750
alias($.preproc_ifdef_in_bound_procedures, $.preproc_ifdef),
743751
)),
@@ -850,7 +858,10 @@ module.exports = grammar({
850858
sized_declarator: $ => prec.right(1, seq(
851859
$.identifier,
852860
choice(
853-
alias($.argument_list, $.size),
861+
seq(
862+
alias($.argument_list, $.size),
863+
optional($.character_length),
864+
),
854865
$.character_length
855866
)
856867
)),
@@ -1035,6 +1046,7 @@ module.exports = grammar({
10351046
$._statements,
10361047
$._end_of_statement
10371048
),
1049+
$.include_statement,
10381050
';'
10391051
),
10401052

@@ -1044,7 +1056,6 @@ module.exports = grammar({
10441056
$.call_expression,
10451057
$.subroutine_call,
10461058
$.keyword_statement,
1047-
$.include_statement,
10481059
$.if_statement,
10491060
$.arithmetic_if_statement,
10501061
$.where_statement,
@@ -1144,10 +1155,11 @@ module.exports = grammar({
11441155
)
11451156
),
11461157

1147-
include_statement: $ => seq(
1158+
include_statement: $ => prec(1, seq(
11481159
caseInsensitive('include'),
1149-
field("path", alias($.string_literal, $.filename))
1150-
),
1160+
field("path", alias($.string_literal, $.filename)),
1161+
$._end_of_statement,
1162+
)),
11511163

11521164
data_statement: $ => seq(
11531165
caseInsensitive('data'),
@@ -1652,7 +1664,8 @@ module.exports = grammar({
16521664
enum_statement: $ => seq(
16531665
caseInsensitive('enum'),
16541666
',',
1655-
$.language_binding
1667+
$.language_binding,
1668+
$._end_of_statement,
16561669
),
16571670

16581671
enumeration_type: $ => seq(
@@ -2192,6 +2205,7 @@ module.exports = grammar({
21922205
caseInsensitive('format'),
21932206
caseInsensitive('go'),
21942207
caseInsensitive('if'),
2208+
prec(-1, caseInsensitive('include')),
21952209
caseInsensitive('inquire'),
21962210
caseInsensitive('intrinsic'),
21972211
caseInsensitive('kind'),
@@ -2202,6 +2216,7 @@ module.exports = grammar({
22022216
caseInsensitive('optional'),
22032217
caseInsensitive('parameter'),
22042218
caseInsensitive('pointer'),
2219+
prec(-1, caseInsensitive('print')),
22052220
caseInsensitive('private'),
22062221
caseInsensitive('public'),
22072222
prec(-1, caseInsensitive('rank')),
@@ -2216,8 +2231,10 @@ module.exports = grammar({
22162231
caseInsensitive('sync'),
22172232
caseInsensitive('target'),
22182233
caseInsensitive('texture'),
2234+
prec(-1, caseInsensitive('type')),
22192235
caseInsensitive('unlock'),
22202236
caseInsensitive('value'),
2237+
prec(-1, caseInsensitive('where')),
22212238
caseInsensitive('write'),
22222239
),
22232240

@@ -2372,7 +2389,6 @@ function preprocessor(command) {
23722389
function procedure($, start_statement, end_statement) {
23732390
return seq(
23742391
start_statement,
2375-
$._end_of_statement,
23762392
repeat(
23772393
choice(
23782394
$._specification_part,

0 commit comments

Comments
 (0)