Skip to content

Commit aec9397

Browse files
committed
Remove newline token
We don't want the newline token to show in the AST as it would make our passes sensible to that specific token. For instance if the source was ```fortran \#ifdef HAVE_THING ! foo \#endif ``` we wouldn't want to visit the newline character and make our column limit algorithm split the `#ifdef` as ```fortran \#ifdef HAVE_THING \ ! foo \#endif ``` In other words, this commit is hidding the newline character in the AST.
1 parent 8c9cc79 commit aec9397

File tree

4 files changed

+726639
-668572
lines changed

4 files changed

+726639
-668572
lines changed

grammar.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ module.exports = grammar({
100100
[$.rank_statement],
101101
[$.stop_statement, $.identifier],
102102
[$.type_statement],
103-
[$.preproc_ifdef_in_specification_part, $.program],
104103
[$.preproc_else_in_specification_part, $.program],
104+
[$.preproc_if_in_specification_part, $.program],
105+
[$._preproc_expression, $._expression],
105106
[$.coarray_critical_statement, $.identifier],
106107
],
107108

@@ -2352,7 +2353,6 @@ function preprocIf(suffix, content, precedence = 0) {
23522353
preprocessor('if'),
23532354
field('condition', $._preproc_expression),
23542355
optional($.preproc_comment),
2355-
'\n',
23562356
field('content', content($)),
23572357
field('alternative', optional(alternativeBlock($))),
23582358
preprocessor('endif'),
@@ -2379,7 +2379,6 @@ function preprocIf(suffix, content, precedence = 0) {
23792379
preprocessor('elif'),
23802380
optional($.preproc_comment),
23812381
field('condition', $._preproc_expression),
2382-
'\n',
23832382
field('content', content($)),
23842383
field('alternative', optional(alternativeBlock($))),
23852384
)),

0 commit comments

Comments
 (0)