TT3: /home/abw/web/london/tt3/slides/examples/unpack_hashes.tt3
Source
Tokens
Tree
Variables
Output
Template Source
[%
a
=
{
pi
=>
3.142
,
phi
=>
1.618
}
b
=
{
e
=>
2.718
}
c
=
{
%
a
,
%
b
}
%]
--EOF--
Source Tokens
tag_start
@0
[%
whitespace
@2
variable
@4
a
whitespace
@5
operator assign
@6
=
whitespace
@7
construct hash
@8
{
whitespace
@9
variable
@10
pi
whitespace
@12
operator pair
@13
=>
whitespace
@15
number
@16
3.142
separator
@21
,
whitespace
@22
variable
@23
phi
whitespace
@26
operator pair
@27
=>
whitespace
@29
number
@30
1.618
whitespace
@35
terminator
@36
}
whitespace
@37
\n
variable
@42
b
whitespace
@43
operator assign
@44
=
whitespace
@45
construct hash
@46
{
whitespace
@47
variable
@48
e
whitespace
@49
operator pair
@51
=>
whitespace
@53
number
@54
2.718
whitespace
@59
terminator
@60
}
whitespace
@61
\n
variable
@66
c
whitespace
@67
operator assign
@68
=
whitespace
@69
construct hash
@70
{
whitespace
@71
sigil hash
@72
%
variable
@73
a
separator
@74
,
whitespace
@75
sigil hash
@76
%
variable
@77
b
whitespace
@78
terminator
@79
}
whitespace
@80
\n
tag_end
@81
%]
eof
@83
Parse Tree
binary expr
@6
a = { pi => 3.142; phi => 1.618 }
variable element
@4
a
=
hash expr
@8
{ pi => 3.142; phi => 1.618 }
{
binary pair expr
@13
pi => 3.142
word element
@10
pi
=>
number element
@16
3.142
binary pair expr
@27
phi => 1.618
word element
@23
phi
=>
number element
@30
1.618
}
binary expr
@44
b = { e => 2.718 }
variable element
@42
b
=
hash expr
@46
{ e => 2.718 }
{
binary pair expr
@51
e => 2.718
word element
@48
e
=>
number element
@54
2.718
}
binary expr
@68
c = { %a; %b }
variable element
@66
c
=
hash expr
@70
{ %a; %b }
{
Template::TT3::Element::Sigil::Hash=ARRAY(0xa16f14)
Template::TT3::Element::Sigil::Hash=ARRAY(0xa162b4)
}
Variables Used
a
Uses
@ line 1
[%
a
= { pi => 3.142, phi => 1.618 }
@ line 3
c = { %
a
, %b }
b
Uses
@ line 2
b
= { e => 2.718 }
@ line 3
c = { %a, %
b
}
c
Uses
@ line 3
c
= { %a, %b }
e
Uses
@ line 2
b = {
e
=> 2.718 }
phi
Uses
@ line 1
[% a = { pi => 3.142,
phi
=> 1.618 }
pi
Uses
@ line 1
[% a = {
pi
=> 3.142, phi => 1.618 }
Generated Output