Quotes for value of <skip:> directive.
[email protected] (Carl Parker)
| Newsgroups | perl.recdescent |
|---|---|
| Organization | Parker Innovation |
| Message-ID | <[email protected]> |
I'm playing around with the <skip:> directive and I've noticed
something interesting that I can't explain to myself.
Here is my script:
------ Start Script ------
use strict;
use warnings;
$::RD_TRACE = 1;
use Parse::RecDescent;
my $grammar = q{
input: number(s) { $return = $item{ number } } | <error>
number: <skip: '\.*'> /\d+/
};
my $parser = new Parse::RecDescent($grammar);
my $test_string = qq{1.2.3.5.8};
print join( "\n", @{ $parser -> input( $test_string ) } );
------ End Script ------
This script works great. However, if I change the value of the skip
directive so that it uses double quotes instead of single quotes:
<skip: "\.*">
the grammar fails to parse the input. However, if I put square
brackets around the escaped dot:
<skip: "[\.]*">
the grammar starts working again:
How does this work this way?
Thanks,
Carl