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

Template Source

[% # High Precedence ! a # true if a is false !! a # true if a is undefined a || b # b if a is false a !! b # b if a is undefined a && b %] [% # Low Precedence not a a and b a or b # b if a is false a nor b # b if a is undefined %] --EOF--

Source Tokens

tag_start@0[%
whitespace@2 # High Precedence\n
boolean not@26!
whitespace@27
variable@28a
whitespace@29 # true if a is false\n
boolean nor@67!!
whitespace@69
variable@70a
whitespace@71 # true if a is undefined\n
variable@112a
whitespace@113
binary operator@114||
whitespace@116
variable@117b
whitespace@118 # b if a is false\n
variable@150a
whitespace@151
boolean nor@152!!
whitespace@154
variable@155b
whitespace@156 # b if a is undefined\n
variable@192a
whitespace@193
binary operator@194&&
whitespace@196
variable@197b
whitespace@198 \n
tag_end@209%]
text@211\n\n
tag_start@213[%
whitespace@215 # Low Precedence\n
boolean not@238not
whitespace@241
variable@242a
whitespace@243\n
variable@248a
whitespace@249
binary operator@250and
whitespace@253
variable@254b
whitespace@255\n
variable@260a
whitespace@261
binary operator@262or
whitespace@264
variable@265b
whitespace@266 # b if a is false\n
variable@298a
whitespace@299
boolean nor@300nor
whitespace@303
variable@304b
whitespace@305 # b if a is undefined\n
tag_end@336%]
text@338\n\n
eof@340

Parse Tree

binary expr@67!a !! a
prefix unary expr@26!a
!
variable element@28a
!!
variable element@70a
binary expr@114a || b
variable element@112a
||
variable element@117b
binary expr@152a !! b
variable element@150a
!!
variable element@155b
binary expr@194a && b
variable element@192a
&&
variable element@197b
text@211\n\n
prefix unary expr@238nota
not
variable element@242a
binary expr@250a and b
variable element@248a
and
variable element@254b
binary expr@262a or b
variable element@260a
or
variable element@265b
binary expr@300a nor b
variable element@298a
nor
variable element@304b
text@338\n\n

Variables Used

a
Uses
@ line 2 ! a # true if a is false
@ line 3 !! a # true if a is undefined
@ line 4 a || b # b if a is false
@ line 5 a !! b # b if a is undefined
@ line 6 a && b
@ line 10 not a
@ line 11 a and b
@ line 12 a or b # b if a is false
@ line 13 a nor b # b if a is undefined
b
Uses
@ line 4 a || b # b if a is false
@ line 5 a !! b # b if a is undefined
@ line 6 a && b
@ line 11 a and b
@ line 12 a or b # b if a is false
@ line 13 a nor b # b if a is undefined

Generated Output

TT3 undefined data error at line 4 of /home/abw/web/london/tt3/slides/examples/boolean_operators.tt3:
Error: Undefined value returned by expression: b
Source: a || b # b if a is false
^ here