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

Template Source

[% x=10 y=20 %] [% with y=200, z=300 %] x is [% x %] [# 10 #] y is [% y %] [# 200 #] z is [% z %] [# 300 #] [% end %] [# y restored to 20, z is undefined #]--EOF--

Source Tokens

tag_start@0[%
whitespace@2
variable@4x
operator assign@5=
number@610
whitespace@8\n
variable@13y
operator assign@14=
number@1520
whitespace@17\n
tag_end@18%]
text@20\n\n
tag_start@22[%
whitespace@24
command with@26with
whitespace@30
variable@31y
operator assign@32=
number@33200
separator@36,
whitespace@37
variable@38z
operator assign@39=
number@40300
whitespace@43
tag_end@44%]
text@46\n x is
tag_start@58[%
whitespace@60
variable@61x
whitespace@62
tag_end@63%]
text@65
comment@77[# 10 #]
text@86\n y is
tag_start@98[%
whitespace@100
variable@101y
whitespace@102
tag_end@103%]
text@105
comment@117[# 200 #]
text@126\n z is
tag_start@138[%
whitespace@140
variable@141z
whitespace@142
tag_end@143%]
text@145
comment@157[# 300 #]
text@166\n
tag_start@167[%
whitespace@169
end@171end
whitespace@174
tag_end@175%]
text@177\n\n
comment@179[# y restored to 20, z is undefined #]
eof@217

Parse Tree

binary expr@5x = 10
variable element@4x
=
number element@610
binary expr@14y = 20
variable element@13y
=
number element@1520
text@20\n\n
with keyword@26with
Data
binary expr@32y = 200
variable element@31y
=
number element@33200
binary expr@39z = 300
variable element@38z
=
number element@40300
Block
text@46\n x is
variable element@61x
text@65
text@86\n y is
variable element@101y
text@105
text@126\n z is
variable element@141z
text@145
text@166\n
text@177\n\n

Variables Used

x
Uses
@ line 1[% x=10
@ line 6 x is [% x %] [# 10 #]
y
Uses
@ line 2 y=20
@ line 7 y is [% y %] [# 200 #]
@ line 5[% with y=200, z=300 %]
z
Uses
@ line 8 z is [% z %] [# 300 #]
@ line 5[% with y=200, z=300 %]

Generated Output

x is 10 y is 200 z is 300