fix: template expression precedence

This commit is contained in:
Michael Hoffmann
2022-12-02 19:47:43 +01:00
parent 99298c8ace
commit 6b74f88b3d
7 changed files with 10824 additions and 9401 deletions

View File

@@ -1187,30 +1187,6 @@
}
]
},
"_template": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "template_literal"
},
{
"type": "SYMBOL",
"name": "template_interpolation"
},
{
"type": "SYMBOL",
"name": "template_directive"
}
]
}
}
},
"quoted_template": {
"type": "PREC",
"value": 1,
@@ -1286,6 +1262,26 @@
"type": "STRING",
"value": "~"
},
"_template": {
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "template_interpolation"
},
{
"type": "SYMBOL",
"name": "template_directive"
},
{
"type": "SYMBOL",
"name": "template_literal"
}
]
}
},
"template_literal": {
"type": "PREC_RIGHT",
"value": 0,
@@ -1504,14 +1500,43 @@
"members": [
{
"type": "SYMBOL",
"name": "template_if_branch"
"name": "template_if_intro"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "template_else_branch"
"name": "_template"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "template_else_intro"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_template"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"
@@ -1524,19 +1549,6 @@
}
]
},
"template_if_branch": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "template_if_intro"
},
{
"type": "SYMBOL",
"name": "_template"
}
]
},
"template_if_intro": {
"type": "SEQ",
"members": [
@@ -1582,19 +1594,6 @@
}
]
},
"template_else_branch": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "template_else_intro"
},
{
"type": "SYMBOL",
"name": "_template"
}
]
},
"template_else_intro": {
"type": "SEQ",
"members": [

View File

@@ -737,33 +737,6 @@
]
}
},
{
"type": "template_else_branch",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "template_directive",
"named": true
},
{
"type": "template_else_intro",
"named": true
},
{
"type": "template_interpolation",
"named": true
},
{
"type": "template_literal",
"named": true
}
]
}
},
{
"type": "template_else_intro",
"named": true,
@@ -900,31 +873,16 @@
"required": true,
"types": [
{
"type": "template_else_branch",
"type": "template_directive",
"named": true
},
{
"type": "template_if_branch",
"type": "template_else_intro",
"named": true
},
{
"type": "template_if_end",
"named": true
}
]
}
},
{
"type": "template_if_branch",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "template_directive",
"named": true
},
{
"type": "template_if_intro",

19727
src/parser.c

File diff suppressed because it is too large Load Diff