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

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@4bold
whitespace@8
operator assign@9=
whitespace@10
command sub@11sub
construct parens@14(
variable@15text
terminator@19)
whitespace@20
construct hash@21{
whitespace@22
dquote@23"<b>$text</b>"
whitespace@37
terminator@38}
whitespace@39\n\n
variable@45bold
whitespace@49
operator assign@50=
whitespace@51
command sub@52sub
construct parens@55(
variable@56text
terminator@60)
whitespace@61
dquote@62"<b>$text</b>"
whitespace@76 \n\n
variable@83bold
variable apply@87(
variable@88text
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@119bold
variable apply@123(
squote string@124'Hello World'
terminator@137)
whitespace@138
tag_end@139%]
text@141\n
eof@142

Parse Tree

binary expr@9bold = sub()
variable element@4bold
=
sub keyword@11sub()
Block
dquote string element@23"<b>$text</b>"
text@24<b>
variable element@28text
text@32</b>
binary expr@50bold = sub()
variable element@45bold
=
sub keyword@52sub()
Block
dquote string element@62"<b>$text</b>"
text@63<b>
variable element@67text
text@71</b>
binary expr@94bold = "<b>$text</b>"
variable element@83bold
=
sub keyword@88"<b>$text</b>"
Name
sub keyword@87bold(text)
Call
variable element@83bold
Args
variable element@88text
Block
dquote string element@96"<b>$text</b>"
text@97<b>
variable element@101text
text@105</b>
text@113\n\n
sub keyword@123bold('Hello World')
Call
variable element@119bold
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>