File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ module.exports = grammar({
24
24
name : "jsonnet" ,
25
25
extras : ( $ ) => [ / \s / , $ . comment ] ,
26
26
externals : ( $ ) => [ $ . _string_start , $ . _string_content , $ . _string_end ] ,
27
- word : $ => $ . id ,
27
+ word : $ => $ . _ident ,
28
28
inline : ( $ ) => [ $ . h , $ . objinside ] ,
29
29
conflicts : ( ) => [ ] ,
30
30
@@ -242,8 +242,12 @@ module.exports = grammar({
242
242
)
243
243
) ,
244
244
named_argument : ( $ ) => seq ( $ . id , "=" , $ . expr ) ,
245
-
246
- id : ( ) => / [ _ a - z A - Z ] [ _ a - z A - Z 0 - 9 ] * / ,
245
+ id : ( $ ) => $ . _ident ,
246
+ // This use of an intermediate rule for identifiers is to
247
+ // overcome some limitations in ocaml-tree-sitter-semgrep.
248
+ // Indeed, ocaml-tree-sitter-semgrep can't override terminals (here was id)
249
+ // that are also mentioned in the 'word:' directive.
250
+ _ident : ( ) => / [ _ a - z A - Z ] [ _ a - z A - Z 0 - 9 ] * / ,
247
251
248
252
// COPIED FROM: tree-sitter-json
249
253
number : ( ) => {
You can’t perform that action at this time.
0 commit comments