TT3: /home/abw/web/london/tt3/slides/examples/function_def2.tt3
Source
Tokens
Tree
Variables
Output
Template Source
[%
sub
bold
(
text
)
{
"<b>$text</b>"
}
bold
(
'Hello World'
)
%]
--EOF--
Source Tokens
tag_start
@0
[%
whitespace
@2
command sub
@4
sub
whitespace
@7
filename
@8
bold
construct parens
@12
(
variable
@13
text
terminator
@17
)
whitespace
@18
construct hash
@19
{
whitespace
@20
\n
dquote
@27
"<b>$text</b>"
whitespace
@41
\n
terminator
@46
}
whitespace
@47
\n \n
variable
@57
bold
variable apply
@61
(
squote string
@62
'Hello World'
terminator
@75
)
whitespace
@76
\n
tag_end
@77
%]
text
@79
\n
eof
@80
Parse Tree
sub keyword
@4
bold()
Name
filename element
@8
bold
Block
dquote string element
@27
"<b>$text</b>"
text
@28
<b>
variable element
@32
text
text
@36
</b>
sub keyword
@61
bold('Hello World')
Call
variable element
@57
bold
Args
squote string element
@62
'Hello World'
text
@79
\n
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>