I've solved my problem by using

        <skip: '(?:\s|\\\\\\\\[ \t]*\n)+'>

six backslashes work too:

        <skip: '(?:\s|\\\\\\[ \t]*\n)+'>

Still I don't understand why this works this way
and there is not much to see in the RD_TRACE file
(only the debug print statements)

-----Original Message-----
From: ext [mailto:[EMAIL PROTECTED]

Why doesn't <skip: '(?:\s|\\\\|\n)+'> remove backslashes?
I get a backslash consumed as "value" in the script below:

$top = {
         'AIF' => [
                    'Videorecorder.aif',
                    '..\\aif',
                    'Videorecorderaif.rss',
                    '\\',                               # why is it here?
                    'c8'
                  ]
       };

I've read the continuation-character thread with Randall and 
Domian in the archive (which is summarized in the P::RD::FAQ), 
but still don't get it. Any hints please?

Regards
Alex

#!/usr/bin/perl

use strict;
use vars qw($parser $text %top);
use Data::Dumper;
use Parse::RecDescent;
$RD_WARN  = 1;
$RD_HINT  = 1;
$RD_TRACE = 120;
use constant GRAMMAR => q(

mmpfile: chunk(s) /^\Z/
chunk: assignment | <error>
assignment: keyword <skip: '(?:\s|\\\\|\n)+'> value(s) {
        my $href = \%::top;
        push @{$href->{uc $item{keyword}}}, @{$item[3]};
}
value:  /"[^"]*"/ | ...!keyword /\S+/
keyword: 
        /AIF\b/i

);

$parser = Parse::RecDescent->new(GRAMMAR) or die 'Bad grammar';
$text .= $_ while (<DATA>);
defined $parser->mmpfile($text) or die 'Bad text';
print Data::Dumper->Dump([\%top], [qw(top)]);

__DATA__
AIF Videorecorder.aif ..\aif Videorecorderaif.rss \
    c8  

Reply via email to