Add conditional value emitting

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2026-03-15 12:46:00 +01:00
parent 662e574588
commit 9940881e46
10 changed files with 82 additions and 11 deletions

View file

@ -22,6 +22,7 @@ VMInstructions {
slot: VariableSlot {
index: 1,
},
fail_on_not_found: true,
},
JumpIfNotTrue {
emit_slot: VariableSlot {
@ -56,6 +57,7 @@ VMInstructions {
slot: VariableSlot {
index: 3,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {

View file

@ -4,12 +4,12 @@ expression: emit
info:
input: "{{= _name }}\n{{= a_name }}\n{{= name }}\n{{= _name1 }}\n{{= _namE }}\n{{= name1 }}"
context:
name1: Foo
_name: Foo
_namE: Foo
a_name: Foo
name: Foo
_name: Foo
_name1: Foo
_namE: Foo
name1: Foo
name: Foo
---
VMInstructions {
labels: {},
@ -19,6 +19,7 @@ VMInstructions {
slot: VariableSlot {
index: 0,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {
@ -33,6 +34,7 @@ VMInstructions {
slot: VariableSlot {
index: 1,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {
@ -47,6 +49,7 @@ VMInstructions {
slot: VariableSlot {
index: 2,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {
@ -61,6 +64,7 @@ VMInstructions {
slot: VariableSlot {
index: 3,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {
@ -75,6 +79,7 @@ VMInstructions {
slot: VariableSlot {
index: 4,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {
@ -89,6 +94,7 @@ VMInstructions {
slot: VariableSlot {
index: 5,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {

View file

@ -26,6 +26,7 @@ VMInstructions {
slot: VariableSlot {
index: 1,
},
fail_on_not_found: true,
},
JumpIfNotTrue {
emit_slot: VariableSlot {
@ -57,6 +58,7 @@ VMInstructions {
slot: VariableSlot {
index: 3,
},
fail_on_not_found: true,
},
JumpIfNotTrue {
emit_slot: VariableSlot {

View file

@ -20,6 +20,7 @@ VMInstructions {
slot: VariableSlot {
index: 0,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {

View file

@ -21,6 +21,7 @@ VMInstructions {
slot: VariableSlot {
index: 0,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {
@ -35,6 +36,7 @@ VMInstructions {
slot: VariableSlot {
index: 1,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {

View file

@ -39,6 +39,7 @@ VMInstructions {
slot: VariableSlot {
index: 4,
},
fail_on_not_found: true,
},
CreateIteratorFromSlotToSlot {
iterator_slot: VariableSlot {
@ -78,6 +79,7 @@ VMInstructions {
slot: VariableSlot {
index: 6,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {
@ -104,6 +106,7 @@ VMInstructions {
slot: VariableSlot {
index: 11,
},
fail_on_not_found: true,
},
CreateIteratorFromSlotToSlot {
iterator_slot: VariableSlot {
@ -143,6 +146,7 @@ VMInstructions {
slot: VariableSlot {
index: 13,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {

View file

@ -4,8 +4,8 @@ expression: emit
info:
input: "{{ if test -}}\n Hello {{= stuff -}}\n{{- end }}"
context:
stuff: Hemera
test: true
stuff: Hemera
---
VMInstructions {
labels: {
@ -22,6 +22,7 @@ VMInstructions {
slot: VariableSlot {
index: 1,
},
fail_on_not_found: true,
},
JumpIfNotTrue {
emit_slot: VariableSlot {
@ -42,6 +43,7 @@ VMInstructions {
slot: VariableSlot {
index: 3,
},
fail_on_not_found: true,
},
EmitFromSlot {
slot: VariableSlot {