Skip to content

Commit 28165da

Browse files
committed
fix: ident no longer matches nothing
Refs: [tree-sitter: Hidden rules with regex tokens silently match empty strings instead of reporting errors #4982](tree-sitter/tree-sitter#4982)
1 parent 85e8500 commit 28165da

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

grammar.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = grammar({
3939
],
4040
},
4141

42-
word: $ => $._ident,
42+
word: $ => $.ident,
4343

4444
rules: {
4545
trans_unit: $ => repeat($._global_stmt),
@@ -310,14 +310,12 @@ module.exports = grammar({
310310
'}',
311311
),
312312

313-
label: $ => $._label,
314-
_label: _ => token(seq("'", token.immediate(IdentRegex))),
313+
label: _ => token(seq("'", token.immediate(IdentRegex))),
315314

316315
underscore: $ => $._underscore,
317316
_underscore: _ => '_',
318317

319-
ident: $ => $._ident,
320-
_ident: _ => IdentRegex,
318+
ident: _ => token(IdentRegex),
321319
},
322320
});
323321

0 commit comments

Comments
 (0)