Hello community,
here is the log from the commit of package perl-PPIx-QuoteLike for
openSUSE:Factory checked in at 2020-03-14 09:53:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-PPIx-QuoteLike (Old)
and /work/SRC/openSUSE:Factory/.perl-PPIx-QuoteLike.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-PPIx-QuoteLike"
Sat Mar 14 09:53:52 2020 rev:5 rq:783464 version:0.010
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-PPIx-QuoteLike/perl-PPIx-QuoteLike.changes
2020-03-03 10:14:34.674443992 +0100
+++
/work/SRC/openSUSE:Factory/.perl-PPIx-QuoteLike.new.3160/perl-PPIx-QuoteLike.changes
2020-03-14 09:53:53.415046268 +0100
@@ -1,0 +2,10 @@
+Tue Mar 10 03:25:57 UTC 2020 - <[email protected]>
+
+- updated to 0.010
+ see /usr/share/doc/packages/perl-PPIx-QuoteLike/Changes
+
+ 0.010 2020-03-09 T. R. Wyant
+ Remove redundant and poorly-performing code introduced in version
+ 0.009.
+
+-------------------------------------------------------------------
Old:
----
PPIx-QuoteLike-0.009.tar.gz
New:
----
PPIx-QuoteLike-0.010.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-PPIx-QuoteLike.spec ++++++
--- /var/tmp/diff_new_pack.bEOUPU/_old 2020-03-14 09:53:54.119046784 +0100
+++ /var/tmp/diff_new_pack.bEOUPU/_new 2020-03-14 09:53:54.119046784 +0100
@@ -17,7 +17,7 @@
Name: perl-PPIx-QuoteLike
-Version: 0.009
+Version: 0.010
Release: 0
%define cpan_name PPIx-QuoteLike
Summary: Parse Perl string literals and string-literal-like things
++++++ PPIx-QuoteLike-0.009.tar.gz -> PPIx-QuoteLike-0.010.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/Changes
new/PPIx-QuoteLike-0.010/Changes
--- old/PPIx-QuoteLike-0.009/Changes 2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/Changes 2020-03-09 15:58:51.000000000 +0100
@@ -1,3 +1,7 @@
+0.010 2020-03-09 T. R. Wyant
+ Remove redundant and poorly-performing code introduced in version
+ 0.009.
+
0.009 2020-02-27 T. R. Wyant
Add new() argument index_locations which causes locations to be
indexed during the parse. This defaults based on whether a location
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/META.json
new/PPIx-QuoteLike-0.010/META.json
--- old/PPIx-QuoteLike-0.009/META.json 2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/META.json 2020-03-09 15:58:51.000000000 +0100
@@ -47,51 +47,51 @@
"provides" : {
"PPIx::QuoteLike" : {
"file" : "lib/PPIx/QuoteLike.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Constant" : {
"file" : "lib/PPIx/QuoteLike/Constant.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Dumper" : {
"file" : "lib/PPIx/QuoteLike/Dumper.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Token" : {
"file" : "lib/PPIx/QuoteLike/Token.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Token::Control" : {
"file" : "lib/PPIx/QuoteLike/Token/Control.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Token::Delimiter" : {
"file" : "lib/PPIx/QuoteLike/Token/Delimiter.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Token::Interpolation" : {
"file" : "lib/PPIx/QuoteLike/Token/Interpolation.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Token::String" : {
"file" : "lib/PPIx/QuoteLike/Token/String.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Token::Structure" : {
"file" : "lib/PPIx/QuoteLike/Token/Structure.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Token::Unknown" : {
"file" : "lib/PPIx/QuoteLike/Token/Unknown.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Token::Whitespace" : {
"file" : "lib/PPIx/QuoteLike/Token/Whitespace.pm",
- "version" : "0.009"
+ "version" : "0.010"
},
"PPIx::QuoteLike::Utils" : {
"file" : "lib/PPIx/QuoteLike/Utils.pm",
- "version" : "0.009"
+ "version" : "0.010"
}
},
"release_status" : "stable",
@@ -109,6 +109,6 @@
"web" : "https://github.com/trwyant/perl-PPIx-QuoteLike"
}
},
- "version" : "0.009",
+ "version" : "0.010",
"x_serialization_backend" : "JSON::PP version 4.04"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/META.yml
new/PPIx-QuoteLike-0.010/META.yml
--- old/PPIx-QuoteLike-0.009/META.yml 2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/META.yml 2020-03-09 15:58:51.000000000 +0100
@@ -19,40 +19,40 @@
provides:
PPIx::QuoteLike:
file: lib/PPIx/QuoteLike.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Constant:
file: lib/PPIx/QuoteLike/Constant.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Dumper:
file: lib/PPIx/QuoteLike/Dumper.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Token:
file: lib/PPIx/QuoteLike/Token.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Token::Control:
file: lib/PPIx/QuoteLike/Token/Control.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Token::Delimiter:
file: lib/PPIx/QuoteLike/Token/Delimiter.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Token::Interpolation:
file: lib/PPIx/QuoteLike/Token/Interpolation.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Token::String:
file: lib/PPIx/QuoteLike/Token/String.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Token::Structure:
file: lib/PPIx/QuoteLike/Token/Structure.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Token::Unknown:
file: lib/PPIx/QuoteLike/Token/Unknown.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Token::Whitespace:
file: lib/PPIx/QuoteLike/Token/Whitespace.pm
- version: '0.009'
+ version: '0.010'
PPIx::QuoteLike::Utils:
file: lib/PPIx/QuoteLike/Utils.pm
- version: '0.009'
+ version: '0.010'
requires:
Carp: '0'
Encode: '0'
@@ -71,5 +71,5 @@
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-QuoteLike
license: http://dev.perl.org/licenses/
repository: git://github.com/trwyant/perl-PPIx-QuoteLike.git
-version: '0.009'
+version: '0.010'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/eg/pqldump
new/PPIx-QuoteLike-0.010/eg/pqldump
--- old/PPIx-QuoteLike-0.009/eg/pqldump 2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/eg/pqldump 2020-03-09 15:58:51.000000000 +0100
@@ -9,7 +9,7 @@
use Pod::Usage;
use PPIx::QuoteLike::Dumper;
-our $VERSION = '0.009';
+our $VERSION = '0.010';
my %opt;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/eg/variables
new/PPIx-QuoteLike-0.010/eg/variables
--- old/PPIx-QuoteLike-0.009/eg/variables 2020-02-27 15:51:12.000000000
+0100
+++ new/PPIx-QuoteLike-0.010/eg/variables 2020-03-09 15:58:51.000000000
+0100
@@ -10,7 +10,7 @@
use PPI::Document;
use PPIx::QuoteLike::Utils qw{ __variables };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
my %opt;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/inc/My/Module/Recommend/Any.pm
new/PPIx-QuoteLike-0.010/inc/My/Module/Recommend/Any.pm
--- old/PPIx-QuoteLike-0.009/inc/My/Module/Recommend/Any.pm 2020-02-27
15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/inc/My/Module/Recommend/Any.pm 2020-03-09
15:58:51.000000000 +0100
@@ -12,7 +12,7 @@
BEGIN {
*import = \&Exporter::import;
}
-our $VERSION = '0.009';
+our $VERSION = '0.010';
our @EXPORT_OK = qw{ __any };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Constant.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Constant.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Constant.pm 2020-02-27
15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Constant.pm 2020-03-09
15:58:51.000000000 +0100
@@ -8,7 +8,7 @@
use Carp;
use base qw{ Exporter };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
our @CARP_NOT = qw{
PPIx::QuoteLike
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Dumper.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Dumper.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Dumper.pm 2020-02-27
15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Dumper.pm 2020-03-09
15:58:51.000000000 +0100
@@ -12,7 +12,7 @@
use PPIx::QuoteLike::Utils qw{ __instance };
use Scalar::Util ();
-our $VERSION = '0.009';
+our $VERSION = '0.010';
use constant SCALAR_REF => ref \0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Control.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Control.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Control.pm
2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Control.pm
2020-03-09 15:58:51.000000000 +0100
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
{
# TODO make this a state variable when we can require Perl 5.10.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Delimiter.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Delimiter.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Delimiter.pm
2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Delimiter.pm
2020-03-09 15:58:51.000000000 +0100
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ MINIMUM_PERL @CARP_NOT };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
# Perl 5.29.0 disallows unassigned code points and combining code points
# as delimiters. Unfortunately for me non-characters and illegal
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Interpolation.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Interpolation.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Interpolation.pm
2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Interpolation.pm
2020-03-09 15:58:51.000000000 +0100
@@ -18,7 +18,7 @@
use base qw{ PPIx::QuoteLike::Token };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
sub ppi {
my ( $self ) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/String.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/String.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/String.pm 2020-02-27
15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/String.pm 2020-03-09
15:58:51.000000000 +0100
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Structure.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Structure.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Structure.pm
2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Structure.pm
2020-03-09 15:58:51.000000000 +0100
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Unknown.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Unknown.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Unknown.pm
2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Unknown.pm
2020-03-09 15:58:51.000000000 +0100
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Whitespace.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Whitespace.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token/Whitespace.pm
2020-02-27 15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Whitespace.pm
2020-03-09 15:58:51.000000000 +0100
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.009';
+our $VERSION = '0.010';
sub significant {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Token.pm 2020-02-27
15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token.pm 2020-03-09
15:58:51.000000000 +0100
@@ -16,7 +16,7 @@
visual_column_number
};
-our $VERSION = '0.009';
+our $VERSION = '0.010';
# Private to this package.
sub __new {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Utils.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Utils.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike/Utils.pm 2020-02-27
15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Utils.pm 2020-03-09
15:58:51.000000000 +0100
@@ -35,7 +35,7 @@
__variables
};
-our $VERSION = '0.009';
+our $VERSION = '0.010';
sub column_number {
my ( $self ) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike.pm
new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike.pm
--- old/PPIx-QuoteLike-0.009/lib/PPIx/QuoteLike.pm 2020-02-27
15:51:12.000000000 +0100
+++ new/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike.pm 2020-03-09
15:58:51.000000000 +0100
@@ -38,7 +38,15 @@
use Scalar::Util ();
use Text::Tabs ();
-our $VERSION = '0.009';
+our $VERSION = '0.010';
+
+use constant CLASS_CONTROL => 'PPIx::QuoteLike::Token::Control';
+use constant CLASS_DELIMITER => 'PPIx::QuoteLike::Token::Delimiter';
+use constant CLASS_INTERPOLATION => 'PPIx::QuoteLike::Token::Interpolation';
+use constant CLASS_STRING => 'PPIx::QuoteLike::Token::String';
+use constant CLASS_STRUCTURE => 'PPIx::QuoteLike::Token::Structure';
+use constant CLASS_UNKNOWN => 'PPIx::QuoteLike::Token::Unknown';
+use constant CLASS_WHITESPACE => 'PPIx::QuoteLike::Token::Whitespace';
use constant CODE_REF => ref sub {};
@@ -101,8 +109,8 @@
( $type, $gap, $start_delim ) = ( $1, $2, $3 );
not $gap
and $start_delim =~ m< \A \w \z >smx
- and return $self->_link_elems( $self->_unknown(
- $string, ILLEGAL_FIRST ) );
+ and return $self->_link_elems( $self->_make_token(
+ CLASS_UNKNOWN, $string, error => ILLEGAL_FIRST ) );
$arg{trace}
and warn "Initial match '$type$start_delim'\n";
$self->{interpolates} = 'qq' eq $type ||
@@ -132,14 +140,14 @@
$end_delim = '';
}
$self->{start} = [
- $self->_make_token( Delimiter => content => $start_delim ),
- $self->_make_token( Whitespace => content => "\n" ),
+ $self->_make_token( CLASS_DELIMITER, $start_delim ),
+ $self->_make_token( CLASS_WHITESPACE, "\n" ),
];
# Don't instantiate yet -- we'll do them at the end.
$self->{finish} = [
- [ Delimiter => content => $end_delim ],
- [ Whitespace => content => "\n" ],
+ [ CLASS_DELIMITER, $end_delim ],
+ [ CLASS_WHITESPACE, "\n" ],
];
# ``, '', "", <>
@@ -160,94 +168,76 @@
} else {
$arg{trace}
and warn "No initial match\n";
- return $self->_link_elems( $self->_unknown(
- $string, ILLEGAL_FIRST ) );
+ return $self->_link_elems( $self->_make_token(
+ CLASS_UNKNOWN, $string, error => ILLEGAL_FIRST ) );
}
$self->{interpolates} = $self->{interpolates} ? 1 : 0;
$self->{type} = [
- $self->_make_token( Structure => content => $type ),
+ $self->_make_token( CLASS_STRUCTURE, $type ),
length $gap ?
- $self->_make_token( Whitespace => content => $gap ) :
+ $self->_make_token( CLASS_WHITESPACE, $gap ) :
(),
];
$self->{start} ||= [
- $self->_make_token( Delimiter => content => $start_delim ),
+ $self->_make_token( CLASS_DELIMITER, $start_delim ),
];
$arg{trace}
and warn "Without delimiters: '$content'\n";
+ # We accumulate data and manufacure tokens at the end to reduce
+ # the overhead involved in merging strings.
if ( $self->{interpolates} ) {
- { # Single-iteration loop
+ push @children, [ '' => '' ]; # Prime the pump
+ while ( 1 ) {
if ( $content =~ m/ \G ( \\ [ULulQEF] ) /smxgc ) {
- push @children, $self->_make_token(
- Control => content => "$1", # Remove magic
- );
- redo;
- }
-
- # Handle \N{...} separately because it can not contain
- # an interpolation even inside of an
- # otherwise-interpolating string. That is to say,
- # "\N{$foo}" is simply invalid, and does not even try to
- # interpolate $foo. {
- if ( $content =~ m/ \G ( \\ N [{] ( [^}]+ ) [}] ) /smxgc ) {
+ push @children, [ CLASS_CONTROL, "$1" ];
+ } elsif ( $content =~ m/ \G ( \\ N [{] ( [^}]+ ) [}] ) /smxgc )
{
+ # Handle \N{...} separately because it can not
+ # contain an interpolation even inside of an
+ # otherwise-interpolating string. That is to say,
+ # "\N{$foo}" is simply invalid, and does not even
+ # try to interpolate $foo. {
+ # TODO use $re = _match_enclosed( '{' ); # }
my ( $seq, $name ) = ( $1, $2 );
# TODO The Regexp is certainly too permissive. For
# the moment all I am doing is disallowing
# interpolation.
push @children, $name =~ m/ [\$\@] /smx ?
- $self->_unknown( $seq, "Unknown charname '$name'" ) :
- $self->_make_token( String => content => $seq );
- redo;
- }
-
- if ( $content =~ m/ \G ( [\$\@] \#? \$* ) /smxgc ) {
+ [ CLASS_UNKNOWN, $seq,
+ error => "Unknown charname '$name'" ] :
+ [ CLASS_STRING, $seq ];
+ } elsif ( $content =~ m/ \G ( [\$\@] \#? \$* ) /smxgc ) {
push @children, $self->_interpolation( "$1", $content );
- redo;
+ } elsif ( $content =~ m/ \G ( \\ . | [^\\\$\@]+ ) /smxgc ) {
+ push @children, [ CLASS_STRING, "$1" ];
+ } else {
+ last;
}
-
- if ( $content =~ m/ \G ( \\ . | [^\\\$\@]+ ) /smxgc ) {
- my $content = $1;
- @children
- and $children[-1]->isa(
- 'PPIx::QuoteLike::Token::String' )
- and $content = ( pop @children )->content() .
- $content;
- push @children, $self->_make_token(
- String => content => $content,
- );
- redo;
+ } continue {
+ # We might have consecutive strings for various reasons.
+ # Merge these.
+ if ( CLASS_STRING eq $children[-1][0] &&
+ CLASS_STRING eq $children[-2][0] ) {
+ my $merge = pop @children;
+ $children[-1][1] .= $merge->[1];
}
}
+ shift @children; # remove the priming
- # We might have consecutive strings if _interpolation()
- # generated a string rather than an interpolation. Merge
- # these.
- # FIXME if I'm to tokenize strictly left-to-right I need to
- # do this on the fly.
- my @rslt;
- foreach my $elem ( @children ) {
- if ( $elem->isa( 'PPIx::QuoteLike::Token::String' ) &&
- @rslt &&
- $rslt[-1]->isa( 'PPIx::QuoteLike::Token::String' )
- ) {
- $rslt[-1]{content} .= $elem->{content};
- } else {
- push @rslt, $elem;
- }
+ # Make the tokens, at long last.
+ foreach ( @children ) {
+ $_ = $self->_make_token( @{ $_ } );
}
- @children = @rslt;
} else {
length $content
and push @children, $self->_make_token(
- String => content => $content,
- );
+ CLASS_STRING, $content );
}
@@ -258,7 +248,7 @@
}
} else {
$self->{finish} = [
- $self->_make_token( Delimiter => content => $end_delim ),
+ $self->_make_token( CLASS_DELIMITER, $end_delim ),
];
}
@@ -358,10 +348,10 @@
}
sub _make_token {
- my ( $self, $class, %arg ) = @_;
- $class =~ m/ \A PPIx::QuoteLike::Token:: /smx
- or substr $class, 0, 0, 'PPIx::QuoteLike::Token::';
- my $token = $class->__new( %arg );
+ my ( $self, $class, $content, %arg ) = @_;
+ my $token = $class->__new( content => $content, %arg );
+ CLASS_UNKNOWN eq $class
+ and $self->{failures}++;
$self->{index_locations}
and $self->_update_location( $token );
return $token;
@@ -592,20 +582,18 @@
my %special = (
'$$' => sub { # Process ID.
- my ( $self, $sigil ) = @_;
- return $self->_make_token( Interpolation => content => $sigil );
+ my ( undef, $sigil ) = @_;
+ return [ CLASS_INTERPOLATION, $sigil ];
},
'$' => sub { # Called if we find (e.g.) '$@'
- my ( $self, $sigil ) = @_;
+ my ( undef, $sigil ) = @_;
$_[2] =~ m/ \G ( [\@] ) /smxgc
or return;
- return $self->_make_token(
- Interpolation => content => "$sigil$1",
- );
+ return [ CLASS_INTERPOLATION, "$sigil$1" ];
},
'@' => sub { # Called if we find '@@'.
- my ( $self, $sigil ) = @_;
- return $self->_make_token( String => content => $sigil );
+ my ( undef, $sigil ) = @_;
+ return [ CLASS_STRING, $sigil ];
},
);
@@ -618,11 +606,10 @@
# variable name enclosed in {}
my $delim_re = _match_enclosed( qw< { > );
$_[2] =~ m/ \G ( $delim_re ) /smxgc
- and return $self->_make_token(
- Interpolation => content => "$sigil$1",
- );
+ and return [ CLASS_INTERPOLATION, "$sigil$1" ];
$_[2] =~ m/ \G ( .* ) /smxgc
- and return $self->_unknown( "$sigil$1", MISMATCHED_DELIM );
+ and return [ CLASS_UNKNOWN, "$sigil$1",
+ error => MISMATCHED_DELIM ];
confess 'Failed to match /./';
}
@@ -638,10 +625,8 @@
} else {
$_[2] =~ m/ ( .* ) /smxgc;
return (
- $self->_make_token(
- Interpolation => content => $interp,
- ),
- $self->_unknown( "$1", MISMATCHED_DELIM ),
+ [ CLASS_INTERPOLATION, $interp ],
+ [ CLASS_UNKNOWN, "$1", error => MISMATCHED_DELIM ],
);
}
}
@@ -651,13 +636,14 @@
$interp .= $deref;
}
- return $self->_make_token( Interpolation => content => $interp );
+ return [ CLASS_INTERPOLATION, $interp ];
}
my $code;
$code = $special{$sigil}
and my $elem = $code->( $self, $sigil, $_[2] )
- or return $self->_unknown( $sigil, 'Sigil without interpolation' );
+ or return [ CLASS_UNKNOWN, $sigil,
+ error => 'Sigil without interpolation' ];
return $elem;
}
@@ -841,15 +827,6 @@
return;
}
-sub _unknown {
- my ( $self, $content, $error ) = @_;
- $self->{failures}++;
- return $self->_make_token( Unknown =>
- content => $content,
- error => $error,
- );
-}
-
sub _unquote {
my ( $string ) = @_;
$string =~ s/ \A ['"] //smx