Bug in 1.80 Parser?

[email protected]
Newsgroups perl.recdescent
Message-ID <[email protected]>
When attempting to run the rd_query.pl example from Damian's Practical Parsing
class the parser claimed that the grammar was bad.  Upon some further
examination it appears that the generator is generating incorrect source
(looking at the file produced by setting RD_TRACE flag).  To wit the following
rule (ignore the <<<<111 stuff, that was just to point out certain lines):

pattern:
     /not|!|neque/i query   { bless \$item[2], 'NEGATION' }

     | '(' query ')'        { $item[2] }

     | ... m{["'/]|[qm][^\sa-z]}i { [extract_quotelike($text)] }
     <reject: !$item[2]->[0]>
      {
          my @data = @{$item[2]};
          $text = $data[1];
          $return = bless \$data[5], 'LITERAL'
               if $data[3] =~ /q/ || $data[4] =~ /['"]/;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1111111111
          $return = bless \"(?$data[10]:$data[5])", 'PATTERN'
               if $data[3] =~ /m/ || $data[4] =~ /[\/]/;
     }
     | /\w+/          { bless \$item[1], 'LITERAL' }
<<<<<<<<<<<<<<<<<<<<<<<<<<<< 222222222222
     | <error>

generates the following code.

$_tok = ($_noactions) ? 0 : do {[1],
     my @data = @{$item[2]};
     $text = $data[1];
     $return = bless \$data[5], 'LITERAL'
          if $data[3] =~ /q/ || $data[4] =~ /['"]/;  <<<<<<<<<<<<<<<<<<<<<<
333333333333333333
     $return = bless \"(?$data[10]:$data[5])", 'PATTERN'
          if $data[3] =~ /m/ || $data[4] =~ /[\/]/;
}
| /\w+/          { bless \$item[1], 'LITERAL' };  <<<<<<<<<<<<<<<<<<<<<<<<<<<<
444444444444444444
unless (defined $_tok)
{
     Parse::RecDescent::_trace(q{<<Didn't match action>> (return value:
[undef])})
          if defined $::RD_TRACE;
     last;
}

Notice that line <<<222 from the grammar is not translated from the grammar but
is simply pasted in directly.  The culprit (in the grammar) appears to be line
<<<111, specifically the ['"] character set specification since if I change it
to [ab] the phenomena does not occur.

I'm on Windoze (NT2K) and ActiveState (Build 628, the latest).

Ken

PS:  This isn't a post class test of some sort is it Damian?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.