TT3: /home/abw/web/london/tt3/slides/examples/with_simple.tt3
Source
Tokens
Tree
Variables
Output
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
@4
x
operator assign
@5
=
number
@6
10
whitespace
@8
\n
variable
@13
y
operator assign
@14
=
number
@15
20
whitespace
@17
\n
tag_end
@18
%]
text
@20
\n\n
tag_start
@22
[%
whitespace
@24
command with
@26
with
whitespace
@30
variable
@31
y
operator assign
@32
=
number
@33
200
separator
@36
,
whitespace
@37
variable
@38
z
operator assign
@39
=
number
@40
300
whitespace
@43
tag_end
@44
%]
text
@46
\n x is
tag_start
@58
[%
whitespace
@60
variable
@61
x
whitespace
@62
tag_end
@63
%]
text
@65
comment
@77
[# 10 #]
text
@86
\n y is
tag_start
@98
[%
whitespace
@100
variable
@101
y
whitespace
@102
tag_end
@103
%]
text
@105
comment
@117
[# 200 #]
text
@126
\n z is
tag_start
@138
[%
whitespace
@140
variable
@141
z
whitespace
@142
tag_end
@143
%]
text
@145
comment
@157
[# 300 #]
text
@166
\n
tag_start
@167
[%
whitespace
@169
end
@171
end
whitespace
@174
tag_end
@175
%]
text
@177
\n\n
comment
@179
[# y restored to 20, z is undefined #]
eof
@217
Parse Tree
binary expr
@5
x = 10
variable element
@4
x
=
number element
@6
10
binary expr
@14
y = 20
variable element
@13
y
=
number element
@15
20
text
@20
\n\n
with keyword
@26
with
Data
binary expr
@32
y = 200
variable element
@31
y
=
number element
@33
200
binary expr
@39
z = 300
variable element
@38
z
=
number element
@40
300
Block
text
@46
\n x is
variable element
@61
x
text
@65
text
@86
\n y is
variable element
@101
y
text
@105
text
@126
\n z is
variable element
@141
z
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