| Newsgroups |
perl.recdescent |
| Message-ID |
<[email protected]> |
The following fragment exhibits some odd (to me) behaviour in that the @item
array in the phrases rule does not return the value for the conjunction subrule
although the %item hash does contain it. My assumption is that grouping the
subrules conjunction and phrase has something to do with this but the question
is whether or not this is expected behaviour. Then again it could just be me
messing up the $return values somehow. :-)
Anyone?
Ken
phrases: phrase (conjunction phrase)(s?)
{
print "$item{conjunction}\n";
print "phrases = " . Dumper(\@item);
1;
}
phrase: negation(?) subject
{
if (scalar(@{$item[1]}))
{
$return = '!~ ' . $item[2];
}
else
{
$return = '=~ ' . $item[2];
}
print "phrase = $return\n";
1;
}
subject:
'"' /[0-9a-zA-Z_]+/ '"' {$return = $item[2]; 1}
| /any/i {$return = '.*'; 1}
negation: /not/i {$return = '!~'; 1}
conjunction: /or|and/i
{
$return = lc($item[1]);
print "conjunction = $return\n";
1;
}