diff options
| author | David Phillips <david@sighup.nz> | 2019-04-17 22:15:59 +1200 | 
|---|---|---|
| committer | David Phillips <david@sighup.nz> | 2019-04-17 22:15:59 +1200 | 
| commit | a1ce9696c929aeaf1738cf281f4241d100525341 (patch) | |
| tree | ae7a60aec22b2aa33f8838e521c361ebf7b43833 | |
| parent | 2a9a151c64d07578728fdc42c84b9a9ea10974f6 (diff) | |
| download | idalius-a1ce9696c929aeaf1738cf281f4241d100525341.tar.xz | |
ListParser: enable strict, implement escape character
| -rw-r--r-- | ListParser.pm | 13 | ||||
| -rw-r--r-- | Plugin/Admin.pm | 1 | 
2 files changed, 10 insertions, 4 deletions
| diff --git a/ListParser.pm b/ListParser.pm index 099b1a1..57e0a62 100644 --- a/ListParser.pm +++ b/ListParser.pm @@ -1,10 +1,13 @@  package ListParser; +use strict; +use warnings; +  sub parse_mapping {  	my ($input) = @_; -	my $key, $value; +	my ($key, $value);  	my $i = 0; -	my $string_start, $string_end; +	my ($string_start, $string_end);  	$string_start = $string_end = undef;  	# Are we currently lexing inside a string literal? @@ -67,6 +70,7 @@ sub parse_list {  	my $c_start = $is_hash ? "{" : "[";  	my $c_end   = $is_hash ? "}" : "]";  	my %h_res; +	my %mapping;  	my @a_res;  	my $i = 0; @@ -86,7 +90,10 @@ sub parse_list {  	while ($nest != 0 && $i < length($input)) {  		my $c = substr($input, $i, 1); -		if ($c eq $c_start) { +		if ($c eq "\\") { +			substr($input, $i, 1) = ""; +			$i++; +		} elsif ($c eq $c_start) {  			$nest++;  		} elsif ($c eq $c_end) {  			$nest--; diff --git a/Plugin/Admin.pm b/Plugin/Admin.pm index a5217f7..ce43424 100644 --- a/Plugin/Admin.pm +++ b/Plugin/Admin.pm @@ -44,7 +44,6 @@ sub configure {  	$cmdref->($self, "load", sub { $self->load_plugin(@_); } );  	$cmdref->($self, "unload", sub { $self->unload_plugin(@_); } ); -  	return $self;  } | 
