Skip to content

Commit ecdd500

Browse files
authored
fix: properly suffix elifdef
1 parent 34f4c7e commit ecdd500

File tree

4 files changed

+65784
-65407
lines changed

4 files changed

+65784
-65407
lines changed

grammar.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,17 @@ function preprocIf(suffix, content, precedence = 0) {
13401340
);
13411341
}
13421342

1343+
/**
1344+
*
1345+
* @param {GrammarSymbols<string>} $
1346+
*
1347+
* @return {AliasRule | SymbolRule<string>}
1348+
*
1349+
*/
1350+
function elifBlock($) {
1351+
return suffix ? alias($['preproc_elifdef' + suffix], $.preproc_elifdef) : $.preproc_elifdef;
1352+
}
1353+
13431354
return {
13441355
['preproc_if' + suffix]: $ => prec(precedence, seq(
13451356
preprocessor('if'),
@@ -1354,7 +1365,7 @@ function preprocIf(suffix, content, precedence = 0) {
13541365
choice(preprocessor('ifdef'), preprocessor('ifndef')),
13551366
field('name', $.identifier),
13561367
repeat(content($)),
1357-
field('alternative', optional(choice(elseBlock($), $.preproc_elifdef))),
1368+
field('alternative', optional(choice(elseBlock($), elifBlock($)))),
13581369
preprocessor('endif'),
13591370
)),
13601371

src/grammar.json

+21-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)