TT3: /home/abw/web/london/tt3/slides/examples/function_def6.tt3
Source
Tokens
Tree
Variables
Output
Template Source
[%
bold
=
sub
(
text
)
{
"<b>$text</b>"
}
bold
=
sub
(
text
)
"<b>$text</b>"
bold
(
text
)
=
"<b>$text</b>"
%]
[%
bold
(
'Hello World'
)
%]
--EOF--
Source Tokens
tag_start
@0
[%
whitespace
@2
variable
@4
bold
whitespace
@8
operator assign
@9
=
whitespace
@10
command sub
@11
sub
construct parens
@14
(
variable
@15
text
terminator
@19
)
whitespace
@20
construct hash
@21
{
whitespace
@22
dquote
@23
"<b>$text</b>"
whitespace
@37
terminator
@38
}
whitespace
@39
\n\n
variable
@45
bold
whitespace
@49
operator assign
@50
=
whitespace
@51
command sub
@52
sub
construct parens
@55
(
variable
@56
text
terminator
@60
)
whitespace
@61
dquote
@62
"<b>$text</b>"
whitespace
@76
\n\n
variable
@83
bold
variable apply
@87
(
variable
@88
text
terminator
@92
)
whitespace
@93
operator assign
@94
=
whitespace
@95
dquote
@96
"<b>$text</b>"
whitespace
@110
\n
tag_end
@111
%]
text
@113
\n\n
tag_start
@115
[%
whitespace
@117
variable
@119
bold
variable apply
@123
(
squote string
@124
'Hello World'
terminator
@137
)
whitespace
@138
tag_end
@139
%]
text
@141
\n
eof
@142
Parse Tree
binary expr
@9
bold = sub()
variable element
@4
bold
=
sub keyword
@11
sub()
Block
dquote string element
@23
"<b>$text</b>"
text
@24
<b>
variable element
@28
text
text
@32
</b>
binary expr
@50
bold = sub()
variable element
@45
bold
=
sub keyword
@52
sub()
Block
dquote string element
@62
"<b>$text</b>"
text
@63
<b>
variable element
@67
text
text
@71
</b>
binary expr
@94
bold = "<b>$text</b>"
variable element
@83
bold
=
sub keyword
@88
"<b>$text</b>"
Name
sub keyword
@87
bold(text)
Call
variable element
@83
bold
Args
variable element
@88
text
Block
dquote string element
@96
"<b>$text</b>"
text
@97
<b>
variable element
@101
text
text
@105
</b>
text
@113
\n\n
sub keyword
@123
bold('Hello World')
Call
variable element
@119
bold
Args
squote string element
@124
'Hello World'
text
@141
\n
Variables Used
bold
Uses
@ line 1
[%
bold
= sub(text) { "<b>$text</b>" }
@ line 3
bold
= sub(text) "<b>$text</b>"
@ line 5
bold
(text) = "<b>$text</b>"
@ line 5
bold
(text) = "<b>$text</b>"
@ line 8
[%
bold
('Hello World') %]
text
Uses
@ line 1
[% bold = sub(text) { "<b>$
text
</b>" }
@ line 1
[% bold = sub(
text
) { "<b>$text</b>" }
@ line 3
bold = sub(text) "<b>$
text
</b>"
@ line 3
bold = sub(
text
) "<b>$text</b>"
@ line 5
bold(
text
) = "<b>$text</b>"
@ line 5
bold(text) = "<b>$
text
</b>"
Generated Output
<b>Hello World</b>