Skip to content

Commit a618a28

Browse files
committed
Fix preproc_def rule
1 parent aa449f2 commit a618a28

File tree

5 files changed

+23518
-23450
lines changed

5 files changed

+23518
-23450
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
]

src/node-types.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15717,11 +15717,11 @@
1571715717
},
1571815718
{
1571915719
"type": "none",
15720-
"named": false
15720+
"named": true
1572115721
},
1572215722
{
1572315723
"type": "none",
15724-
"named": true
15724+
"named": false
1572515725
},
1572615726
{
1572715727
"type": "nopass",

0 commit comments

Comments
 (0)