mirror of
https://github.com/pragma-/pbot.git
synced 2024-10-05 02:48:50 +02:00
Interpreter: split_line now accepts a parameter to strip quotes
This commit is contained in:
parent
ed0c857389
commit
0979ac86d9
@ -546,7 +546,9 @@ sub extract_bracketed {
|
|||||||
# unbalanced quotes gracefully by treating them as part of the argument
|
# unbalanced quotes gracefully by treating them as part of the argument
|
||||||
# they were found within.
|
# they were found within.
|
||||||
sub split_line {
|
sub split_line {
|
||||||
my ($self, $line) = @_;
|
my ($self, $line, $strip_quotes) = @_;
|
||||||
|
|
||||||
|
$strip_quotes = 0 if not defined $strip_quotes;
|
||||||
|
|
||||||
my @chars = split //, $line;
|
my @chars = split //, $line;
|
||||||
|
|
||||||
@ -594,7 +596,7 @@ sub split_line {
|
|||||||
if (defined $quote) {
|
if (defined $quote) {
|
||||||
if ($ch eq $quote) {
|
if ($ch eq $quote) {
|
||||||
# closing quote
|
# closing quote
|
||||||
$token .= $ch;
|
$token .= $ch unless $strip_quotes;
|
||||||
push @args, $token;
|
push @args, $token;
|
||||||
$quote = undef;
|
$quote = undef;
|
||||||
$token = '';
|
$token = '';
|
||||||
@ -614,7 +616,7 @@ sub split_line {
|
|||||||
# begin potential quoted argument
|
# begin potential quoted argument
|
||||||
$pos = $i - 1;
|
$pos = $i - 1;
|
||||||
$quote = $ch;
|
$quote = $ch;
|
||||||
$token .= $ch;
|
$token .= $ch unless $strip_quotes;
|
||||||
}
|
}
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user