FAQ
Hi All Happy New year,
I am trying to access parts of the parse tree, created by autotree, though i
am having some difficulty.
The specific part that i am having problems is accessing the contents of the
hash __DIRECTIVE2__, i understand (correct me if i am wrong) that within the
list the last element of a rule can be accessed on its own as it is a
terminal (i.e all the parts under namedNumber in this instance shown below).
Though __DIRECTIVE2__ is a nested hash? Because it is an intermediate rule,
how do i access this?

bless( {
'ident' => bless( {
'__VALUE__' => 'cardFailState'
}, 'ident' ),
'type' => bless( {
'namedNumber' => bless( {

'__STRING1__' => '(',

'__STRING2__' => ')',
'ident' =>
bless( {

'__VALUE__' => 'raise'

}, 'ident' ),
'number' =>
bless( {

'__VALUE__' => '1'

}, 'number' ),

'__DIRECTIVE1__' => 1,
'__RULE__'
=> 'namedNumber'
},
'namedNumber' ),
'__DIRECTIVE1__' => 1,
'__RULE__' => 'type',
'__STRING1__' => 'ENUMERATED',
'__DIRECTIVE2__' => [
bless( {

'__STRING1__' => '(',

'__STRING2__' => ')',
'ident'
=> bless( {

'__VALUE__' => 'clear'

}, 'ident' ),

'number' => bless( {

'__VALUE__' => '0'

}, 'number' ),

'__DIRECTIVE1__' => 1,

'__RULE__' => 'namedNumber'
},
'namedNumber' ),

$VAR1->[0]{'type'}{'namedNumber'}
],
'__STRING2__' => '{',
'__PATTERN1__' => ',',
'__STRING3__' => '}'
}, 'type' ),
'__DIRECTIVE1__' => 1,
'__RULE__' => 'namedType'
}, 'namedType' )
];

i have tried to assign it to an array, then using a foreach loop to access
all of the elements therein, here is a sample:

my @array = $aType->{sequence}{__DIRECTIVE2__};
foreach $elem (@array){
print $elem;
}

should i be assigning the contents to a my %hash or @array, then using the
my in the loop as above, or am i completely of track? any help is
greatly appreciated.

thanx mark

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprecdescent @
categoriesperl
postedJan 11, '02 at 2:03p
activeJan 11, '02 at 2:03p
posts1
users1
websitemetacpan.org...

1 user in discussion

Adaoui Mark: 1 post

People

Translate

site design / logo © 2019 Grokbase