Skip to content

Commit 88faefe

Browse files
committed
Readd 'expect' as explicit choice in simple_identifier
Apparently, tree-sitter resolves conflicts by match specificity where e.g. literal strings are given a higher precedence than regexes. To prevent this, we readd 'expect' as an explicit choice to simple_identifier.
1 parent 481e9d7 commit 88faefe

File tree

4 files changed

+168299
-165191
lines changed

4 files changed

+168299
-165191
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.idea
44
bin
55
build
6+
local
67
node_modules
78
*.swp
89
*.wasm

grammar.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,11 @@ module.exports = grammar({
10081008
// Identifiers
10091009
// ==========
10101010

1011-
simple_identifier: $ => $._lexical_identifier,
1011+
simple_identifier: $ => choice(
1012+
$._lexical_identifier,
1013+
"expect"
1014+
// TODO: More soft keywords
1015+
),
10121016

10131017
identifier: $ => sep1($.simple_identifier, "."),
10141018

src/grammar.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5051,8 +5051,17 @@
50515051
]
50525052
},
50535053
"simple_identifier": {
5054-
"type": "SYMBOL",
5055-
"name": "_lexical_identifier"
5054+
"type": "CHOICE",
5055+
"members": [
5056+
{
5057+
"type": "SYMBOL",
5058+
"name": "_lexical_identifier"
5059+
},
5060+
{
5061+
"type": "STRING",
5062+
"value": "expect"
5063+
}
5064+
]
50565065
},
50575066
"identifier": {
50585067
"type": "SEQ",

0 commit comments

Comments
 (0)