TT3: /home/abw/web/london/tt3/slides/examples/side_effect_sanity.tt3

Template Source

[% if add_header with title='Hello World' { fill site/header; for item in menu fill menu/item; } %] --EOF--

Source Tokens

tag_start@0[%
whitespace@2
command if@4if
whitespace@6
variable@9add_header
whitespace@19\n
command with@24with
whitespace@28
variable@29title
operator assign@34=
squote string@35'Hello World'
whitespace@48
construct hash@49{
whitespace@50\n
command fill@60fill
whitespace@64
filename@65site
filename@69/
filename@70header
delimiter@76;
whitespace@77\n\n
command for@88for
whitespace@91
variable@92item
whitespace@96
terminator@97in
whitespace@99
variable@100menu
whitespace@104\n
command fill@118fill
whitespace@122
filename@123menu
filename@127/
filename@128item
delimiter@132;
whitespace@133\n
terminator@138}
whitespace@139\n
tag_end@140%]
text@142\n\n
eof@144

Parse Tree

if keyword@4if add_header { with }
Test
variable element@9add_header
True
with keyword@24with
Data
binary expr@34title = 'Hello World'
variable element@29title
=
squote string element@35'Hello World'
Block
fill keyword@60fill
Template
filename element@65site/header
for keyword@88for
Item
variable element@92item
List
variable element@100menu
Then
fill keyword@118fill
Template
filename element@123menu/item
text@142\n\n

Variables Used

add_header
Uses
@ line 1[% if add_header
item
Uses
@ line 5 for item in menu
menu
Uses
@ line 5 for item in menu
title
Uses
@ line 2 with title='Hello World' {

Generated Output

TT3 undefined data error at line 1 of /home/abw/web/london/tt3/slides/examples/side_effect_sanity.tt3:
Error: Undefined value returned by expression: add_header
Source: [% if add_header
^ here