r43146 - in /branches/upstream/libparse-recdescent-perl/current: Changes MANIFEST META.yml README lib/Parse/RecDescent.pm t/basics.t t/re_capture_return.t t/separated_repetition.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Fri Aug 28 14:36:05 UTC 2009


Author: jawnsy-guest
Date: Fri Aug 28 14:35:47 2009
New Revision: 43146

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=43146
Log:
[svn-upgrade] Integrating new upstream version, libparse-recdescent-perl (1.962.2+dfsg)

Added:
    branches/upstream/libparse-recdescent-perl/current/t/re_capture_return.t
    branches/upstream/libparse-recdescent-perl/current/t/separated_repetition.t
Modified:
    branches/upstream/libparse-recdescent-perl/current/Changes
    branches/upstream/libparse-recdescent-perl/current/MANIFEST
    branches/upstream/libparse-recdescent-perl/current/META.yml
    branches/upstream/libparse-recdescent-perl/current/README
    branches/upstream/libparse-recdescent-perl/current/lib/Parse/RecDescent.pm
    branches/upstream/libparse-recdescent-perl/current/t/basics.t

Modified: branches/upstream/libparse-recdescent-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-recdescent-perl/current/Changes?rev=43146&op=diff
==============================================================================
--- branches/upstream/libparse-recdescent-perl/current/Changes (original)
+++ branches/upstream/libparse-recdescent-perl/current/Changes Fri Aug 28 14:35:47 2009
@@ -566,3 +566,12 @@
     - 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
+

Modified: branches/upstream/libparse-recdescent-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-recdescent-perl/current/MANIFEST?rev=43146&op=diff
==============================================================================
--- branches/upstream/libparse-recdescent-perl/current/MANIFEST (original)
+++ branches/upstream/libparse-recdescent-perl/current/MANIFEST Fri Aug 28 14:35:47 2009
@@ -7,11 +7,6 @@
 lib/Parse/RecDescent.pm
 t/00.load.t
 t/pod.t
-tutorial/tutorial.html
-tutorial/TPJ-PRD-proc.gif
-tutorial/TPJ-yacc-proc.gif
-tutorial/TPJ_maze.gif
-tutorial/TPJ_tree.gif
 demo/demo.c
 demo/demo.pl
 demo/demo_Cgrammar.pl
@@ -78,3 +73,5 @@
 demo/demo_undumper.pl
 demo/demo_whoson.pl
 t/basics.t
+t/re_capture_return.t
+t/separated_repetition.t

Modified: branches/upstream/libparse-recdescent-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-recdescent-perl/current/META.yml?rev=43146&op=diff
==============================================================================
--- branches/upstream/libparse-recdescent-perl/current/META.yml (original)
+++ branches/upstream/libparse-recdescent-perl/current/META.yml Fri Aug 28 14:35:47 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Parse-RecDescent
-version:             1.962.0
+version:             1.962.2
 abstract:            Generate Recursive-Descent Parsers
 license:             ~
 author:              

Modified: branches/upstream/libparse-recdescent-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-recdescent-perl/current/README?rev=43146&op=diff
==============================================================================
--- branches/upstream/libparse-recdescent-perl/current/README (original)
+++ branches/upstream/libparse-recdescent-perl/current/README Fri Aug 28 14:35:47 2009
@@ -1,4 +1,4 @@
-Parse::RecDescent version 1.962.0
+Parse::RecDescent version 1.962.2
 
 NAME
 

Modified: branches/upstream/libparse-recdescent-perl/current/lib/Parse/RecDescent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-recdescent-perl/current/lib/Parse/RecDescent.pm?rev=43146&op=diff
==============================================================================
--- branches/upstream/libparse-recdescent-perl/current/lib/Parse/RecDescent.pm (original)
+++ branches/upstream/libparse-recdescent-perl/current/lib/Parse/RecDescent.pm Fri Aug 28 14:35:47 2009
@@ -1130,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();
@@ -1141,7 +1140,8 @@
 
             last;
         }
-        $current_match = $1;
+		$current_match = substr($text, $-[0], $+[0] - $-[0]);
+        substr($text,0,length($current_match),q{});
         Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
                         . $current_match . q{])},
                           Parse::RecDescent::_tracefirst($text))
@@ -1203,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();
@@ -1212,7 +1212,8 @@
                             if defined $::RD_TRACE;
             last;
         }
-        $current_match = $1;
+		$current_match = substr($text, $-[0], $+[0] - $-[0]);
+        substr($text,0,length($current_match),q{});
         Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
                         . $current_match . q{])},
                           Parse::RecDescent::_tracefirst($text))
@@ -1593,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;
@@ -1619,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;
@@ -1722,7 +1723,7 @@
 
 my $ERRORS = 0;
 
-use version; our $VERSION = qv('1.962.0');
+use version; our $VERSION = qv('1.962.2');
 
 # BUILDING A PARSER
 
@@ -3381,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 /;/)
 
@@ -5966,6 +5967,25 @@
 
 =back
 
+=head1 SUPPORT
+
+=head2 Mailing List
+
+Visit L<http://www.perlfoundation.org/perl5/index.cgi?parse_recdescent> to sign up for the mailing list.
+
+L<http://www.PerlMonks.org> is also a good place to ask questions.
+
+=head2 FAQ
+
+Visit L<Parse::RecDescent::FAQ> for answers to frequently (and not so
+frequently) asked questions about Parse::RecDescent
+
+=head1 SEE ALSO
+
+L<Regexp::Grammars> provides Parse::RecDescent style parsing using native
+Perl 5.10 regular expressions.
+
+
 =head1 LICENCE AND COPYRIGHT
 
 Copyright (c) 1997-2007, Damian Conway C<< <DCONWAY at CPAN.org> >>. All rights

Modified: branches/upstream/libparse-recdescent-perl/current/t/basics.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-recdescent-perl/current/t/basics.t?rev=43146&op=diff
==============================================================================
--- branches/upstream/libparse-recdescent-perl/current/t/basics.t (original)
+++ branches/upstream/libparse-recdescent-perl/current/t/basics.t Fri Aug 28 14:35:47 2009
@@ -12,7 +12,7 @@
 $loaded = 1;
 print "ok 1\n";
 
-sub debug { $D || 0 }
+sub debug { $D || $D || 0 }
 
 my $count = 2;
 sub ok($;$)

Added: branches/upstream/libparse-recdescent-perl/current/t/re_capture_return.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-recdescent-perl/current/t/re_capture_return.t?rev=43146&op=file
==============================================================================
--- branches/upstream/libparse-recdescent-perl/current/t/re_capture_return.t (added)
+++ branches/upstream/libparse-recdescent-perl/current/t/re_capture_return.t Fri Aug 28 14:35:47 2009
@@ -1,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 } );

Added: branches/upstream/libparse-recdescent-perl/current/t/separated_repetition.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-recdescent-perl/current/t/separated_repetition.t?rev=43146&op=file
==============================================================================
--- branches/upstream/libparse-recdescent-perl/current/t/separated_repetition.t (added)
+++ branches/upstream/libparse-recdescent-perl/current/t/separated_repetition.t Fri Aug 28 14:35:47 2009
@@ -1,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);




More information about the Pkg-perl-cvs-commits mailing list