separate ^-strings from normal ones
This commit is contained in:
parent
e62088ee87
commit
1a197b26ab
5 changed files with 2370 additions and 2353 deletions
|
@ -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,
|
||||
|
|
|
@ -16,3 +16,4 @@
|
|||
(call (call) @function (identifier) @property)
|
||||
(def (identifier) @local.definition)
|
||||
(with_expr (identifier) @local.definition)
|
||||
(ministring) @string.special.symbol
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "ministring"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "string"
|
||||
|
@ -338,10 +342,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"string": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"ministring": {
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "PREC",
|
||||
|
@ -361,7 +362,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"string": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
|
@ -389,8 +390,6 @@
|
|||
"value": "\""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"call_expr": {
|
||||
"type": "SEQ",
|
||||
|
|
|
@ -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
|
||||
|
|
4598
src/parser.c
4598
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue