summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2018-07-10 12:27:07 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2018-07-10 12:27:07 (GMT)
commitef4bb8963e1a89da2b62274758361617f5384ce3 (patch) (side-by-side diff)
tree46c7d15cdf08bfd569d7ae6b2910bf361ec37a08
parentdb3dbb29a2ad58ef2f43d3f9d250e7f90aeaf278 (diff)
downloadconfig-parser-master.tar.gz
config-parser-master.tar.bz2
Switch to Config::ASTHEADmaster
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile.PL3
-rw-r--r--lib/Config/Parser.pm12
-rw-r--r--lib/Config/Parser/Ini.pm2
-rw-r--r--t/TestConfig.pm14
4 files changed, 11 insertions, 20 deletions
diff --git a/Makefile.PL b/Makefile.PL
index bc0ba75..cee8413 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -16,7 +16,8 @@ WriteMakefile(NAME => 'Config::Parser',
'Class::Inspector' => 0,
'Data::Dumper' => '2.135_06',
'File::Temp' => '0.22',
- 'Text::Locus' => '1.01'
+ 'Text::Locus' => '1.01',
+ 'Config::AST' => 0
},
META_MERGE => {
'meta-spec' => { version => 2 },
diff --git a/lib/Config/Parser.pm b/lib/Config/Parser.pm
index 93b23fc..ee5055b 100644
--- a/lib/Config/Parser.pm
+++ b/lib/Config/Parser.pm
@@ -1,7 +1,7 @@
package Config::Parser;
use strict;
use warnings;
-use parent 'Config::Tree';
+use parent 'Config::AST';
use Carp;
use Cwd qw(abs_path);
use Text::ParseWords;
@@ -23,18 +23,18 @@ sub new {
}
}
- unless ($_{parameters}) {
+ unless ($_{lexicon}) {
my $subs = Class::Inspector->subclasses(__PACKAGE__);
if ($subs) {
- $_{parameters} = {};
+ $_{lexicon} = {};
foreach my $c (@$subs) {
# print "LOADING FROM $c\n";
if (my $s = loadsynt($c)) {
- $_{parameters} = { %{$_{parameters}}, %$s };
+ $_{lexicon} = { %{$_{lexicon}}, %$s };
}
last if $c eq $class;
}
- delete $_{parameters} unless keys %{$_{parameters}};
+ delete $_{lexicon} unless keys %{$_{lexicon}};
}
}
@@ -71,7 +71,7 @@ sub loadsynt {
my $d = $class->new(filename => $file,
fh => $fh,
line => $line,
- parameters => { '*' => '*' })
+ lexicon => { '*' => '*' })
or croak "Failed to parse template at $file:$line";
close $fh;
$d->as_hash(sub {
diff --git a/lib/Config/Parser/Ini.pm b/lib/Config/Parser/Ini.pm
index 3b39a16..0ea632c 100644
--- a/lib/Config/Parser/Ini.pm
+++ b/lib/Config/Parser/Ini.pm
@@ -62,7 +62,7 @@ sub _readconfig {
} else {
$include = 0;
$self->add_node(\@path,
- new Config::Tree::Node::Section(locus => $locus));
+ new Config::AST::Node::Section(locus => $locus));
}
} elsif (/([\w_-]+)\s*=\s*(.*)/) {
my ($k, $v) = ($1, $2);
diff --git a/t/TestConfig.pm b/t/TestConfig.pm
index 886e66b..bd4f3f5 100644
--- a/t/TestConfig.pm
+++ b/t/TestConfig.pm
@@ -4,7 +4,7 @@ use strict;
use warnings;
use Carp;
-use Config::Tree qw(:sort);
+use Config::AST qw(:sort);
use parent 'Config::Parser::Ini';
use Data::Dumper;
use File::Temp;
@@ -64,17 +64,7 @@ sub success {
sub canonical {
my $self = shift;
- local %_ = @_;
- carp "unknown parameters: " . join(', ', keys(%_)) if (keys(%_));
- return join $_{delim} // " ", map {
- join('.', @{$_->[0]})
- . "="
- . Data::Dumper->new([$_->[1]->value])
- ->Useqq(1)
- ->Terse(1)
- ->Indent(0)
- ->Dump
- } $self->flatten(sort => SORT_PATH);
+ return $self->SUPER::canonical(delim => ' ');
}
sub expected_error {

Return to:

Send suggestions and report system problems to the System administrator.