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

View file

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

View file

@ -20,6 +20,10 @@
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "ministring"
},
{
"type": "SYMBOL",
"name": "string"
@ -338,58 +342,53 @@
}
}
},
"string": {
"type": "CHOICE",
"members": [
{
"type": "TOKEN",
"content": {
"type": "PREC",
"value": 10,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "^"
},
{
"type": "PATTERN",
"value": "[^ \\n\\r\\t<>:;&{}\"'\\[\\],]+"
}
]
}
}
},
{
"ministring": {
"type": "TOKEN",
"content": {
"type": "PREC",
"value": 10,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\""
"value": "^"
},
{
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": "\\\\."
},
{
"type": "PATTERN",
"value": "."
}
]
}
},
{
"type": "STRING",
"value": "\""
"type": "PATTERN",
"value": "[^ \\n\\r\\t<>:;&{}\"'\\[\\],]+"
}
]
}
}
},
"string": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\""
},
{
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": "\\\\."
},
{
"type": "PATTERN",
"value": "."
}
]
}
},
{
"type": "STRING",
"value": "\""
}
]
},
"call_expr": {

View file

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

File diff suppressed because it is too large Load diff