On Tue, 23 Jul 2002, [EMAIL PROTECTED] wrote:
> Thanks to all for your help.  I've got some skip token weirdness.
> 
> What the difference between the two skip definitions in lines 23 and
> 24?

I'd love to help, but can you provide a complete example with some
sample input?  Or was that meant only for Marco (the To: line suggests
otherwise)?

To answer your question as best I can, I think you want the 

<skip: qr/,?/> 

directive in general, applied to your top rule, instead of accessing
$skip directly.  See the Parse::RecDescent documentation on the <skip>
directive.  From the doc:

       The variable `$Parse::RecDescent::skip' stores the universal
       prefix, which is the default for all terminal matches in all
       parsers built with `Parse::RecDescent'.

       The prefix for an individual production can be altered by using
       the `<skip:...>' directive (see below).

I can't answer your question, because I can't tell from your example
whether you're in the Parse::Recdescent package or not when you access
$skip and $Parse::RecDescent::skip, and how you evaluate your
$pf99_grammar, so I'll stop the Jeopardy game.

But do try <skip> first and foremost.

Ted

>      20 my $pf99_grammar = q{
>      21   { $DB::single = 1;
>      22     use Data::Dumper;
>      23     $skip = qr/,?/;
>      24     $Parse::RecDescent::skip = qr/,?/;
>      25   }
> ... further down in the grammar I have the following lines:
> 
>     319 sock4110 : { print "skip: ".$Parse::RecDescent::skip." \n";
>     320 print "skip: ".$skip." \n"; 321 } 322 timestamp meta
> 
> result 1) test pattern matches successfully result 2) Pattern
> failure occurs because a literal comma is needed to complete the
> match between two tokens: timestamp and meta result 3) line 319
> prints "skip: \s*" result 4) line 319 prints "skip: (?-xism:,?)"
> result 5) line 320 prints "skip: \s*" result 6) line 320 prints
> "skip: (?-xism:,?)"
> 
> TEST 1) leave lines 20-25 as stated     RESULT: 1, 4, 6
> TEST 2) Delete line 23, leave line 24   RESULT: 2, 4, 5
> TEST 3) Delete line 24, leave line 23   RESULT: 2, 3, 6
> 
> Tracking this problem down really screwed me up the last couple of
> days.

Reply via email to