mirror of
https://github.com/elladunbar/tree-sitter-zanscript.git
synced 2025-11-05 23:29:54 -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/
|
/\s/
|
||||||
],
|
],
|
||||||
|
|
||||||
|
word: $ => $.identifier,
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
translation_unit: $ => repeat($._top_level_item),
|
translation_unit: $ => repeat($._top_level_item),
|
||||||
|
|
||||||
|
|
@ -128,10 +130,10 @@ module.exports = grammar({
|
||||||
$.function,
|
$.function,
|
||||||
$.assignment,
|
$.assignment,
|
||||||
$.comment,
|
$.comment,
|
||||||
),
|
),
|
||||||
|
|
||||||
function: $ => seq(
|
function: $ => seq(
|
||||||
$.identifier,
|
field("name", $.identifier),
|
||||||
'(',
|
'(',
|
||||||
optional(
|
optional(
|
||||||
repeat(
|
repeat(
|
||||||
|
|
@ -146,7 +148,7 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
')',
|
')',
|
||||||
),
|
),
|
||||||
|
|
||||||
_argument: $ => choice(
|
_argument: $ => choice(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
$.number,
|
$.number,
|
||||||
|
|
@ -181,7 +183,7 @@ module.exports = grammar({
|
||||||
'#',
|
'#',
|
||||||
/.*/,
|
/.*/,
|
||||||
),
|
),
|
||||||
|
|
||||||
variable: $ => /@[a-zA-Z0-9_]+/,
|
variable: $ => /@[a-zA-Z0-9_]+/,
|
||||||
|
|
||||||
match: $ => /[a-zA-Z0-9_.]+/,
|
match: $ => /[a-zA-Z0-9_.]+/,
|
||||||
|
|
@ -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",
|
||||||
|
//
|
||||||
|
//)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
9
src/grammar.json
generated
|
|
@ -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
15
src/node-types.json
generated
|
|
@ -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
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