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

Template Source

[% message = block %] Hello [% name or 'World' %]! [% end %] [% message is %] Hello [% name or 'World' %]! [% end %] --EOF--

Source Tokens

tag_start@0[%
whitespace@2
variable@3message
whitespace@10
operator assign@11=
whitespace@12
command block@13block
whitespace@18
tag_end@19%]
text@21\nHello
tag_start@28[%
whitespace@30
variable@31name
whitespace@35
binary operator@36or
whitespace@38
squote string@39'World'
whitespace@46
tag_end@47%]
text@49!\n
tag_start@51[%
whitespace@53
end@54end
whitespace@57
tag_end@58%]
text@60\n\n
tag_start@62[%
whitespace@64
variable@65message
whitespace@72
command is@73is
whitespace@75
tag_end@76%]
text@78\nHello
tag_start@85[%
whitespace@87
variable@88name
whitespace@92
binary operator@93or
whitespace@95
squote string@96'World'
whitespace@103
tag_end@104%]
text@106!\n
tag_start@108[%
whitespace@110
end@111end
whitespace@114
tag_end@115%]
text@117\n\n
eof@119

Parse Tree

binary expr@11message = block
variable element@3message
=
block keyword@13block
Block
text@21\nHello
binary expr@36name or 'World'
variable element@31name
or
squote string element@39'World'
text@49!\n
text@60\n\n
is keyword@73message is { "\nHello "; name or 'World'; "!\n" }
variable element@65message
is
text@78\nHello
binary expr@93name or 'World'
variable element@88name
or
squote string element@96'World'
text@106!\n
text@117\n\n

Variables Used

message
Uses
@ line 1[% message = block %]
@ line 5[% message is %]
name
Uses
@ line 2Hello [% name or 'World' %]!
@ line 6Hello [% name or 'World' %]!

Generated Output