separate ^-strings from normal ones

This commit is contained in:
Daniella / Tove 2024-11-15 21:44:36 +01:00
parent e62088ee87
commit 1a197b26ab
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
5 changed files with 2370 additions and 2353 deletions

View file

@ -5,6 +5,7 @@ module.exports = grammar({
source_file: $ => seq(repeat($._statement)), source_file: $ => seq(repeat($._statement)),
_unspaced_statement: $ => seq( _unspaced_statement: $ => seq(
choice( choice(
$.ministring,
$.string, $.string,
$.number, $.number,
$.function_definition, $.function_definition,
@ -53,10 +54,8 @@ module.exports = grammar({
$.identifier, $.identifier,
), ),
number: $ => token(prec(10, /\d+(\.\d+)?/)), number: $ => token(prec(10, /\d+(\.\d+)?/)),
string: $ => choice( ministring: $ => token(prec(10, seq('^', /[^ \n\r\t<>:;&{}"'\[\],]+/))),
token(prec(10, seq('^', /[^ \n\r\t<>:;&{}"'\[\],]+/))), string: $ => seq('"', repeat(choice(/\\./, /./)), '"'),
seq('"', repeat(choice(/\\./, /./)), '"'),
),
call_expr: $ => seq('<', optional($._spacing), repeat($._statement), $._unspaced_statement, '>'), call_expr: $ => seq('<', optional($._spacing), repeat($._statement), $._unspaced_statement, '>'),
with_expr: $ => seq( with_expr: $ => seq(
'with', $._spacing, 'with', $._spacing,

View file

@ -16,3 +16,4 @@
(call (call) @function (identifier) @property) (call (call) @function (identifier) @property)
(def (identifier) @local.definition) (def (identifier) @local.definition)
(with_expr (identifier) @local.definition) (with_expr (identifier) @local.definition)
(ministring) @string.special.symbol

View file

@ -20,6 +20,10 @@
{ {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{
"type": "SYMBOL",
"name": "ministring"
},
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "string" "name": "string"
@ -338,10 +342,7 @@
} }
} }
}, },
"string": { "ministring": {
"type": "CHOICE",
"members": [
{
"type": "TOKEN", "type": "TOKEN",
"content": { "content": {
"type": "PREC", "type": "PREC",
@ -361,7 +362,7 @@
} }
} }
}, },
{ "string": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
@ -389,8 +390,6 @@
"value": "\"" "value": "\""
} }
] ]
}
]
}, },
"call_expr": { "call_expr": {
"type": "SEQ", "type": "SEQ",

View file

@ -39,6 +39,10 @@
"type": "include", "type": "include",
"named": true "named": true
}, },
{
"type": "ministring",
"named": true
},
{ {
"type": "number", "type": "number",
"named": true "named": true
@ -106,6 +110,10 @@
"type": "include", "type": "include",
"named": true "named": true
}, },
{
"type": "ministring",
"named": true
},
{ {
"type": "number", "type": "number",
"named": true "named": true
@ -211,6 +219,10 @@
"type": "include", "type": "include",
"named": true "named": true
}, },
{
"type": "ministring",
"named": true
},
{ {
"type": "number", "type": "number",
"named": true "named": true
@ -282,6 +294,10 @@
"type": "include", "type": "include",
"named": true "named": true
}, },
{
"type": "ministring",
"named": true
},
{ {
"type": "number", "type": "number",
"named": true "named": true
@ -406,6 +422,10 @@
"type": "include", "type": "include",
"named": true "named": true
}, },
{
"type": "ministring",
"named": true
},
{ {
"type": "number", "type": "number",
"named": true "named": true
@ -494,6 +514,10 @@
"type": "include", "type": "include",
"named": true "named": true
}, },
{
"type": "ministring",
"named": true
},
{ {
"type": "number", "type": "number",
"named": true "named": true
@ -604,6 +628,10 @@
"type": "include", "type": "include",
"named": true "named": true
}, },
{
"type": "ministring",
"named": true
},
{ {
"type": "number", "type": "number",
"named": true "named": true
@ -738,6 +766,10 @@
"type": "include", "type": "include",
"named": false "named": false
}, },
{
"type": "ministring",
"named": true
},
{ {
"type": "namespace", "type": "namespace",
"named": false "named": false

File diff suppressed because it is too large Load diff