TT3: /home/abw/web/london/tt3/slides/examples/function_sigs2.tt3
Source
Tokens
Tree
Variables
Output
Template Source
[%
html_element
(
type
,
%
attrs
,
@
content
)
=
"<$type$attrs.html_attrs>$content.join</$type>"
html_element
(
'a'
,
href
=
'home.html'
,
'Home'
)
%]
--EOF--
Source Tokens
tag_start
@0
[%
whitespace
@2
variable
@4
html_element
variable apply
@16
(
variable
@17
type
separator
@21
,
whitespace
@22
sigil hash
@23
%
variable
@24
attrs
separator
@29
,
whitespace
@30
sigil list
@31
@
variable
@32
content
terminator
@39
)
whitespace
@40
operator assign
@41
=
whitespace
@42
\n
dquote
@52
"<$type$attrs.html_attrs>$content.join</$type>"
whitespace
@99
\n\n
variable
@105
html_element
variable apply
@117
(
squote string
@118
'a'
separator
@121
,
whitespace
@122
variable
@123
href
operator assign
@127
=
squote string
@128
'home.html'
separator
@139
,
whitespace
@140
squote string
@141
'Home'
terminator
@147
)
whitespace
@148
\n
tag_end
@149
%]
text
@151
\n
eof
@152
Parse Tree
binary expr
@41
html_element = "<$type$attrs.html_attrs>$content.join</$type>"
variable element
@4
html_element
=
sub keyword
@17
"<$type$attrs.html_attrs>$content.join</$type>"
Name
sub keyword
@16
html_element(type; %attrs; @content)
Call
variable element
@4
html_element
Args
variable element
@17
type
Template::TT3::Element::Sigil::Hash=ARRAY(0xa02d54)
Template::TT3::Element::Sigil::List=ARRAY(0x9d32d4)
Block
dquote string element
@52
"<$type$attrs.html_attrs>$content.join</$type>"
text
@53
<
variable element
@55
type
binary expr
@65
attrs.html_attrs
variable element
@60
attrs
.
word element
@66
html_attrs
text
@76
>
binary expr
@85
content.join
variable element
@78
content
.
word element
@86
join
text
@90
</
variable element
@93
type
text
@97
>
sub keyword
@117
html_element('a'; href = 'home.html'; 'Home')
Call
variable element
@105
html_element
Args
squote string element
@118
'a'
binary expr
@127
href = 'home.html'
variable element
@123
href
=
squote string element
@128
'home.html'
squote string element
@141
'Home'
text
@151
\n
Variables Used
attrs
Uses
@ line 1
[% html_element(type, %
attrs
, @content) =
@ line 2
"<$type$
attrs
.html_attrs>$content.join</$type>"
@ line 2
"<$type$
attrs
.html_attrs>$content.join</$type>"
Vars
html_attrs
Uses
@ line 2
"<$type$
attrs.html_attrs
>$content.join</$type>"
content
Uses
@ line 1
[% html_element(type, %attrs, @
content
) =
@ line 2
"<$type$attrs.html_attrs>$
content
.join</$type>"
@ line 2
"<$type$attrs.html_attrs>$
content
.join</$type>"
Vars
join
Uses
@ line 2
"<$type$attrs.html_attrs>$
content.join
</$type>"
href
Uses
@ line 4
html_element('a',
href
='home.html', 'Home')
html_element
Uses
@ line 1
[%
html_element
(type, %attrs, @content) =
@ line 1
[%
html_element
(type, %attrs, @content) =
@ line 4
html_element
('a', href='home.html', 'Home')
type
Uses
@ line 1
[% html_element(
type
, %attrs, @content) =
@ line 2
"<$
type
$attrs.html_attrs>$content.join</$type>"
@ line 2
"<$type$attrs.html_attrs>$content.join</$
type
>"
Generated Output
<a href="home.html">Home</a>