Hello community,
here is the log from the commit of package perl-Parse-RecDescent for openSUSE:Factory
checked in at Thu Jan 14 17:46:33 CET 2010.
--------
--- perl-Parse-RecDescent/perl-Parse-RecDescent.changes 2009-12-10 21:00:13.000000000 +0100
+++ perl-Parse-RecDescent/perl-Parse-RecDescent.changes 2010-01-13 16:55:48.000000000 +0100
@@ -1,0 +2,18 @@
+Wed Jan 13 16:35:16 CET 2010 - anicka@suse.cz
+
+- update to 1.962.2
+ * Added: <warn> <hint> <nocheck>
+ * Fixed assymmetrical push/pop on @lines tracker
+ * Bumped sub-version number hugely to fix CPAN indexing
+ * Remove all occurrences of $& so we don't affect other regular
+ expressions.
+ * Perl 5.6.0 required for use of $+[0] and $-[0] for replacement
+ of $&.
+ * Fixed subtle bug in leftop and rightop caused by removal of $&
+
+-------------------------------------------------------------------
+Sun Jan 10 15:43:32 CET 2010 - jengelh@medozas.de
+
+- enable parallel build
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
Parse-RecDescent-1.96.0.diff
Parse-RecDescent-1.96.0.tar.bz2
New:
----
Parse-RecDescent-1.962.2.diff
Parse-RecDescent-1.962.2.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Parse-RecDescent.spec ++++++
--- /var/tmp/diff_new_pack.pWbQOO/_old 2010-01-14 17:45:59.000000000 +0100
+++ /var/tmp/diff_new_pack.pWbQOO/_new 2010-01-14 17:45:59.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package perl-Parse-RecDescent (Version 1.96.0)
+# spec file for package perl-Parse-RecDescent (Version 1.962.2)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -21,8 +21,8 @@
Name: perl-Parse-RecDescent
%define cpan_name %( echo %{name} | %{__sed} -e 's,perl-,,' )
Summary: Perl RecDescent Module
-Version: 1.96.0
-Release: 2
+Version: 1.962.2
+Release: 1
License: Artistic
Group: Development/Libraries/Perl
Url: http://cpan.org/modules/by-module/Parse/
@@ -58,7 +58,7 @@
%build
find -type f | xargs chmod 644
perl Makefile.PL
-%{__make}
+%{__make} %{?_smp_mflags}
%check
%{__make} test
++++++ Parse-RecDescent-1.96.0.diff -> Parse-RecDescent-1.962.2.diff ++++++
--- perl-Parse-RecDescent/Parse-RecDescent-1.96.0.diff 2008-10-06 17:20:37.000000000 +0200
+++ perl-Parse-RecDescent/Parse-RecDescent-1.962.2.diff 2010-01-13 16:55:48.000000000 +0100
@@ -1,6 +1,8 @@
---- lib/Parse/RecDescent.pm
+Index: lib/Parse/RecDescent.pm
+===================================================================
+--- lib/Parse/RecDescent.pm.orig
+++ lib/Parse/RecDescent.pm
-@@ -2784,6 +2784,7 @@
+@@ -2798,6 +2798,7 @@ sub _check_grammar ($)
sub _code($)
{
my $self = shift;
++++++ Parse-RecDescent-1.96.0.tar.bz2 -> Parse-RecDescent-1.962.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/Changes new/Parse-RecDescent-1.962.2/Changes
--- old/Parse-RecDescent-1.96.0/Changes 2008-10-02 22:08:24.000000000 +0200
+++ new/Parse-RecDescent-1.962.2/Changes 2009-08-28 13:39:33.000000000 +0200
@@ -553,3 +553,25 @@
- Added: <warn> <hint> <nocheck>
-
+
+
+1.962.0 Tue Aug 25 19:45:15 2009
+
+ - Doc bug fix (thanks Christophe)
+
+ - Fixed assymmetrical push/pop on @lines tracker (thanks Peter!)
+
+ - Bumped sub-version number hugely to fix CPAN indexing (thanks Jerome)
+
+ - Remove all occurrences of $& so we don't affect other regular expressions.
+
+ - Perl 5.6.0 required for use of $+[0] and $-[0] for replacement of $&.
+
+
+1.962.1 Thu Aug 27 21:39:30 2009
+
+ - Fixed subtle bug in leftop and rightop caused by removal of $&
+
+
+1.962.2 Fri Aug 28 13:39:33 2009
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/MANIFEST new/Parse-RecDescent-1.962.2/MANIFEST
--- old/Parse-RecDescent-1.96.0/MANIFEST 2007-09-29 21:04:23.000000000 +0200
+++ new/Parse-RecDescent-1.962.2/MANIFEST 2009-08-27 21:39:35.000000000 +0200
@@ -78,3 +78,5 @@
demo/demo_undumper.pl
demo/demo_whoson.pl
t/basics.t
+t/re_capture_return.t
+t/separated_repetition.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/META.yml new/Parse-RecDescent-1.962.2/META.yml
--- old/Parse-RecDescent-1.96.0/META.yml 2008-10-02 22:08:25.000000000 +0200
+++ new/Parse-RecDescent-1.962.2/META.yml 2009-08-28 13:39:34.000000000 +0200
@@ -1,13 +1,16 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Parse-RecDescent
-version: 1.96.0
-version_from: lib/Parse/RecDescent.pm
-installdirs: site
-requires:
+--- #YAML:1.0
+name: Parse-RecDescent
+version: 1.962.2
+abstract: Generate Recursive-Descent Parsers
+license: ~
+author:
+ - Damian Conway
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
Test::More: 0
Text::Balanced: 0
version: 0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/README new/Parse-RecDescent-1.962.2/README
--- old/Parse-RecDescent-1.96.0/README 2008-10-02 22:08:24.000000000 +0200
+++ new/Parse-RecDescent-1.962.2/README 2009-08-28 13:39:33.000000000 +0200
@@ -1,4 +1,4 @@
-Parse::RecDescent version 1.96.0
+Parse::RecDescent version 1.962.2
NAME
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/demo/demo_calc.pl new/Parse-RecDescent-1.962.2/demo/demo_calc.pl
--- old/Parse-RecDescent-1.96.0/demo/demo_calc.pl 2007-09-29 20:53:53.000000000 +0200
+++ new/Parse-RecDescent-1.962.2/demo/demo_calc.pl 2009-07-02 03:00:51.000000000 +0200
@@ -1,4 +1,7 @@
-#! /usr/local/bin/perl -ws
+#! /opt/local/bin/perl5.10.0
+use v5.10;
+use warnings;
+
use Parse::RecDescent;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/lib/Parse/RecDescent.pm new/Parse-RecDescent-1.962.2/lib/Parse/RecDescent.pm
--- old/Parse-RecDescent-1.96.0/lib/Parse/RecDescent.pm 2008-10-02 22:08:24.000000000 +0200
+++ new/Parse-RecDescent-1.962.2/lib/Parse/RecDescent.pm 2009-08-28 13:39:33.000000000 +0200
@@ -1,6 +1,6 @@
# GENERATE RECURSIVE DESCENT PARSER OBJECTS FROM A GRAMMAR
-use 5.005;
+use 5.006;
use strict;
package Parse::RecDescent;
@@ -391,6 +391,7 @@
my %arg = ($#arg & 01) ? @arg : (@arg, undef);
my $text;
my $lastsep="";
+ my $current_match;
my $expectation = new Parse::RecDescent::Expectation(q{' . $self->expected() . '});
$expectation->at($_[1]);
'. ($parser->{_check}{thisoffset}?'
@@ -1129,8 +1130,7 @@
' . ($self->{"lookahead"}<0?'if':'unless')
. ' ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and '
. ($check->{itempos}? 'do {'.Parse::RecDescent::Production::incitempos().' 1} and ' : '')
- . ' $text =~ s' . $ldel . '\A(?:' . $self->{"pattern"} . ')'
- . $rdel . $sdel . $mod . ')
+ . ' $text =~ m' . $ldel . '\A(?:' . $self->{"pattern"} . ')' . $rdel . $mod . ')
{
'.($self->{"lookahead"} ? '$text = $_savetext;' : '').'
$expectation->failed();
@@ -1140,11 +1140,13 @@
last;
}
+ $current_match = substr($text, $-[0], $+[0] - $-[0]);
+ substr($text,0,length($current_match),q{});
Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
- . $& . q{])},
+ . $current_match . q{])},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
- push @item, $item{'.$self->{hashname}.'}=$&;
+ push @item, $item{'.$self->{hashname}.'}=$current_match;
' . ($self->{"lookahead"} ? '$text = $_savetext;' : '' ) .'
';
@@ -1201,7 +1203,7 @@
' . ($self->{"lookahead"}<0?'if':'unless')
. ' ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and '
. ($check->{itempos}? 'do {'.Parse::RecDescent::Production::incitempos().' 1} and ' : '')
- . ' $text =~ s/\A' . quotemeta($self->{"pattern"}) . '//)
+ . ' $text =~ m/\A' . quotemeta($self->{"pattern"}) . '/)
{
'.($self->{"lookahead"} ? '$text = $_savetext;' : '').'
$expectation->failed();
@@ -1210,11 +1212,13 @@
if defined $::RD_TRACE;
last;
}
+ $current_match = substr($text, $-[0], $+[0] - $-[0]);
+ substr($text,0,length($current_match),q{});
Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
- . $& . q{])},
+ . $current_match . q{])},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
- push @item, $item{'.$self->{hashname}.'}=$&;
+ push @item, $item{'.$self->{hashname}.'}=$current_match;
' . ($self->{"lookahead"} ? '$text = $_savetext;' : '' ) .'
';
@@ -1590,7 +1594,7 @@
' . $op->code(@_[1..2]) . '
' . ($op->isterminal() ? 'pop @item;' : '$backtrack=1;' ) . '
' . (ref($op) eq 'Parse::RecDescent::Token'
- ? 'if (defined $1) {push @item, $item{'.($self->{name}||$self->{hashname}).'}=$1; $backtrack=1;}'
+ ? 'if (defined $2) {push @item, $item{'.($self->{name}||$self->{hashname}).'}=$2; $backtrack=1;}'
: "" ) . '
' . $rightarg->code(@_[1..2]) . '
$savetext = $text;
@@ -1616,7 +1620,7 @@
' . $op->code(@_[1..2]) . '
$savetext = $text;
' . ($op->isterminal() ? 'pop @item;' : "" ) . '
- ' . (ref($op) eq 'Parse::RecDescent::Token' ? 'do { push @item, $item{'.($self->{name}||$self->{hashname}).'}=$1; } if defined $1;' : "" ) . '
+ ' . (ref($op) eq 'Parse::RecDescent::Token' ? 'do { push @item, $item{'.($self->{name}||$self->{hashname}).'}=$2; } if defined $2;' : "" ) . '
}
$text = $savetext;
pop @item if $backtrack;
@@ -1719,7 +1723,7 @@
my $ERRORS = 0;
-use version; $VERSION = qv('1.96.0');
+use version; our $VERSION = qv('1.962.2');
# BUILDING A PARSER
@@ -1857,7 +1861,11 @@
my $aftererror = 0;
my $lookahead = 0;
my $lookaheadspec = "";
- push @lines, _linecount($grammar) unless $lines[-1];
+ my $must_pop_lines;
+ if (! $lines[-1]) {
+ push @lines, _linecount($grammar) ;
+ $must_pop_lines = 1;
+ }
$self->{_check}{itempos} = ($grammar =~ /\@itempos\b|\$itempos\s*\[/)
unless $self->{_check}{itempos};
for (qw(thisoffset thiscolumn prevline prevoffset prevcolumn))
@@ -1888,19 +1896,19 @@
my @components = ();
if ($grammar =~ m/$COMMENT/gco)
{
- _parse("a comment",0,$line);
+ _parse("a comment",0,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
next;
}
elsif ($grammar =~ m/$NEGLOOKAHEAD/gco)
{
- _parse("a negative lookahead",$aftererror,$line);
+ _parse("a negative lookahead",$aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$lookahead = $lookahead ? -$lookahead : -1;
$lookaheadspec .= $1;
next; # SKIP LOOKAHEAD RESET AT END OF while LOOP
}
elsif ($grammar =~ m/$POSLOOKAHEAD/gco)
{
- _parse("a positive lookahead",$aftererror,$line);
+ _parse("a positive lookahead",$aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$lookahead = $lookahead ? $lookahead : 1;
$lookaheadspec .= $1;
next; # SKIP LOOKAHEAD RESET AT END OF while LOOP
@@ -1952,7 +1960,7 @@
{ }
elsif ($grammar =~ m/$BADREP/gco)
{
- _parse("an invalid repetition specifier", 0,$line);
+ _parse("an invalid repetition specifier", 0,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
_error("Incorrect specification of a repeated directive",
$line);
_hint("Repeated directives cannot have
@@ -1975,7 +1983,7 @@
}
elsif ($grammar =~ m/$UNCOMMITMK/gco)
{
- _parse("an uncommit marker", $aftererror,$line);
+ _parse("an uncommit marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::Directive('$commit=0;1',
$lookahead,$line,"<uncommit>");
$prod and $prod->additem($item)
@@ -1983,7 +1991,7 @@
}
elsif ($grammar =~ m/$QUOTELIKEMK/gco)
{
- _parse("an perl quotelike marker", $aftererror,$line);
+ _parse("an perl quotelike marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::Directive(
'my ($match,@res);
($match,$text,undef,@res) =
@@ -1996,7 +2004,7 @@
elsif ($grammar =~ m/$CODEBLOCKMK/gco)
{
my $outer = $1||"{}";
- _parse("an perl codeblock marker", $aftererror,$line);
+ _parse("an perl codeblock marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::Directive(
'Text::Balanced::extract_codeblock($text,undef,$skip,\''.$outer.'\');
', $lookahead,$line,"");
@@ -2005,7 +2013,7 @@
}
elsif ($grammar =~ m/$VARIABLEMK/gco)
{
- _parse("an perl variable marker", $aftererror,$line);
+ _parse("an perl variable marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::Directive(
'Text::Balanced::extract_variable($text,$skip);
', $lookahead,$line,"");
@@ -2014,7 +2022,7 @@
}
elsif ($grammar =~ m/$NOCHECKMK/gco)
{
- _parse("a disable checking marker", $aftererror,$line);
+ _parse("a disable checking marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
if ($rule)
{
_error("<nocheck> directive not at start of grammar", $line);
@@ -2030,19 +2038,20 @@
}
elsif ($grammar =~ m/$AUTOSTUBMK/gco)
{
- _parse("an autostub marker", $aftererror,$line);
+ _parse("an autostub marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$::RD_AUTOSTUB = "";
}
elsif ($grammar =~ m/$AUTORULEMK/gco)
{
- _parse("an autorule marker", $aftererror,$line);
+ _parse("an autorule marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$::RD_AUTOSTUB = $1;
}
elsif ($grammar =~ m/$AUTOTREEMK/gco)
{
my $base = defined($1) ? $1 : "";
+ my $current_match = substr($grammar, $-[0], $+[0] - $-[0]);
$base .= "::" if $base && $base !~ /::$/;
- _parse("an autotree marker", $aftererror,$line);
+ _parse("an autotree marker", $aftererror,$line, $current_match);
if ($rule)
{
_error("<autotree> directive not at start of grammar", $line);
@@ -2063,7 +2072,7 @@
elsif ($grammar =~ m/$REJECTMK/gco)
{
- _parse("an reject marker", $aftererror,$line);
+ _parse("an reject marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::UncondReject($lookahead,$line,"<reject>");
$prod and $prod->additem($item)
or _no_rule("<reject>",$line);
@@ -2072,7 +2081,7 @@
and do { ($code) = extract_codeblock($grammar,'{',undef,'<');
$code })
{
- _parse("a (conditional) reject marker", $aftererror,$line);
+ _parse("a (conditional) reject marker", $aftererror,$line, $code );
$code =~ /\A\s*reject:(.*)\Z/s;
my $cond = $1;
$item = new Parse::RecDescent::Directive(
@@ -2084,7 +2093,7 @@
and do { ($code) = extract_codeblock($grammar,'{',undef,'<');
$code })
{
- _parse("a score marker", $aftererror,$line);
+ _parse("a score marker", $aftererror,$line, $code );
$code =~ /\A\s*score:(.*)\Z/s;
$prod and $prod->addscore($1, $lookahead, $line)
or _no_rule($code,$line);
@@ -2106,9 +2115,9 @@
}
elsif ($grammar =~ m/$RESYNCMK/gco)
{
- _parse("a resync to newline marker", $aftererror,$line);
+ _parse("a resync to newline marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::Directive(
- 'if ($text =~ s/\A[^\n]*\n//) { $return = 0; $& } else { undef }',
+ 'if ($text =~ s/(\A[^\n]*\n)//) { $return = 0; $1; } else { undef }',
$lookahead,$line,"<resync>");
$prod and $prod->additem($item)
or _no_rule("<resync>",$line);
@@ -2117,10 +2126,10 @@
and do { ($code) = extract_bracketed($grammar,'<');
$code })
{
- _parse("a resync with pattern marker", $aftererror,$line);
+ _parse("a resync with pattern marker", $aftererror,$line, $code );
$code =~ /\A\s*resync:(.*)\Z/s;
$item = new Parse::RecDescent::Directive(
- 'if ($text =~ s/\A'.$1.'//) { $return = 0; $& } else { undef }',
+ 'if ($text =~ s/(\A'.$1.')//) { $return = 0; $1; } else { undef }',
$lookahead,$line,$code);
$prod and $prod->additem($item)
or _no_rule($code,$line);
@@ -2129,7 +2138,7 @@
and do { ($code) = extract_codeblock($grammar,'<');
$code })
{
- _parse("a skip marker", $aftererror,$line);
+ _parse("a skip marker", $aftererror,$line, $code );
$code =~ /\A\s*skip:(.*)\Z/s;
$item = new Parse::RecDescent::Directive(
'my $oldskip = $skip; $skip='.$1.'; $oldskip',
@@ -2217,36 +2226,36 @@
}
elsif ($grammar =~ m/$COMMITMK/gco)
{
- _parse("an commit marker", $aftererror,$line);
+ _parse("an commit marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::Directive('$commit = 1',
$lookahead,$line,"<commit>");
$prod and $prod->additem($item)
or _no_rule("<commit>",$line);
}
elsif ($grammar =~ m/$NOCHECKMK/gco) {
- _parse("an hint request", $aftererror,$line);
+ _parse("an hint request", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$::RD_CHECK = 0;
}
elsif ($grammar =~ m/$HINTMK/gco) {
- _parse("an hint request", $aftererror,$line);
+ _parse("an hint request", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$::RD_HINT = $self->{__HINT__} = 1;
}
elsif ($grammar =~ m/$WARNMK/gco) {
- _parse("an warning request", $aftererror,$line);
+ _parse("an warning request", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$::RD_WARN = $self->{__WARN__} = $1 ? $2+0 : 1;
}
elsif ($grammar =~ m/$TRACEBUILDMK/gco) {
- _parse("an grammar build trace request", $aftererror,$line);
+ _parse("an grammar build trace request", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$::RD_TRACE = $1 ? $2+0 : 1;
}
elsif ($grammar =~ m/$TRACEPARSEMK/gco) {
- _parse("an parse trace request", $aftererror,$line);
+ _parse("an parse trace request", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$self->{__TRACE__} = $1 ? $2+0 : 1;
}
elsif ($grammar =~ m/$AUTOERRORMK/gco)
{
$commitonly = $1;
- _parse("an error marker", $aftererror,$line);
+ _parse("an error marker", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::Error('',$lookahead,$1,$line);
$prod and $prod->additem($item)
or _no_rule("<error>",$line);
@@ -2293,7 +2302,7 @@
elsif ($grammar =~ m/$RULE/gco)
{
_parseunneg("a rule declaration", 0,
- $lookahead,$line) or next;
+ $lookahead,$line, substr($grammar, $-[0], $+[0] - $-[0]) ) or next;
my $rulename = $1;
if ($rulename =~ /Replace|Extend|Precompile|Save/ )
{
@@ -2318,7 +2327,7 @@
{
pos($grammar)-=9;
_parseunneg("a new (uncommitted) production",
- 0, $lookahead, $line) or next;
+ 0, $lookahead, $line, substr($grammar, $-[0], $+[0] - $-[0]) ) or next;
$prod->check_pending($line) if $prod;
$prod = new Parse::RecDescent::Production($line,1);
@@ -2330,7 +2339,7 @@
{
pos($grammar)-=6;
_parseunneg("a new (error) production", $aftererror,
- $lookahead,$line) or next;
+ $lookahead,$line, substr($grammar, $-[0], $+[0] - $-[0]) ) or next;
$prod->check_pending($line) if $prod;
$prod = new Parse::RecDescent::Production($line,0,1);
$rule and $rule->addprod($prod)
@@ -2340,7 +2349,7 @@
elsif ($grammar =~ m/$PROD/gco)
{
_parseunneg("a new production", 0,
- $lookahead,$line) or next;
+ $lookahead,$line, substr($grammar, $-[0], $+[0] - $-[0]) ) or next;
$rule
and (!$prod || $prod->check_pending($line))
and $prod = $rule->addprod(new Parse::RecDescent::Production($line))
@@ -2357,14 +2366,14 @@
}
elsif ($grammar =~ m/$INTERPLIT/gco)
{
- _parse("an interpolated literal terminal", $aftererror,$line);
+ _parse("an interpolated literal terminal", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::InterpLit($1,$lookahead,$line);
$prod and $prod->additem($item)
or _no_rule("interpolated literal terminal",$line,"'$1'");
}
elsif ($grammar =~ m/$TOKEN/gco)
{
- _parse("a /../ pattern terminal", $aftererror,$line);
+ _parse("a /../ pattern terminal", $aftererror,$line, substr($grammar, $-[0], $+[0] - $-[0]) );
$item = new Parse::RecDescent::Token($1,'/',$3?$3:'',$lookahead,$line);
$prod and $prod->additem($item)
or _no_rule("pattern terminal",$line,"/$1/");
@@ -2574,14 +2583,15 @@
}
elsif ($grammar =~ m/$BADREP/gco)
{
- _parse("an subrule match with invalid repetition specifier", 0,$line);
+ my $current_match = substr($grammar, $-[0], $+[0] - $-[0]);
+ _parse("an subrule match with invalid repetition specifier", 0,$line, $current_match);
_error("Incorrect specification of a repeated subrule",
$line);
- _hint("Repeated subrules like \"$code$argcode$&\" cannot have
+ _hint("Repeated subrules like \"$code$argcode$current_match\" cannot have
a maximum repetition of zero, nor can they have
negative components in their ranges.");
}
- }
+ }
else
{
_parse("a subrule match", $aftererror,$line,$code);
@@ -2645,7 +2655,10 @@
$grammar =~ m/\G\s+/gc;
}
- pop @lines;
+
+ if ($must_pop_lines) {
+ pop @lines;
+ }
unless ($ERRORS or $isimplicit or !$::RD_CHECK)
{
@@ -2708,13 +2721,14 @@
)
{
return unless $1 eq $subrule && $min > 0;
- _warn(3,"Subrule sequence \"$subrule($repspec) $&\" will
+ my $current_match = substr($grammar, $-[0], $+[0] - $-[0]);
+ _warn(3,"Subrule sequence \"$subrule($repspec) $current_match\" will
(almost certainly) fail.",$line)
and
_hint("Unless subrule \"$subrule\" performs some cunning
lookahead, the repetition \"$subrule($repspec)\" will
insatiably consume as many matches of \"$subrule\" as it
- can, leaving none to match the \"$&\" that follows.");
+ can, leaving none to match the \"$current_match\" that follows.");
}
}
@@ -3049,22 +3063,22 @@
}
}
-sub _parseunneg($$$$)
+sub _parseunneg($$$$$)
{
- _parse($_[0],$_[1],$_[3]);
+ _parse($_[0],$_[1],$_[3],$_[4]);
if ($_[2]<0)
{
- _error("Can't negate \"$&\".",$_[3]);
+ _error("Can't negate \"$_[4]\".",$_[3]);
_hint("You can't negate $_[0]. Remove the \"...!\" before
- \"$&\".");
+ \"$_[4]\".");
return 0;
}
return 1;
}
-sub _parse($$$;$)
+sub _parse($$$$)
{
- my $what = $_[3] || $&;
+ my $what = $_[3];
$what =~ s/^\s+//;
if ($_[1])
{
@@ -3368,7 +3382,7 @@
to an array containing the values matched by each call to the individual
subrule "statement".
-Repetition modifieres may include a separator pattern:
+Repetition modifiers may include a separator pattern:
program: statement(s /;/)
@@ -5192,9 +5206,9 @@
list, since the C and C directives
require at least a single right or left operand to match. To specify
that the operator can match "trivially",
-it's necessary to add a C<(?)> qualifier to the directive:
+it's necessary to add a C<(s?)> qualifier to the directive:
- list: '(' )/ list_item>(?) ')'
+ list: '(' )/ list_item>(s?) ')'
Note that in almost all the above examples, the first and third arguments
of the C< directive were the same subrule. That is because
@@ -5953,6 +5967,25 @@
=back
+=head1 SUPPORT
+
+=head2 Mailing List
+
+Visit Lhttp://www.perlfoundation.org/perl5/index.cgi?parse_recdescent to sign up for the mailing list.
+
+Lhttp://www.PerlMonks.org is also a good place to ask questions.
+
+=head2 FAQ
+
+Visit LParse::RecDescent::FAQ for answers to frequently (and not so
+frequently) asked questions about Parse::RecDescent
+
+=head1 SEE ALSO
+
+LRegexp::Grammars provides Parse::RecDescent style parsing using native
+Perl 5.10 regular expressions.
+
+
=head1 LICENCE AND COPYRIGHT
Copyright (c) 1997-2007, Damian Conway C<< >>. All rights
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/t/basics.t new/Parse-RecDescent-1.962.2/t/basics.t
--- old/Parse-RecDescent-1.96.0/t/basics.t 2007-09-29 20:55:44.000000000 +0200
+++ new/Parse-RecDescent-1.962.2/t/basics.t 2009-08-27 20:08:15.000000000 +0200
@@ -12,7 +12,7 @@
$loaded = 1;
print "ok 1\n";
-sub debug { $D || 0 }
+sub debug { $D || $D || 0 }
my $count = 2;
sub ok($;$)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/t/re_capture_return.t new/Parse-RecDescent-1.962.2/t/re_capture_return.t
--- old/Parse-RecDescent-1.96.0/t/re_capture_return.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Parse-RecDescent-1.962.2/t/re_capture_return.t 2009-08-28 13:39:13.000000000 +0200
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+use Parse::RecDescent;
+
+my $parser = Parse::RecDescent->new(<<'EOG');
+
+{
+ my %ret;
+}
+
+CONFIG : KV_PAIR(s) { return \%ret }
+
+KV_PAIR : WORD /\s*=\s*/ MAYBE_QUOTED_WORD { $ret{$item[1]} = $item[3] }
+
+MAYBE_QUOTED_WORD: WORD
+ | /'([^']+)'/ { $return = $1 }
+ | /"([^"]+)"/ { $return = $1 }
+
+WORD : /\w+/
+
+EOG
+
+ok($parser, 'Created parser');
+
+my $str = q|a=1 b="2" c ="33" d= '12'|;
+
+my $result = $parser->CONFIG($str);
+
+is_deeply($result, { a => 1, b => 2, c => 33, d => 12 } );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Parse-RecDescent-1.96.0/t/separated_repetition.t new/Parse-RecDescent-1.962.2/t/separated_repetition.t
--- old/Parse-RecDescent-1.96.0/t/separated_repetition.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Parse-RecDescent-1.962.2/t/separated_repetition.t 2009-08-28 13:39:26.000000000 +0200
@@ -0,0 +1,25 @@
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+use Parse::RecDescent;
+
+my $parser = Parse::RecDescent->new( q{
+ sep: some(?) '(' repeated(s? /,/) ')' 'elements'
+ {
+ $return = $item[3];
+ }
+
+ repeated: 'repeated'
+
+ some: 'some'
+ });
+
+ok($parser, 'Created parser');
+
+my $str = 'some (repeated, repeated, repeated, repeated) elements';
+my $result = $parser->sep($str);
+
+my $expected = ['repeated', 'repeated', 'repeated', 'repeated'];
+
+is_deeply($result, $expected);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org