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

Template Source

[% sub bold(text); "<b>$text</b>"; end; bold('Hello World') %]--EOF--

Source Tokens

tag_start@0[%
whitespace@2
command sub@4sub
whitespace@7
filename@8bold
construct parens@12(
variable@13text
terminator@17)
delimiter@18;
whitespace@19\n
dquote@26"<b>$text</b>"
delimiter@40;
whitespace@41\n
end@46end
delimiter@49;
whitespace@50\n \n
variable@57bold
variable apply@61(
squote string@62'Hello World'
terminator@75)
whitespace@76\n
tag_end@77%]
eof@79

Parse Tree

sub keyword@4bold()
Name
filename element@8bold
Block
dquote string element@26"<b>$text</b>"
text@27<b>
variable element@31text
text@35</b>
sub keyword@61bold('Hello World')
Call
variable element@57bold
Args
squote string element@62'Hello World'

Variables Used

bold
Uses
@ line 5 bold('Hello World')
text
Uses
@ line 2 "<b>$text</b>";
@ line 1[% sub bold(text);

Generated Output

<b>Hello World</b>