Re: Bug in 1.8? - subrule Argument passing

[email protected] Mon, 21 Oct 2002 14:54:48 -0700
Newsgroups perl.recdescent
Message-ID <[email protected]>

I think I've found the piece of code responsible (maybe :-) that's in the main
Parse::RecDescent package in the generate function.

          elsif ($grammar =~ m/$ANY/gco)
          {
               _parse("a zero-or-more subrule match", $aftererror,$line,
"$code$argcode($1)");
               if ($2)
               {
                    my $pos = pos $grammar;
                    substr($grammar,$pos,0,
                           "<leftop: $name $2 $name>(s?) ");

                    pos $grammar = $pos;
               }
               else
               {
                    $item = new Parse::RecDescent::Repetition($name,$1,0,$MAXREP
,
                                            $lookahead,$line,
                                            $self,
                                            $matchrule,
                                            $argcode);
                    $prod and $prod->additem($item)
                          or  _no_rule("repetition",$line,"$code$argcode($1)");

                    !$matchrule and $rule and $rule->addcall($name);

                    _check_insatiable($name,$1,$grammar,$line) if $::RD_CHECK;
               }
          }

     what appears to be happening is that if there is a "pattern" as part of the
subrule quantifier then the if($2) is true, the grammar is modified
but the $argcode variable does not become part of the grammar which it
presumably would if the else{...} code was executed.  This is
pattern which appears to be consistent with any subrule quantifier.
Unfortunately I'm not familiar enough with the RecDescent internals
to know if I'm right or not.  Anyone else have any ideas or opinions?

Ken