Parse and ast math expressions
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
8cc8488de4
commit
8c02dbd672
8 changed files with 196 additions and 51 deletions
|
|
@ -1,6 +1,15 @@
|
|||
---
|
||||
source: tests/file_tests.rs
|
||||
expression: parsed
|
||||
info:
|
||||
input: "{{= _name }}\n{{= a_name }}\n{{= name }}\n{{= _name1 }}\n{{= _namE }}\n{{= name1 }}"
|
||||
context:
|
||||
_namE: Foo
|
||||
name1: Foo
|
||||
name: Foo
|
||||
_name: Foo
|
||||
a_name: Foo
|
||||
_name1: Foo
|
||||
input_file: tests/cases/identifiers.nomo
|
||||
---
|
||||
ParsedTemplate {
|
||||
|
|
@ -22,29 +31,29 @@ ParsedTemplate {
|
|||
[LeftDelim]"{{" (27..29),
|
||||
[WantsOutput]"=" (29..30),
|
||||
[Whitespace]" " (30..31),
|
||||
[Ident]"1name" (31..36),
|
||||
[Whitespace]" " (36..37),
|
||||
[RightDelim]"}}" (37..39),
|
||||
[Whitespace]"\n" (39..40),
|
||||
[LeftDelim]"{{" (40..42),
|
||||
[WantsOutput]"=" (42..43),
|
||||
[Whitespace]" " (43..44),
|
||||
[Ident]"_name1" (44..50),
|
||||
[Whitespace]" " (50..51),
|
||||
[RightDelim]"}}" (51..53),
|
||||
[Whitespace]"\n" (53..54),
|
||||
[LeftDelim]"{{" (54..56),
|
||||
[WantsOutput]"=" (56..57),
|
||||
[Whitespace]" " (57..58),
|
||||
[Ident]"_namE" (58..63),
|
||||
[Whitespace]" " (63..64),
|
||||
[RightDelim]"}}" (64..66),
|
||||
[Whitespace]"\n" (66..67),
|
||||
[LeftDelim]"{{" (67..69),
|
||||
[WantsOutput]"=" (69..70),
|
||||
[Whitespace]" " (70..71),
|
||||
[Ident]"name1" (71..76),
|
||||
[Whitespace]" " (76..77),
|
||||
[RightDelim]"}}" (77..79),
|
||||
[Ident]"name" (31..35),
|
||||
[Whitespace]" " (35..36),
|
||||
[RightDelim]"}}" (36..38),
|
||||
[Whitespace]"\n" (38..39),
|
||||
[LeftDelim]"{{" (39..41),
|
||||
[WantsOutput]"=" (41..42),
|
||||
[Whitespace]" " (42..43),
|
||||
[Ident]"_name1" (43..49),
|
||||
[Whitespace]" " (49..50),
|
||||
[RightDelim]"}}" (50..52),
|
||||
[Whitespace]"\n" (52..53),
|
||||
[LeftDelim]"{{" (53..55),
|
||||
[WantsOutput]"=" (55..56),
|
||||
[Whitespace]" " (56..57),
|
||||
[Ident]"_namE" (57..62),
|
||||
[Whitespace]" " (62..63),
|
||||
[RightDelim]"}}" (63..65),
|
||||
[Whitespace]"\n" (65..66),
|
||||
[LeftDelim]"{{" (66..68),
|
||||
[WantsOutput]"=" (68..69),
|
||||
[Whitespace]" " (69..70),
|
||||
[Ident]"name1" (70..75),
|
||||
[Whitespace]" " (75..76),
|
||||
[RightDelim]"}}" (76..78),
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,15 @@
|
|||
---
|
||||
source: tests/file_tests.rs
|
||||
expression: ast
|
||||
info:
|
||||
input: "{{= _name }}\n{{= a_name }}\n{{= name }}\n{{= _name1 }}\n{{= _namE }}\n{{= name1 }}"
|
||||
context:
|
||||
_namE: Foo
|
||||
name1: Foo
|
||||
name: Foo
|
||||
_name: Foo
|
||||
a_name: Foo
|
||||
_name1: Foo
|
||||
input_file: tests/cases/identifiers.nomo
|
||||
---
|
||||
TemplateAst {
|
||||
|
|
@ -26,34 +35,34 @@ TemplateAst {
|
|||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
expression: VariableAccess(
|
||||
[Ident]"1name" (31..36),
|
||||
[Ident]"name" (31..35),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
[Whitespace]"\n" (39..40),
|
||||
[Whitespace]"\n" (38..39),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
expression: VariableAccess(
|
||||
[Ident]"_name1" (44..50),
|
||||
[Ident]"_name1" (43..49),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
[Whitespace]"\n" (53..54),
|
||||
[Whitespace]"\n" (52..53),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
expression: VariableAccess(
|
||||
[Ident]"_namE" (58..63),
|
||||
[Ident]"_namE" (57..62),
|
||||
),
|
||||
post_whitespace_content: Some(
|
||||
[Whitespace]"\n" (66..67),
|
||||
[Whitespace]"\n" (65..66),
|
||||
),
|
||||
},
|
||||
Interpolation {
|
||||
prev_whitespace_content: None,
|
||||
expression: VariableAccess(
|
||||
[Ident]"name1" (71..76),
|
||||
[Ident]"name1" (70..75),
|
||||
),
|
||||
post_whitespace_content: None,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,15 @@
|
|||
---
|
||||
source: tests/file_tests.rs
|
||||
expression: emit
|
||||
info:
|
||||
input: "{{= _name }}\n{{= a_name }}\n{{= name }}\n{{= _name1 }}\n{{= _namE }}\n{{= name1 }}"
|
||||
context:
|
||||
_namE: Foo
|
||||
name1: Foo
|
||||
name: Foo
|
||||
_name: Foo
|
||||
a_name: Foo
|
||||
_name1: Foo
|
||||
input_file: tests/cases/identifiers.nomo
|
||||
---
|
||||
VMInstructions {
|
||||
|
|
@ -35,7 +44,7 @@ VMInstructions {
|
|||
content: "\n" (26..27),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "1name" (31..36),
|
||||
name: "name" (31..35),
|
||||
slot: VariableSlot {
|
||||
index: 2,
|
||||
},
|
||||
|
|
@ -46,10 +55,10 @@ VMInstructions {
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "\n" (39..40),
|
||||
content: "\n" (38..39),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "_name1" (44..50),
|
||||
name: "_name1" (43..49),
|
||||
slot: VariableSlot {
|
||||
index: 3,
|
||||
},
|
||||
|
|
@ -60,10 +69,10 @@ VMInstructions {
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "\n" (53..54),
|
||||
content: "\n" (52..53),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "_namE" (58..63),
|
||||
name: "_namE" (57..62),
|
||||
slot: VariableSlot {
|
||||
index: 4,
|
||||
},
|
||||
|
|
@ -74,10 +83,10 @@ VMInstructions {
|
|||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "\n" (66..67),
|
||||
content: "\n" (65..66),
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "name1" (71..76),
|
||||
name: "name1" (70..75),
|
||||
slot: VariableSlot {
|
||||
index: 5,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_name": "Foo",
|
||||
"a_name": "Foo",
|
||||
"1name": "Foo",
|
||||
"name": "Foo",
|
||||
"_name1": "Foo",
|
||||
"_namE": "Foo",
|
||||
"name1": "Foo"
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
---
|
||||
{{= _name }}
|
||||
{{= a_name }}
|
||||
{{= 1name }}
|
||||
{{= name }}
|
||||
{{= _name1 }}
|
||||
{{= _namE }}
|
||||
{{= name1 }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue