Fix builtin function name highlighting

This commit is contained in:
Ella Dunbar 2025-10-18 16:58:19 -05:00
parent 073ab245c7
commit 1a002fb23b
5 changed files with 2243 additions and 5369 deletions

View file

@ -8,6 +8,8 @@ module.exports = grammar({
/\s/ /\s/
], ],
word: $ => $.identifier,
rules: { rules: {
translation_unit: $ => repeat($._top_level_item), translation_unit: $ => repeat($._top_level_item),
@ -131,7 +133,7 @@ module.exports = grammar({
), ),
function: $ => seq( function: $ => seq(
$.identifier, field("name", $.identifier),
'(', '(',
optional( optional(
repeat( repeat(
@ -191,5 +193,24 @@ module.exports = grammar({
number: $ => /\d+(\.\d+)?/, number: $ => /\d+(\.\d+)?/,
string: $ => /['"].*['"]/, string: $ => /['"].*['"]/,
//builtin: $ => choice(
// "AUTOREFERENCE",
// "FEEDER",
// "LIGHTS",
// "LOAD",
// "LOG",
// "LOGAPPEND",
// "LOGCREATE",
// "LOGDATA",
// "LOGFIELD",
// "LOGRUN",
// "PANLIGHT",
// "PICTURE",
// "SET",
// "SETCOLOUR",
// "SETLIGHT",
//
//)
} }
}); });

View file

@ -65,3 +65,4 @@
(identifier) @constant.macro (identifier) @constant.macro
(number) @number (number) @number
(string) @string (string) @string
(function name: (identifier) @function)

9
src/grammar.json generated
View file

@ -1,5 +1,6 @@
{ {
"name": "zanscript", "name": "zanscript",
"word": "identifier",
"rules": { "rules": {
"translation_unit": { "translation_unit": {
"type": "REPEAT", "type": "REPEAT",
@ -366,8 +367,12 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "SYMBOL", "type": "FIELD",
"name": "identifier" "name": "name",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
}, },
{ {
"type": "STRING", "type": "STRING",

15
src/node-types.json generated
View file

@ -149,10 +149,21 @@
{ {
"type": "function", "type": "function",
"named": true, "named": true,
"fields": {}, "fields": {
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
}
},
"children": { "children": {
"multiple": true, "multiple": true,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": "identifier", "type": "identifier",

7558
src/parser.c generated

File diff suppressed because it is too large Load diff