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

Template Source

%% name or 'World' %% foo or (bar and baz < wam or bam) %% a + b * c / d * (e + f / (g + d))--EOF--

Source Tokens

tag_start@0%%
whitespace@2
variable@3name
whitespace@7
binary operator@8or
whitespace@10
squote string@11'World'
tag_end@18\n\n
tag_start@20%%
whitespace@22
variable@23foo
whitespace@26
binary operator@27or
whitespace@29
construct parens@30(
variable@31bar
whitespace@34
binary operator@35and
whitespace@38
variable@39baz
whitespace@42
number lessthan@43<
whitespace@44
variable@45wam
whitespace@48
binary operator@49or
whitespace@51
variable@52bam
terminator@55)
tag_end@56\n\n
tag_start@58%%
whitespace@60
variable@61a
whitespace@62
number add@63+
whitespace@64
variable@65b
whitespace@66
number multiply@67*
whitespace@68
variable@69c
whitespace@70
number divide@71/
whitespace@72
variable@73d
whitespace@74
number multiply@75*
whitespace@76
construct parens@77(
variable@78e
whitespace@79
number add@80+
whitespace@81
variable@82f
whitespace@83
number divide@84/
whitespace@85
construct parens@86(
variable@87g
whitespace@88
number add@89+
whitespace@90
variable@91d
terminator@92)
terminator@93)
eof@94

Parse Tree

binary expr@8name or 'World'
variable element@3name
or
squote string element@11'World'
binary expr@27foo or ( bar and baz < wam or bam )
variable element@23foo
or
parens expr@30( bar and baz < wam or bam )
(
binary expr@49bar and baz < wam or bam
binary expr@35bar and baz < wam
variable element@31bar
and
binary expr@43baz < wam
variable element@39baz
<
variable element@45wam
or
variable element@52bam
)
binary expr@63a + b * c / d * ( e + f / ( g + d ) )
variable element@61a
+
binary expr@75b * c / d * ( e + f / ( g + d ) )
binary expr@71b * c / d
binary expr@67b * c
variable element@65b
*
variable element@69c
/
variable element@73d
*
parens expr@77( e + f / ( g + d ) )
(
binary expr@80e + f / ( g + d )
variable element@78e
+
binary expr@84f / ( g + d )
variable element@82f
/
parens expr@86( g + d )
(
binary expr@89g + d
variable element@87g
+
variable element@91d
)
)

Variables Used

a
Uses
@ line 5%% a + b * c / d * (e + f / (g + d))
b
Uses
@ line 5%% a + b * c / d * (e + f / (g + d))
bam
Uses
@ line 3%% foo or (bar and baz < wam or bam)
bar
Uses
@ line 3%% foo or (bar and baz < wam or bam)
baz
Uses
@ line 3%% foo or (bar and baz < wam or bam)
c
Uses
@ line 5%% a + b * c / d * (e + f / (g + d))
d
Uses
@ line 5%% a + b * c / d * (e + f / (g + d))
@ line 5%% a + b * c / d * (e + f / (g + d))
e
Uses
@ line 5%% a + b * c / d * (e + f / (g + d))
f
Uses
@ line 5%% a + b * c / d * (e + f / (g + d))
foo
Uses
@ line 3%% foo or (bar and baz < wam or bam)
g
Uses
@ line 5%% a + b * c / d * (e + f / (g + d))
name
Uses
@ line 1%% name or 'World'
wam
Uses
@ line 3%% foo or (bar and baz < wam or bam)

Generated Output

TT3 undefined data error at line 3 of /home/abw/web/london/tt3/slides/examples/expressions.tt3:
Error: Undefined value returned by expression: bar
Source: %% foo or (bar and baz < wam or bam)
^ here