r63020 - in /branches/upstream/libregexp-grammars-perl/current: Changes MANIFEST META.yml README demo/demo_LaTeXish_dump.pl lib/Regexp/Grammars.pm t/repop_ws.t t/top_is_token.t
carnil-guest at users.alioth.debian.org
carnil-guest at users.alioth.debian.org
Tue Sep 28 12:13:51 UTC 2010
Author: carnil-guest
Date: Tue Sep 28 12:13:11 2010
New Revision: 63020
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=63020
Log:
[svn-upgrade] new version libregexp-grammars-perl (1.010)
Added:
branches/upstream/libregexp-grammars-perl/current/t/repop_ws.t
branches/upstream/libregexp-grammars-perl/current/t/top_is_token.t
Modified:
branches/upstream/libregexp-grammars-perl/current/Changes
branches/upstream/libregexp-grammars-perl/current/MANIFEST
branches/upstream/libregexp-grammars-perl/current/META.yml
branches/upstream/libregexp-grammars-perl/current/README
branches/upstream/libregexp-grammars-perl/current/demo/demo_LaTeXish_dump.pl
branches/upstream/libregexp-grammars-perl/current/lib/Regexp/Grammars.pm
Modified: branches/upstream/libregexp-grammars-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libregexp-grammars-perl/current/Changes?rev=63020&op=diff
==============================================================================
--- branches/upstream/libregexp-grammars-perl/current/Changes (original)
+++ branches/upstream/libregexp-grammars-perl/current/Changes Tue Sep 28 12:13:11 2010
@@ -115,3 +115,16 @@
* Rerelease to remove spurious dependencies on Data::Show
(thanks Salvatore!)
+
+
+
+1.010 Tue Sep 28 08:03:42 2010
+
+ * Added documentation warning about non-reentrancy of Perl 5 regex engine
+ (thanks Andrew).
+
+ * Fixed behaviour of ** repetitions wrt whitespace (thanks Andrew)
+
+ * Documented more explicitly that start-pattern is supposed to act
+ like a regular regex (or a token) wrt to whitespace
+
Modified: branches/upstream/libregexp-grammars-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libregexp-grammars-perl/current/MANIFEST?rev=63020&op=diff
==============================================================================
--- branches/upstream/libregexp-grammars-perl/current/MANIFEST (original)
+++ branches/upstream/libregexp-grammars-perl/current/MANIFEST Tue Sep 28 12:13:11 2010
@@ -53,4 +53,6 @@
t/local_ws.t
t/matchline.t
t/matchpos.t
+t/repop_ws.t
+t/top_is_token.t
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libregexp-grammars-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libregexp-grammars-perl/current/META.yml?rev=63020&op=diff
==============================================================================
--- branches/upstream/libregexp-grammars-perl/current/META.yml (original)
+++ branches/upstream/libregexp-grammars-perl/current/META.yml Tue Sep 28 12:13:11 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Regexp-Grammars
-version: 1.009
+version: 1.010
abstract: Add grammatical parsing features to Perl 5.10 regexes
license: ~
author:
Modified: branches/upstream/libregexp-grammars-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libregexp-grammars-perl/current/README?rev=63020&op=diff
==============================================================================
--- branches/upstream/libregexp-grammars-perl/current/README (original)
+++ branches/upstream/libregexp-grammars-perl/current/README Tue Sep 28 12:13:11 2010
@@ -1,4 +1,4 @@
-Regexp::Grammars version 1.009
+Regexp::Grammars version 1.010
This module adds a small number of new regex constructs that can be used
within Perl 5.10 patterns to implement complete recursive-descent parsing.
Modified: branches/upstream/libregexp-grammars-perl/current/demo/demo_LaTeXish_dump.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libregexp-grammars-perl/current/demo/demo_LaTeXish_dump.pl?rev=63020&op=diff
==============================================================================
--- branches/upstream/libregexp-grammars-perl/current/demo/demo_LaTeXish_dump.pl (original)
+++ branches/upstream/libregexp-grammars-perl/current/demo/demo_LaTeXish_dump.pl Tue Sep 28 12:13:11 2010
@@ -73,8 +73,8 @@
my $input = do{ local $/; <DATA>};
if ($input =~ $parser) {
- use Data::Dump 'dump';
- warn dump [ \%/ ];
+ use Data::Dumper 'Dumper';
+ warn Dumper [ \%/ ];
}
Modified: branches/upstream/libregexp-grammars-perl/current/lib/Regexp/Grammars.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libregexp-grammars-perl/current/lib/Regexp/Grammars.pm?rev=63020&op=diff
==============================================================================
--- branches/upstream/libregexp-grammars-perl/current/lib/Regexp/Grammars.pm (original)
+++ branches/upstream/libregexp-grammars-perl/current/lib/Regexp/Grammars.pm Tue Sep 28 12:13:11 2010
@@ -7,7 +7,7 @@
use Scalar::Util qw< blessed >;
use Data::Dumper qw< Dumper >;
-our $VERSION = '1.009';
+our $VERSION = '1.010';
# Load the module...
sub import {
@@ -1218,6 +1218,7 @@
$post_match_debug,
$rule_name,
$subrule_names_ref,
+ $magic_ws,
) = @_;
# Remember the preceding construct, so as to implement the ** operator...
@@ -1545,7 +1546,7 @@
# Handle the ** operator...
if ($+{list_marker}) {
- my $ws = $+{ws1} . $+{ws2};
+ my $ws = $magic_ws ? $+{ws1} . $+{ws2} : q{};
$curr_translation = _translate_separated_list(
$prev_construct, $curr_construct,
@@ -1916,6 +1917,7 @@
$post_match_debug,
q{}, # Expected...what?
\%subrule_names,
+ 0 # Whitespace isn't magical
);
# Report how construct was interpreted, if requested to...
@@ -1956,6 +1958,7 @@
$post_match_debug,
$callname, # Expected...what?
\%subrule_names,
+ $type eq 'rule', # Is whitespace magical?
);
# Report how construct was interpreted, if requested to...
@@ -2065,7 +2068,7 @@
=head1 VERSION
-This document describes Regexp::Grammars version 1.009
+This document describes Regexp::Grammars version 1.010
=head1 SYNOPSIS
@@ -2428,8 +2431,13 @@
}xms;
The start-pattern at the beginning of the grammar acts like the
-"top" rule of the grammar, and must be matched completely for the
+"top" token of the grammar, and must be matched completely for the
grammar to match.
+
+This pattern is treated like a token for whitespace
+matching behaviour (see L<"Tokens vs rules (whitespace handling)">).
+That is, whitespace in the start-pattern is treated like whitespace
+in any normal Perl regex.
The rules and tokens are declarations only and they are not directly matched.
Instead, they act like subroutines, and are invoked by name from the
@@ -5212,6 +5220,21 @@
=item *
+The Perl 5 regex engine is not reentrant. So any attempt to perform
+a regex match inside a C<(?{ ... })> or C<(??{ ... })> will almost
+certainly lead to either weird data corruption or a segfault.
+
+The same calamities can also occur in any constructor called by
+C<< <objrule:> >>. If the constructor invokes another regex in any
+way, it will most likely fail catastrophically. In particular, this
+means that Moose constructors will frequently crash and burn within
+a Regex::Grammars grammar (for example, if the Moose-based class
+declares an attribute type constraint such as 'Int', which Moose
+checks using a regex).
+
+
+=item *
+
The additional regex constructs this module provides are implemented by
rewriting regular expressions. This is a (safer) form of source
filtering, but still subject to all the same limitations and
Added: branches/upstream/libregexp-grammars-perl/current/t/repop_ws.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libregexp-grammars-perl/current/t/repop_ws.t?rev=63020&op=file
==============================================================================
--- branches/upstream/libregexp-grammars-perl/current/t/repop_ws.t (added)
+++ branches/upstream/libregexp-grammars-perl/current/t/repop_ws.t Tue Sep 28 12:13:11 2010
@@ -1,0 +1,52 @@
+#!/usr/bin/perl
+
+use 5.010;
+use strict;
+use warnings;
+use Regexp::Grammars;
+use Test::More tests => 4;
+
+# The text to match against
+my $text = 'a' . (' ' x 5) . 'z';
+
+# This should match without backtracking
+my $repop_match = qr/
+ \A<TOP>\Z
+
+ <token: TOP> <[val]> ** <sep>
+ <token: sep> \s{5}
+ <token: val> \w+
+/x;
+
+# This should NOT match
+my $repop_nomatch = qr/
+ \A<TOP>\Z
+
+ <token: TOP> <[val]> ** <sep>
+ <token: sep> \s{3}
+ <token: val> \w+
+/x;
+
+# This demonstrates the expected behaviour of $repop_match
+my $standard_match = qr/
+ \A<TOP>\Z
+
+ <token: TOP> <[val]> (?: <sep> <[val]> )*
+ <token: sep> \s{5}
+ <token: val> \w+
+/x;
+
+# This demonstrates the expected behaviour of $repop_nomatch
+my $standard_nomatch = qr/
+ \A<TOP>\Z
+
+ <token: TOP> <[val]> (?: <sep> <[val]> )*
+ <token: sep> \s{3}
+ <token: val> \w+
+/x;
+
+ok $text =~ $repop_match => "Repetition operator correctly matches";
+ok $text !~ $repop_nomatch => "Repetition operator correctly doesn't match";
+
+ok $text =~ $standard_match => "Simulation correctly matches";
+ok $text !~ $standard_nomatch => "Simulation correctly doesn't match";
Added: branches/upstream/libregexp-grammars-perl/current/t/top_is_token.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libregexp-grammars-perl/current/t/top_is_token.t?rev=63020&op=file
==============================================================================
--- branches/upstream/libregexp-grammars-perl/current/t/top_is_token.t (added)
+++ branches/upstream/libregexp-grammars-perl/current/t/top_is_token.t Tue Sep 28 12:13:11 2010
@@ -1,0 +1,28 @@
+use Test::More 'no_plan';
+
+use Regexp::Grammars;
+
+my $grammar_top = qr{
+ ^ a b $
+}xms;
+
+my $grammar_rule = qr{
+ <Rule>
+
+ <rule: Rule> ^ a b $
+}xms;
+
+my $grammar_token = qr{
+ <Token>
+
+ <token: Token> ^ a b $
+}xms;
+
+ok 'ab' =~ $grammar_top => 'Top correctly matches without space';
+ok 'a b' !~ $grammar_top => 'Top correctly fails with space';
+
+ok 'ab' =~ $grammar_token => 'Token correctly matches without space';
+ok 'a b' !~ $grammar_token => 'Token correctly fails with space';
+
+ok 'ab' =~ $grammar_rule => 'Rule correctly matches without space';
+ok 'a b' =~ $grammar_rule => 'Rule correctly matches with space';
More information about the Pkg-perl-cvs-commits
mailing list