Skip to content

Commit

Permalink
feat: add __loc
Browse files Browse the repository at this point in the history
  • Loading branch information
mfelsche authored and amaanq committed Apr 25, 2023
1 parent af8a2d4 commit 048b8ab
Show file tree
Hide file tree
Showing 5 changed files with 19,159 additions and 18,257 deletions.
2 changes: 2 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,13 @@ module.exports = grammar({
$.error,
$.compile_intrinsic,
$.compile_error,
$.location,
),

error: _ => 'error',
compile_intrinsic: _ => 'compile_intrinsic',
compile_error: $ => prec.left(seq('compile_error', optional($.string))),
location: _ => '__loc',

unary_expression: $ => prec.left(PREC.UNARY, seq(
field('operator', choice('-', 'not', '-~', 'addressof', 'digestof')),
Expand Down
1 change: 1 addition & 0 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
(identifier) @variable

(this) @variable.builtin
(location) @preproc

; Fields

Expand Down
8 changes: 8 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2366,6 +2366,10 @@
{
"type": "SYMBOL",
"name": "compile_error"
},
{
"type": "SYMBOL",
"name": "location"
}
]
},
Expand Down Expand Up @@ -2402,6 +2406,10 @@
]
}
},
"location": {
"type": "STRING",
"value": "__loc"
},
"unary_expression": {
"type": "PREC_LEFT",
"value": 4,
Expand Down
8 changes: 8 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
"type": "literal",
"named": true
},
{
"type": "location",
"named": true
},
{
"type": "match_statement",
"named": true
Expand Down Expand Up @@ -2905,6 +2909,10 @@
"type": "line_comment",
"named": true
},
{
"type": "location",
"named": true
},
{
"type": "match",
"named": false
Expand Down
Loading

0 comments on commit 048b8ab

Please sign in to comment.