mirror of
https://github.com/elladunbar/tree-sitter-zanscript.git
synced 2025-11-05 15:19:55 -06:00
Fix builtin function name highlighting
This commit is contained in:
parent
2a2ba3d4c3
commit
c699ee5fb4
5 changed files with 2243 additions and 5369 deletions
29
grammar.js
29
grammar.js
|
|
@ -8,6 +8,8 @@ module.exports = grammar({
|
|||
/\s/
|
||||
],
|
||||
|
||||
word: $ => $.identifier,
|
||||
|
||||
rules: {
|
||||
translation_unit: $ => repeat($._top_level_item),
|
||||
|
||||
|
|
@ -128,10 +130,10 @@ module.exports = grammar({
|
|||
$.function,
|
||||
$.assignment,
|
||||
$.comment,
|
||||
),
|
||||
),
|
||||
|
||||
function: $ => seq(
|
||||
$.identifier,
|
||||
field("name", $.identifier),
|
||||
'(',
|
||||
optional(
|
||||
repeat(
|
||||
|
|
@ -146,7 +148,7 @@ module.exports = grammar({
|
|||
),
|
||||
')',
|
||||
),
|
||||
|
||||
|
||||
_argument: $ => choice(
|
||||
$.identifier,
|
||||
$.number,
|
||||
|
|
@ -181,7 +183,7 @@ module.exports = grammar({
|
|||
'#',
|
||||
/.*/,
|
||||
),
|
||||
|
||||
|
||||
variable: $ => /@[a-zA-Z0-9_]+/,
|
||||
|
||||
match: $ => /[a-zA-Z0-9_.]+/,
|
||||
|
|
@ -191,5 +193,24 @@ module.exports = grammar({
|
|||
number: $ => /\d+(\.\d+)?/,
|
||||
|
||||
string: $ => /['"].*['"]/,
|
||||
|
||||
//builtin: $ => choice(
|
||||
// "AUTOREFERENCE",
|
||||
// "FEEDER",
|
||||
// "LIGHTS",
|
||||
// "LOAD",
|
||||
// "LOG",
|
||||
// "LOGAPPEND",
|
||||
// "LOGCREATE",
|
||||
// "LOGDATA",
|
||||
// "LOGFIELD",
|
||||
// "LOGRUN",
|
||||
// "PANLIGHT",
|
||||
// "PICTURE",
|
||||
// "SET",
|
||||
// "SETCOLOUR",
|
||||
// "SETLIGHT",
|
||||
//
|
||||
//)
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -65,3 +65,4 @@
|
|||
(identifier) @constant.macro
|
||||
(number) @number
|
||||
(string) @string
|
||||
(function name: (identifier) @function)
|
||||
|
|
|
|||
9
src/grammar.json
generated
9
src/grammar.json
generated
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "zanscript",
|
||||
"word": "identifier",
|
||||
"rules": {
|
||||
"translation_unit": {
|
||||
"type": "REPEAT",
|
||||
|
|
@ -366,8 +367,12 @@
|
|||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
"type": "FIELD",
|
||||
"name": "name",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
|
|
|
|||
15
src/node-types.json
generated
15
src/node-types.json
generated
|
|
@ -149,10 +149,21 @@
|
|||
{
|
||||
"type": "function",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"fields": {
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
|
|
|
|||
7558
src/parser.c
generated
7558
src/parser.c
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue