mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01: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
|
||||
# they were found within.
|
||||
sub split_line {
|
||||
my ($self, $line) = @_;
|
||||
my ($self, $line, $strip_quotes) = @_;
|
||||
|
||||
$strip_quotes = 0 if not defined $strip_quotes;
|
||||
|
||||
my @chars = split //, $line;
|
||||
|
||||
@ -594,7 +596,7 @@ sub split_line {
|
||||
if (defined $quote) {
|
||||
if ($ch eq $quote) {
|
||||
# closing quote
|
||||
$token .= $ch;
|
||||
$token .= $ch unless $strip_quotes;
|
||||
push @args, $token;
|
||||
$quote = undef;
|
||||
$token = '';
|
||||
@ -614,7 +616,7 @@ sub split_line {
|
||||
# begin potential quoted argument
|
||||
$pos = $i - 1;
|
||||
$quote = $ch;
|
||||
$token .= $ch;
|
||||
$token .= $ch unless $strip_quotes;
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user