nomo/tests/cases/deep_access.2-ast.snap
Marcel Müller ffd9baf90f Add deep access
Signed-off-by: Marcel Müller <neikos@neikos.email>
2026-03-15 14:31:46 +01:00

131 lines
4.8 KiB
Text

---
source: tests/file_tests.rs
expression: ast
info:
input: "{{ if world?.active }}\nHello {{= world.name }}\n{{ end }}\n\n{{ if world?.foo?.bar?.active }}\n Weird!\n{{ else }}\n Deep access is working :)\n{{ end }}"
context:
world:
active: true
name: World!
---
TemplateAst {
root: [
ConditionalChain {
chain: [
Block {
prev_whitespace_content: None,
expression: IfConditional {
expression: AccessOperation {
op: Dot,
lhs: ConditionalAccess(
[Ident]"world" (6..11),
),
rhs: VariableAccess(
[Ident]"active" (13..19),
),
},
},
post_whitespace_content: Some(
[Whitespace]"\n" (22..23),
),
},
ConditionalContent {
content: [
StaticContent(
[Content]"Hello" (23..28),
),
Interpolation {
prev_whitespace_content: Some(
[Whitespace]" " (28..29),
),
expression: AccessOperation {
op: Dot,
lhs: VariableAccess(
[Ident]"world" (33..38),
),
rhs: VariableAccess(
[Ident]"name" (39..43),
),
},
post_whitespace_content: Some(
[Whitespace]"\n" (46..47),
),
},
],
},
Block {
prev_whitespace_content: None,
expression: EndBlock,
post_whitespace_content: Some(
[Whitespace]"\n\n" (56..58),
),
},
],
},
ConditionalChain {
chain: [
Block {
prev_whitespace_content: None,
expression: IfConditional {
expression: AccessOperation {
op: Dot,
lhs: AccessOperation {
op: Dot,
lhs: AccessOperation {
op: Dot,
lhs: ConditionalAccess(
[Ident]"world" (64..69),
),
rhs: ConditionalAccess(
[Ident]"foo" (71..74),
),
},
rhs: ConditionalAccess(
[Ident]"bar" (76..79),
),
},
rhs: VariableAccess(
[Ident]"active" (81..87),
),
},
},
post_whitespace_content: Some(
[Whitespace]"\n " (90..95),
),
},
ConditionalContent {
content: [
StaticContent(
[Content]"Weird!" (95..101),
),
],
},
Block {
prev_whitespace_content: Some(
[Whitespace]"\n" (101..102),
),
expression: ElseConditional {
expression: None,
},
post_whitespace_content: Some(
[Whitespace]"\n " (112..117),
),
},
ConditionalContent {
content: [
StaticContent(
[Content]"Deep access is working :)" (117..142),
),
],
},
Block {
prev_whitespace_content: Some(
[Whitespace]"\n" (142..143),
),
expression: EndBlock,
post_whitespace_content: None,
},
],
},
],
}