diff -Nru libregexp-grammars-perl-1.042/Changes libregexp-grammars-perl-1.044/Changes --- libregexp-grammars-perl-1.042/Changes 2015-09-16 06:32:23.000000000 +0000 +++ libregexp-grammars-perl-1.044/Changes 2015-12-15 21:22:01.000000000 +0000 @@ -406,3 +406,19 @@ * Replaced Lexical::Vars with B::Hooks::Parser for 5.22+ compatibility (Thanks Alex!) + + +1.043 Mon Dec 14 13:14:25 2015 + + * Eliminated redundant calls to setup() and teardown() for B::Hooks::Parser + + * Removed timeout test, as it cannot be reliably run across platforms + much faster or slower than the author's development platform. + (Thanls Slavin) + + +1.044 Wed Dec 16 08:22:01 2015 + + * Yet another attempt to code around the changes in vars-inside-regexes + to preserve post-5.18 compatibility (Thanks, Kent!) + diff -Nru libregexp-grammars-perl-1.042/debian/changelog libregexp-grammars-perl-1.044/debian/changelog --- libregexp-grammars-perl-1.042/debian/changelog 2015-12-13 16:47:46.000000000 +0000 +++ libregexp-grammars-perl-1.044/debian/changelog 2015-12-16 10:05:24.000000000 +0000 @@ -1,3 +1,9 @@ +libregexp-grammars-perl (1.044-1ubuntu1~xenial0) xenial; urgency=low + + * compat level + + -- Aliaksandr Zahatski Sat, 16 Dec 2015 07:14:29 +0200 + libregexp-grammars-perl (1.042-1ubuntu6~xenial0) xenial; urgency=low * compat level diff -Nru libregexp-grammars-perl-1.042/lib/Regexp/Grammars.pm libregexp-grammars-perl-1.044/lib/Regexp/Grammars.pm --- libregexp-grammars-perl-1.042/lib/Regexp/Grammars.pm 2015-09-16 06:32:23.000000000 +0000 +++ libregexp-grammars-perl-1.044/lib/Regexp/Grammars.pm 2015-12-15 21:22:01.000000000 +0000 @@ -7,11 +7,12 @@ use warnings; use strict; use 5.010; +use vars (); use Scalar::Util qw< blessed reftype >; use Data::Dumper qw< Dumper >; -our $VERSION = '1.042'; +our $VERSION = '1.044'; my $anon_scalar_ref = \do{my $var}; my $MAGIC_VARS = q{my ($CAPTURE, $CONTEXT, $DEBUG, $INDEX, $MATCH, %ARG, %MATCH);}; @@ -62,10 +63,10 @@ # Sanctify the standard Regexp::Grammars pseudo-variables from # Perl 5.18's early enforcement of strictures... - require B::Hooks::Parser; - my $id = B::Hooks::Parser::setup(); - B::Hooks::Parser::inject( $MAGIC_VARS ); - B::Hooks::Parser::teardown($id); + my $caller = caller; + warnings->unimport('once'); + @_ = ( 'vars', '$CAPTURE', '$CONTEXT', '$DEBUG', '$INDEX', '$MATCH', '%ARG', '%MATCH' ); + goto &vars::import; } } @@ -2018,9 +2019,9 @@ }exmsg; # Translate magic hash accesses... - $grammar_spec =~ s{\$MATCH (?= \s*\{) } + $grammar_spec =~ s{\$(?:\:\:)?MATCH (?= \s*\{) } {\$Regexp::Grammars::RESULT_STACK[-1]}xmsg; - $grammar_spec =~ s{\$ARG (?= \s*\{) } + $grammar_spec =~ s{\$(?:\:\:)?ARG (?= \s*\{) } {\$Regexp::Grammars::RESULT_STACK[-1]{'\@'}}xmsg; # Translate magic scalars and hashes... @@ -2034,6 +2035,17 @@ q{$DEBUG} => q{$Regexp::Grammars::DEBUG}, q{$INDEX} => q{${\\pos()}}, q{%ARG} => q{%{$Regexp::Grammars::RESULT_STACK[-1]{'@'}}}, + + q{%$::MATCH} => q{%{$Regexp::Grammars::RESULT_STACK[-1]{q{=}}}}, + q{@$::MATCH} => q{@{$Regexp::Grammars::RESULT_STACK[-1]{q{=}}}}, + q{$::MATCH} => q{$Regexp::Grammars::RESULT_STACK[-1]{q{=}}}, + q{%::MATCH} => q{%{$Regexp::Grammars::RESULT_STACK[-1]}}, + q{$::CAPTURE} => q{$^N}, + q{$::CONTEXT} => q{$^N}, + q{$::DEBUG} => q{$Regexp::Grammars::DEBUG}, + q{$::INDEX} => q{${\\pos()}}, + q{%::ARG} => q{%{$Regexp::Grammars::RESULT_STACK[-1]{'@'}}}, + }; state $translatable_scalar = join '|', map {quotemeta $_} @@ -2648,7 +2660,7 @@ =head1 VERSION -This document describes Regexp::Grammars version 1.042 +This document describes Regexp::Grammars version 1.044 =head1 SYNOPSIS diff -Nru libregexp-grammars-perl-1.042/MANIFEST libregexp-grammars-perl-1.044/MANIFEST --- libregexp-grammars-perl-1.042/MANIFEST 2015-09-16 06:32:40.000000000 +0000 +++ libregexp-grammars-perl-1.044/MANIFEST 2015-12-15 21:22:11.000000000 +0000 @@ -46,7 +46,6 @@ t/pod.t t/repop_ws.t t/seplist.t -t/timeout.t t/top_is_token.t demo/demo_IP4.pl demo/demo_LaTeXish.pl @@ -98,5 +97,6 @@ t/one_liner.t t/clear_actions.t t/ws_redefine.t +t/pseudovars.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) diff -Nru libregexp-grammars-perl-1.042/META.json libregexp-grammars-perl-1.044/META.json --- libregexp-grammars-perl-1.042/META.json 2015-09-16 06:32:40.000000000 +0000 +++ libregexp-grammars-perl-1.044/META.json 2015-12-15 21:22:11.000000000 +0000 @@ -38,5 +38,5 @@ } }, "release_status" : "stable", - "version" : "1.042" + "version" : "1.044" } diff -Nru libregexp-grammars-perl-1.042/META.yml libregexp-grammars-perl-1.044/META.yml --- libregexp-grammars-perl-1.042/META.yml 2015-09-16 06:32:40.000000000 +0000 +++ libregexp-grammars-perl-1.044/META.yml 2015-12-15 21:22:11.000000000 +0000 @@ -20,4 +20,4 @@ requires: Test::More: '0' version: '0' -version: '1.042' +version: '1.044' diff -Nru libregexp-grammars-perl-1.042/README libregexp-grammars-perl-1.044/README --- libregexp-grammars-perl-1.042/README 2015-09-16 06:32:23.000000000 +0000 +++ libregexp-grammars-perl-1.044/README 2015-12-15 21:22:01.000000000 +0000 @@ -1,4 +1,4 @@ -Regexp::Grammars version 1.042 +Regexp::Grammars version 1.044 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.042/t/aliased_subpatterns.t libregexp-grammars-perl-1.044/t/aliased_subpatterns.t --- libregexp-grammars-perl-1.042/t/aliased_subpatterns.t 2014-06-10 20:31:57.000000000 +0000 +++ libregexp-grammars-perl-1.044/t/aliased_subpatterns.t 2015-11-27 06:41:48.000000000 +0000 @@ -24,7 +24,7 @@ }; if ($] < 5.018 || $] >= 5.020) { - ok !defined $WARNINGS => 'No warnings'; + ok !defined $WARNINGS => "No warnings found '$WARNINGS'"; } ok +('"abc"' =~ $parser) => 'Matched '; diff -Nru libregexp-grammars-perl-1.042/t/arg.t libregexp-grammars-perl-1.044/t/arg.t --- libregexp-grammars-perl-1.042/t/arg.t 2014-06-10 20:32:47.000000000 +0000 +++ libregexp-grammars-perl-1.044/t/arg.t 2015-11-27 06:47:23.000000000 +0000 @@ -18,14 +18,14 @@ | - scalar(reverse($MATCH{keyword})) })> + scalar(reverse($::MATCH{keyword})) })> - (??{ quotemeta( ($ARG{prefix}//q{}) . $ARG{keyword} ) }) + (??{ quotemeta( ($::ARG{prefix}//q{}) . $::ARG{keyword} ) }) - (<:delim>) + (<:delim>) }xms; }; diff -Nru libregexp-grammars-perl-1.042/t/pseudovars.t libregexp-grammars-perl-1.044/t/pseudovars.t --- libregexp-grammars-perl-1.042/t/pseudovars.t 1970-01-01 00:00:00.000000000 +0000 +++ libregexp-grammars-perl-1.044/t/pseudovars.t 2015-12-15 21:16:28.000000000 +0000 @@ -0,0 +1,25 @@ +use strict; +use warnings; + + +# ABSTRACT: Test Regexp::Grammars exports package symbols. + +use Regexp::Grammars; +use Test::More; + +sub has_var { + my ($varname) = @_; + local $@; + eval <<"EOF"; + my \$grammar = qr{} +EOF + note $@ if $@; + return !$@; +} + +for my $varname (qw( $CAPTURE $CONTEXT $DEBUG $INDEX $MATCH %ARG %MATCH )) { + ok( has_var($varname), "Has $varname" ); +} + +done_testing; + diff -Nru libregexp-grammars-perl-1.042/t/timeout.t libregexp-grammars-perl-1.044/t/timeout.t --- libregexp-grammars-perl-1.042/t/timeout.t 2014-06-10 20:32:23.000000000 +0000 +++ libregexp-grammars-perl-1.044/t/timeout.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -use 5.010; -use warnings; - -use Test::More; -plan 'no_plan'; - -#=====[ Test zero timeout ]============================================= - -my %AcceptableVersions = ( - '0.95' => 1, - '0.98' => 1, - '1.01' => 1, -); - -my $version_checker = do{ - use Regexp::Grammars; - qr{ - - - - vers = <%AcceptableVersions> - | - vers = - - - }xms; -}; - -ok 'vers = 0.95' =~ $version_checker => 'Matched version 0.95'; -ok @! == 0 => 'with no error messages'; - -ok 'vers = 0.96' !~ $version_checker => 'Correctly failed to match version 0.96'; -ok @! == 1 => 'with correct number of error messages'; -is $![0], 'Cannot parse language version 0.96' => 'with correct error message'; - - -#=====[ Test regular timeouts ]============================================= - -my $calculator = do{ - use Regexp::Grammars; - qr{ - - - - - ( <.Mult> ** <.Op=([+-])> ) - - - - ( <.Pow> ** <.Op=([*/%])> ) - - - - \^ - - | - - - - (?{ sleep 1 }) - | \( \) - - - - }xms -}; - -ok '2*2*2' !~ $calculator => 'Correctly failed to match 2*2*2'; -ok @! == 1 => 'with single error message'; -is $![0], 'Internal error: Timed out after 5 seconds (as requested)' - => 'and the correct error message'; - -ok '2*2' =~ $calculator => 'Matched 2*2'; -is $/{Answer}, '4' => 'with correct result'; -ok @! == 0 => 'and without error message'; - -ok '2' =~ $calculator => 'Matched 2'; -is $/{Answer}, '2' => 'with correct result'; -ok @! == 0 => 'and without error message';