mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:8.2.4948: cannot use Perl heredoc in nested :def function (#32311)
Problem: Cannot use Perl heredoc in nested :def function. (Virginia
Senioria)
Solution: Only concatenate heredoc lines when not in a nested function.
(closes vim/vim#10415)
d881d15984
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -2471,36 +2471,38 @@ static int get_function_body(exarg_T *eap, garray_T *newlines, char *line_arg_in
|
|||||||
is_heredoc = true;
|
is_heredoc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for ":let v =<< [trim] EOF"
|
if (!is_heredoc) {
|
||||||
// and ":let [a, b] =<< [trim] EOF"
|
// Check for ":let v =<< [trim] EOF"
|
||||||
arg = p;
|
// and ":let [a, b] =<< [trim] EOF"
|
||||||
if (checkforcmd(&arg, "let", 2)) {
|
arg = p;
|
||||||
int var_count = 0;
|
if (checkforcmd(&arg, "let", 2)) {
|
||||||
int semicolon = 0;
|
int var_count = 0;
|
||||||
arg = (char *)skip_var_list(arg, &var_count, &semicolon, true);
|
int semicolon = 0;
|
||||||
if (arg != NULL) {
|
arg = (char *)skip_var_list(arg, &var_count, &semicolon, true);
|
||||||
arg = skipwhite(arg);
|
if (arg != NULL) {
|
||||||
}
|
arg = skipwhite(arg);
|
||||||
if (arg != NULL && strncmp(arg, "=<<", 3) == 0) {
|
}
|
||||||
p = skipwhite(arg + 3);
|
if (arg != NULL && strncmp(arg, "=<<", 3) == 0) {
|
||||||
while (true) {
|
p = skipwhite(arg + 3);
|
||||||
if (strncmp(p, "trim", 4) == 0) {
|
while (true) {
|
||||||
// Ignore leading white space.
|
if (strncmp(p, "trim", 4) == 0) {
|
||||||
p = skipwhite(p + 4);
|
// Ignore leading white space.
|
||||||
heredoc_trimmedlen = (size_t)(skipwhite(theline) - theline);
|
p = skipwhite(p + 4);
|
||||||
heredoc_trimmed = xmemdupz(theline, heredoc_trimmedlen);
|
heredoc_trimmedlen = (size_t)(skipwhite(theline) - theline);
|
||||||
continue;
|
heredoc_trimmed = xmemdupz(theline, heredoc_trimmedlen);
|
||||||
}
|
continue;
|
||||||
if (strncmp(p, "eval", 4) == 0) {
|
}
|
||||||
// Ignore leading white space.
|
if (strncmp(p, "eval", 4) == 0) {
|
||||||
p = skipwhite(p + 4);
|
// Ignore leading white space.
|
||||||
continue;
|
p = skipwhite(p + 4);
|
||||||
}
|
continue;
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
skip_until = xmemdupz(p, (size_t)(skiptowhite(p) - p));
|
||||||
|
do_concat = false;
|
||||||
|
is_heredoc = true;
|
||||||
}
|
}
|
||||||
skip_until = xmemdupz(p, (size_t)(skiptowhite(p) - p));
|
|
||||||
do_concat = false;
|
|
||||||
is_heredoc = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user