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

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@4a
whitespace@5
operator assign@6=
whitespace@7
construct hash@8{
whitespace@9
variable@10pi
whitespace@12
operator pair@13=>
whitespace@15
number@163.142
separator@21,
whitespace@22
variable@23phi
whitespace@26
operator pair@27=>
whitespace@29
number@301.618
whitespace@35
terminator@36}
whitespace@37\n
variable@42b
whitespace@43
operator assign@44=
whitespace@45
construct hash@46{
whitespace@47
variable@48e
whitespace@49
operator pair@51=>
whitespace@53
number@542.718
whitespace@59
terminator@60}
whitespace@61\n
variable@66c
whitespace@67
operator assign@68=
whitespace@69
construct hash@70{
whitespace@71
sigil hash@72%
variable@73a
separator@74,
whitespace@75
sigil hash@76%
variable@77b
whitespace@78
terminator@79}
whitespace@80\n
tag_end@81%]
eof@83

Parse Tree

binary expr@6a = { pi => 3.142; phi => 1.618 }
variable element@4a
=
hash expr@8{ pi => 3.142; phi => 1.618 }
{
binary pair expr@13pi => 3.142
word element@10pi
=>
number element@163.142
binary pair expr@27phi => 1.618
word element@23phi
=>
number element@301.618
}
binary expr@44b = { e => 2.718 }
variable element@42b
=
hash expr@46{ e => 2.718 }
{
binary pair expr@51e => 2.718
word element@48e
=>
number element@542.718
}
binary expr@68c = { %a; %b }
variable element@66c
=
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