mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-27 13:12:42 +01:00
Interpreter: split_line is now smarter about JSON and code
This commit is contained in:
parent
3e2395370f
commit
8e21de1f60
@ -550,7 +550,8 @@ sub split_line {
|
||||
|
||||
my %default_opts = (
|
||||
strip_quotes => 0,
|
||||
keep_spaces => 0
|
||||
keep_spaces => 0,
|
||||
preserve_escapes => 1,
|
||||
);
|
||||
|
||||
%opts = (%default_opts, %opts);
|
||||
@ -591,7 +592,11 @@ sub split_line {
|
||||
$spaces = 0 if $ch ne ' ';
|
||||
|
||||
if ($escaped) {
|
||||
$token .= "\\$ch";
|
||||
if ($opts{preserve_escapes}) {
|
||||
$token .= "\\$ch";
|
||||
} else {
|
||||
$token .= $ch;
|
||||
}
|
||||
$escaped = 0;
|
||||
next;
|
||||
}
|
||||
@ -615,7 +620,7 @@ sub split_line {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($last_ch eq ' ' and not defined $quote and ($ch eq "'" or $ch eq '"')) {
|
||||
if (($last_ch eq ' ' or $last_ch eq ':' or $last_ch eq '(') and not defined $quote and ($ch eq "'" or $ch eq '"')) {
|
||||
if ($ignore_quote) {
|
||||
# treat unbalanced quote as part of this argument
|
||||
$token .= $ch;
|
||||
|
Loading…
Reference in New Issue
Block a user