Permalink
Browse files

aligned bundled sets to latest modifications

  • Loading branch information...
1 parent 351b78b commit 91c89e3967a15e57e4d4bd64f1935a5fc9c4d9ea @polettix committed Apr 2, 2012
Showing with 17 additions and 3 deletions.
  1. +17 −3 sets
View
20 sets
@@ -18,7 +18,7 @@ BEGIN {
use Getopt::Long
qw< GetOptionsFromArray :config pass_through no_ignore_case bundling >;
use Pod::Usage qw< pod2usage >;
- use Log::Log4perl::Tiny qw< :easy >;
+ use Log::Log4perl::Tiny qw< :easy LOGLEVEL >;
use App::Sets::Parser;
use App::Sets::Iterator;
@@ -29,14 +29,21 @@ BEGIN {
}
);
- my %config;
+ my %config = (
+ loglevel => 'INFO',
+ parsedebug => 0,
+ );
sub populate_config {
my (@args) = @_;
$config{sorted} = 1 if $ENV{SETS_SORTED};
$config{trim} = 1 if $ENV{SETS_TRIM};
$config{cache} = $ENV{SETS_CACHE} if exists $ENV{SETS_CACHE};
+ $config{loglevel} = $ENV{SETS_LOGLEVEL}
+ if exists $ENV{SETS_LOGLEVEL};
+ $config{parsedebug} = $ENV{SETS_PARSEDEBUG}
+ if exists $ENV{SETS_PARSEDEBUG};
GetOptionsFromArray(
\@args, \%config, qw< man help usage version
trim|t! sorted|s! cache|cache-sorted|S=s >
@@ -58,6 +65,8 @@ BEGIN {
) if $config{help};
pod2usage(-verbose => 2) if $config{man};
+ LOGLEVEL $config{loglevel};
+
$config{cache} = '.sorted'
if exists $config{cache}
&& !(defined($config{cache}) && length($config{cache}));
@@ -101,7 +110,11 @@ BEGIN {
$input = shift @args;
}
+ LOGLEVEL('DEBUG') if $config{parsedebug};
+ DEBUG "parsing >$input<";
my $expression = App::Sets::Parser::parse($input, 0);
+ LOGLEVEL($config{loglevel});
+
my $it = expression($expression);
while (defined(my $item = $it->drop())) {
print $item;
@@ -427,6 +440,7 @@ END_OF_FILE
sub filename {
my ($string, $pos) = @_;
+ DEBUG "filename() >$string< $pos";
pos($string) = $pos;
my $retval;
if (($retval) = $string =~ m{\G ' ( [^']+ ) '}cgmxs) {
@@ -436,7 +450,7 @@ END_OF_FILE
$retval =~ s{\\(.)}{$1}gmxs;
return [$retval, pos($string)];
}
- elsif (($retval) = $string =~ m{\G ( (?: \\. | [\w.-])+ )}cgmxs) {
+ elsif (($retval) = $string =~ m{\G ( (?: \\. | [\w.-/])+ )}cgmxs) {
$retval =~ s{\\(.)}{$1}gmxs;
return [$retval, pos($string)];
}

0 comments on commit 91c89e3

Please sign in to comment.