diff -Nru libregexp-grammars-perl-1.016/Changes libregexp-grammars-perl-1.021/Changes --- libregexp-grammars-perl-1.016/Changes 2012-03-09 20:01:30.000000000 +0000 +++ libregexp-grammars-perl-1.021/Changes 2012-08-20 03:55:34.000000000 +0000 @@ -209,3 +209,30 @@ * Fixed omissions in charset recognition within metagrammar (now handles \] and otehr escapes correctly) + + +1.020 Thu Aug 16 14:13:03 2012 + + * Fixed licence generation in Makefile.PL + + * Fixed issues with the stupid behaviour + of Perl 5.17+ wrt (un)backslashed {'s + + * Fixed bad code in SYNOPSIS example + (Thanks Paul!) + + * Fixed bad code in demo/demo_pos.pl + (Thanks Peng) + + * Corrected docs for + (Thanks Peng) + + * BACKWARDS INCOMPATIBLE CHANGE!!!! + Due to limitations in Perl's qr overload + The <\IDENT> backreference syntax has had to be changed + to <\_IDENT> + + +1.021 Mon Aug 20 13:55:34 2012 + + * Made Latin-1 encoding of docs explicit diff -Nru libregexp-grammars-perl-1.016/MANIFEST libregexp-grammars-perl-1.021/MANIFEST --- libregexp-grammars-perl-1.016/MANIFEST 2012-03-09 20:01:46.000000000 +0000 +++ libregexp-grammars-perl-1.021/MANIFEST 2012-08-20 03:55:52.000000000 +0000 @@ -93,5 +93,4 @@ t/seplist_rawhash.t t/seplist_starhash.t t/error_non_hash_based.t -META.yml Module YAML meta-data (added by MakeMaker) -META.json Module JSON meta-data (added by MakeMaker) +META.yml Module meta-data (added by MakeMaker) diff -Nru libregexp-grammars-perl-1.016/META.json libregexp-grammars-perl-1.021/META.json --- libregexp-grammars-perl-1.016/META.json 2012-03-09 20:01:46.000000000 +0000 +++ libregexp-grammars-perl-1.021/META.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -{ - "abstract" : "Add grammatical parsing features to Perl 5.10 regexes", - "author" : [ - "Damian Conway " - ], - "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150", - "license" : [ - "unknown" - ], - "meta-spec" : { - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" - }, - "name" : "Regexp-Grammars", - "no_index" : { - "directory" : [ - "t", - "inc" - ] - }, - "prereqs" : { - "build" : { - "requires" : { - "ExtUtils::MakeMaker" : 0 - } - }, - "configure" : { - "requires" : { - "ExtUtils::MakeMaker" : 0 - } - }, - "runtime" : { - "requires" : { - "Test::More" : 0, - "version" : 0 - } - } - }, - "release_status" : "stable", - "version" : "1.016" -} diff -Nru libregexp-grammars-perl-1.016/META.yml libregexp-grammars-perl-1.021/META.yml --- libregexp-grammars-perl-1.016/META.yml 2012-03-09 20:01:46.000000000 +0000 +++ libregexp-grammars-perl-1.021/META.yml 2012-08-20 03:55:52.000000000 +0000 @@ -1,23 +1,23 @@ ---- -abstract: 'Add grammatical parsing features to Perl 5.10 regexes' +--- #YAML:1.0 +name: Regexp-Grammars +version: 1.021 +abstract: Add grammatical parsing features to Perl 5.10 regexes author: - - 'Damian Conway ' -build_requires: - ExtUtils::MakeMaker: 0 + - Damian Conway +license: perl +distribution_type: module configure_requires: - ExtUtils::MakeMaker: 0 -dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150' -license: unknown -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 -name: Regexp-Grammars -no_index: - directory: - - t - - inc + ExtUtils::MakeMaker: 0 +build_requires: + ExtUtils::MakeMaker: 0 requires: - Test::More: 0 - version: 0 -version: 1.016 + Test::More: 0 + version: 0 +no_index: + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.57_05 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff -Nru libregexp-grammars-perl-1.016/Makefile.PL libregexp-grammars-perl-1.021/Makefile.PL --- libregexp-grammars-perl-1.016/Makefile.PL 2009-04-16 11:28:55.000000000 +0000 +++ libregexp-grammars-perl-1.021/Makefile.PL 2012-03-27 09:36:21.000000000 +0000 @@ -5,12 +5,13 @@ WriteMakefile( NAME => 'Regexp::Grammars', AUTHOR => 'Damian Conway ', + LICENSE => 'perl', VERSION_FROM => 'lib/Regexp/Grammars.pm', ABSTRACT_FROM => 'lib/Regexp/Grammars.pm', PL_FILES => {}, - PREREQ_PM => { - 'Test::More' => 0, - 'version' => 0, + PREREQ_PM => { + 'Test::More' => 0, + 'version' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Regexp-Grammars-*' }, diff -Nru libregexp-grammars-perl-1.016/README libregexp-grammars-perl-1.021/README --- libregexp-grammars-perl-1.016/README 2012-03-09 20:01:30.000000000 +0000 +++ libregexp-grammars-perl-1.021/README 2012-08-20 03:55:34.000000000 +0000 @@ -1,4 +1,4 @@ -Regexp::Grammars version 1.016 +Regexp::Grammars version 1.021 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. diff -Nru libregexp-grammars-perl-1.016/debian/changelog libregexp-grammars-perl-1.021/debian/changelog --- libregexp-grammars-perl-1.016/debian/changelog 2012-05-19 18:36:13.000000000 +0000 +++ libregexp-grammars-perl-1.021/debian/changelog 2013-01-12 12:53:39.000000000 +0000 @@ -1,4 +1,4 @@ -libregexp-grammars-perl (1.016-1ubuntu1~oneiric0) oneiric; urgency=low +libregexp-grammars-perl (1.021-1ubuntu1~oneiric0) oneiric; urgency=low * Build diff -Nru libregexp-grammars-perl-1.016/debian/control libregexp-grammars-perl-1.021/debian/control --- libregexp-grammars-perl-1.016/debian/control 2012-05-19 18:36:13.000000000 +0000 +++ libregexp-grammars-perl-1.021/debian/control 2013-01-12 12:53:39.000000000 +0000 @@ -4,7 +4,7 @@ Build-Depends: debhelper (>= 7), perl (>= 5.10) | libmodule-build-perl Build-Depends-Indep: perl Maintainer: Aliaksandr Zahatski -Homepage: http://search.cpan.org/dist/Tie-UnionHash/ +Homepage: http://search.cpan.org/dist/Regexp-Grammars/ Package: libregexp-grammars-perl Architecture: all diff -Nru libregexp-grammars-perl-1.016/demo/demo_pos.pl libregexp-grammars-perl-1.021/demo/demo_pos.pl --- libregexp-grammars-perl-1.016/demo/demo_pos.pl 2010-07-31 12:48:10.000000000 +0000 +++ libregexp-grammars-perl-1.021/demo/demo_pos.pl 2012-08-08 22:41:34.000000000 +0000 @@ -10,8 +10,9 @@ - qq? - | qq? + qq? + | qq? + [[:punct:]]++ diff -Nru libregexp-grammars-perl-1.016/lib/Regexp/Grammars.pm libregexp-grammars-perl-1.021/lib/Regexp/Grammars.pm --- libregexp-grammars-perl-1.016/lib/Regexp/Grammars.pm 2012-03-09 20:01:30.000000000 +0000 +++ libregexp-grammars-perl-1.021/lib/Regexp/Grammars.pm 2012-08-20 03:55:34.000000000 +0000 @@ -1,3 +1,6 @@ +=encoding ISO8859-1 +=cut + package Regexp::Grammars; use warnings; @@ -7,7 +10,7 @@ use Scalar::Util qw< blessed reftype >; use Data::Dumper qw< Dumper >; -our $VERSION = '1.016'; +our $VERSION = '1.021'; # Load the module... @@ -1493,13 +1496,16 @@ \[ (?(?&IDENT)) \s* = \s* (?(?&HASH)) \s* (?(?&BRACES))? \s* \] ) | (? - \s* (? \\ | /) (? :? (?&QUALIDENT)) \s* + \s* (? \\ | /) (? [:] (?&QUALIDENT)) \s* + | \s* (? \\_ | /) (? (?&QUALIDENT)) \s* ) | (? - (?(?&IDENT)) \s* = \s* (? \\ | /) (? :? (?&QUALIDENT)) \s* + (?(?&IDENT)) \s* = \s* (? \\ | /) (? [:] (?&QUALIDENT)) \s* + | (?(?&IDENT)) \s* = \s* (? \\_ | /) (? (?&QUALIDENT)) \s* ) | (? - \[ (?(?&IDENT)) \s* = \s* (? \\ | /) (? :? (?&QUALIDENT)) \s* \] + \[ (?(?&IDENT)) \s* = \s* (? \\ | /) (? [:] (?&QUALIDENT)) \s* \] + | \[ (?(?&IDENT)) \s* = \s* (? \\_ | /) (? (?&QUALIDENT)) \s* \] ) | (? @@ -1567,10 +1573,10 @@ ) (?(DEFINE) - (? \*\* | [*+?][+?]?\s*% | {\d+(,\d*)?}[+?]?\s*% ) + (? \*\* | [*+?][+?]?\s*% | \{ \d+(,\d*)? \} [+?]?\s*% ) (? \( (?:[?]<[=!])? (?: \\. | (?&PARENCODE) | (?&PARENS) | (?&CHARSET) | [^][()\\<>]++ )*+ \) ) (? \{ (?: \\. | (?&BRACES) | [^{}\\]++ )*+ \} ) - (? \(\?\{ (?: \\. | (?&BRACES) | [^{}\\]++ )*+ \}\) ) + (? \(\?[{] (?: \\. | (?&BRACES) | [^{}\\]++ )*+ [}]\) ) (? \% (?&IDENT) (?: :: (?&IDENT) )* ) (? \[ \^?+ \]?+ (?: \[:\w+:\] | \\. | [^]] )*+ \] ) (? [^\W\d]\w*+ ) @@ -1583,7 +1589,7 @@ (? (?&VAR) | (?&KEY) \s* => \s* (?&LITERAL) ) (? : (?&IDENT) ) (? (?&IDENT) | (?&LITERAL) ) - (? [*+?][+?]? | {\d+,?\d*}[+?]?i ) + (? [*+?][+?]? | \{ \d+,?\d* \} [+?]?i ) ) }{ my $curr_construct = $+{construct}; @@ -1761,7 +1767,7 @@ } my $backref = qq{\$Regexp::Grammars::RESULT_STACK[-1]{'$subrule'}}; - my $quoter = $+{slash} eq '\\' + my $quoter = $+{slash} eq '\\' || $+{slash} eq '\\_' ? "quotemeta($backref)" : "Regexp::Grammars::_invert_delim($backref)" ; @@ -2386,7 +2392,7 @@ # Report anything that starts like a subrule, but isn't... my %seen = ( '' => 1, '' => 1, '' => 1, '' => 1); # autogenerated - while ($regex =~ m{( (?] )}gxms) { + while ($regex =~ m/( (?] )/gxms) { my $construct = $1; my $something = $2 ? 'directive' : 'subrule call'; @@ -2433,7 +2439,7 @@ =head1 VERSION -This document describes Regexp::Grammars version 1.016 +This document describes Regexp::Grammars version 1.021 =head1 SYNOPSIS @@ -2446,7 +2452,7 @@ <.ws> # Parse but don't save whitespace # Parse and save a Noun in a scalar - 0.5 ? 'VN' : 'VerbNoun' }> + 0.5 ? 'VN' : 'VerbNoun' })> # Save result of expression in a scalar | (?: @@ -2459,7 +2465,7 @@ # Parse a Verb and save result in a scalar (saved under the key 'Verb') - # Save a literal in a scalar + # Save a literal in a scalar | # Turn on the integrated debugger here <.Cmd= (?: mv? )> # Parse but don't capture a subpattern @@ -2545,8 +2551,8 @@ <%HASH> Match longest possible key of hash <%HASH {PAT}> Match any key of hash that also matches PAT - <\IDENT> Match the literal contents of $MATCH{IDENT} Match closing delimiter for $MATCH{IDENT} + <\_IDENT> Match the literal contents of $MATCH{IDENT} Call subrule, save result in $MATCH{ALIAS} Match a hash key, save key in $MATCH{ALIAS} @@ -2554,9 +2560,8 @@ Execute code, save value in $MATCH{ALIAS} Save specified string in $MATCH{ALIAS} Save specified number in $MATCH{ALIAS} - Match /$MATCH{IDENT}/, save as $MATCH{ALIAS} - Match '$MATCH{IDENT}', save as $MATCH{ALIAS} - Match closing delim, save as $MATCH{ALIAS} + Match closing delim, save as $MATCH{ALIAS} + Match '$MATCH{IDENT}', save as $MATCH{ALIAS} <.SUBRULE> Call subrule (one of the above forms), but don't save the result in %MATCH @@ -3335,7 +3340,7 @@ as the subpattern, instead of the contents of C<(?&RULENAME)> Likewise, the C<< <\:ARGNAME> >> and C<< >> constructs work -exactly like C<< <\MATCHNAME> >> and C<< >> respectively, +exactly like C<< <\_MATCHNAME> >> and C<< >> respectively, except that the leading colon indicates that the matchref or invertref should be taken from C<%ARG> instead of from C<%MATCH>. @@ -3838,18 +3843,18 @@ <[command]>+ - end<\keyword> + end<\_keyword> -A directive of the form C<<< <\I> >>> is known as a +A directive of the form C<<< <\_I> >>> is known as a "matchref" (an abbreviation of "%MATCH-supplied backreference"). -Matchrefs always attempts to match, as a literal, the current value of +Matchrefs always attempt to match, as a literal, the current value of C<<< $MATCH{I} >>>. By default, a matchref does not capture what it matches, but you can have it do so by giving it an alias: - .*? + .*? ["'`] @@ -3860,7 +3865,7 @@ consistent internal representation for those alternatives, like so: - .*? + .*? | - <[endmarkers=\marker]>+ + <[endmarkers=\_marker]>+ Be careful though, as the following will not do as you may expect: - <[marker]>+ <[endmarkers=\marker]>+ + <[marker]>+ <[endmarkers=\_marker]>+ because the value of C<$MATCH{marker}> will be an array reference, which the matchref will flatten and concatenate, then match the @@ -3896,12 +3901,19 @@ this problem rarely arises in practice. +I Prior to Regexp::Grammars version 1.020, the syntax for matchrefs +was C<<< <\I> >>> instead of C<<< <\_I> >>>. This +created problems when the identifier started with any of C, C, C, +C, C, or C, so the syntax has had to be altered in a backwards +incompatible way. It will not be altered again. +> + =head2 Rematching balanced delimiters Consider the example in the previous section: - .*? + .*? | - .*? - | .*? + .*? + | .*? because that would incorrectly match: @@ -3955,7 +3967,7 @@ example can be refactored to: - .*? + .*? | Like matchrefs, invertrefs come in the usual range of flavours: @@ -3972,7 +3984,7 @@ backrefs: a backref starts with a C<\> (just like the standard Perl regex backrefs C<\1> and C<\g{-2}> and C<< \k >>), whereas an inverseref starts with a C (like an HTML or XML closing tag). Or -just remember that C<< <\IDENT> >> is "match the same again", and if you +just remember that C<< <\_IDENT> >> is "match the same again", and if you want "the same again, only mirrored" instead, just mirror the C<\> to get C<< >>. @@ -3988,10 +4000,10 @@ useful when refactoring subrules. For example, instead of: - end_ <\Keyword> + end_ <\_Keyword> - \.\.\. end_ <\Keyword> + \.\.\. end_ <\_Keyword> you could parameterize the Terminator rule, like so: @@ -4186,7 +4198,7 @@ \s* , \s* }x; -Thsi creates a grammar named C, and installs it in the module's +This creates a grammar named C, and installs it in the module's internal caches, for future reference. Note that there is no need (or reason) to assign the resulting regex to @@ -4917,14 +4929,14 @@ and the command specified in the directive immediately executed. The available commands are: - - Enable debugging, stop when entire grammar matches + - Enable debugging, stop when a rule matches - Enable debugging, stop when a rule matches - Enable debugging, stop when a rule is tried + - Enable debugging, run until the match completes - Continue debugging (or not) as currently - Disable debugging and continue parsing silently - - Synonym for - - Synonym for + - Synonym for - Synonym for These directives can be placed anywhere within a grammar and take effect @@ -5075,6 +5087,10 @@ =head2 Debugging non-grammars +I<[Note that, with the release in 2012 of the Regexp::Debugger module (on +CPAN) the techniques described below are unnecessary. If you need to +debug plain Perl regexes, use Regexp::Debugger instead.]> + It is possible to use Regexp::Grammars without creating I subrule definitions, simply to debug a recalcitrant regex. For example, if the following regex wasn't working as expected: @@ -5134,7 +5150,6 @@ warn Dumper \%/; } - =head1 Handling errors when parsing Assuming you have correctly debugged your grammar, the next source of problems diff -Nru libregexp-grammars-perl-1.016/t/backref.t libregexp-grammars-perl-1.021/t/backref.t --- libregexp-grammars-perl-1.016/t/backref.t 2010-08-02 11:40:34.000000000 +0000 +++ libregexp-grammars-perl-1.021/t/backref.t 2012-08-16 02:44:20.000000000 +0000 @@ -5,9 +5,9 @@ use Regexp::Grammars; -my $delimited = qr{ <\delim> }xms; -my $delimited_cap = qr{ }xms; -my $delimited_listcap = qr{ <[rdel=\delim]> }xms; +my $delimited = qr{ <\_delim> }xms; +my $delimited_cap = qr{ }xms; +my $delimited_listcap = qr{ <[rdel=\_delim]> }xms; no Regexp::Grammars; diff -Nru libregexp-grammars-perl-1.016/t/charset.t libregexp-grammars-perl-1.021/t/charset.t --- libregexp-grammars-perl-1.016/t/charset.t 2012-03-09 19:52:49.000000000 +0000 +++ libregexp-grammars-perl-1.021/t/charset.t 2012-03-09 20:06:43.000000000 +0000 @@ -10,21 +10,21 @@ - \[ \] + \[ \] }xms; my $escaped_bs = qr{ - \[ \] + \[ \] }xms; my $old_bracket = qr{ - \[ \] + \[ \] }xms; no Regexp::Grammars; diff -Nru libregexp-grammars-perl-1.016/t/local_ws.t libregexp-grammars-perl-1.021/t/local_ws.t --- libregexp-grammars-perl-1.016/t/local_ws.t 2011-11-01 10:43:21.000000000 +0000 +++ libregexp-grammars-perl-1.021/t/local_ws.t 2012-06-16 07:36:54.000000000 +0000 @@ -41,7 +41,7 @@ <[statement]> ** ( ; ) - # Another type within statements + # Another type within statements <[arg]> ** ( , )