Skip to content

Commit 075675f

Browse files
committed
Fix preproc_def rule
1 parent aa449f2 commit 075675f

File tree

4 files changed

+23516
-23448
lines changed

4 files changed

+23516
-23448
lines changed

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ module.exports = grammar({
146146
preprocessor('define'),
147147
field('name', $.identifier),
148148
field('value', optional($.preproc_arg)),
149-
token.immediate(/\r?\n/),
149+
token(prec(1, /\r?\n/)), // force newline to win over preproc_arg
150150
),
151151

152152
preproc_function_def: $ => seq(

src/grammar.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,14 @@
176176
}
177177
},
178178
{
179-
"type": "IMMEDIATE_TOKEN",
179+
"type": "TOKEN",
180180
"content": {
181-
"type": "PATTERN",
182-
"value": "\\r?\\n"
181+
"type": "PREC",
182+
"value": 1,
183+
"content": {
184+
"type": "PATTERN",
185+
"value": "\\r?\\n"
186+
}
183187
}
184188
}
185189
]

0 commit comments

Comments
 (0)