diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-07-04 14:15:00 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-07-04 14:15:00 +0200 |
commit | 962d7213194647e90f9bdc608f693d39dd07cbd5 (patch) | |
tree | 3714605c7e29ea8fe42f8cf6b0bc383b0b685ac8 /src/eval.c | |
parent | 1c991144c502ade477e1a32fdfd0f78b6299fdc7 (diff) |
patch 8.2.1125: Vim9: double quote can be a string or a commentv8.2.1125
Problem: Vim9: double quote can be a string or a comment.
Solution: Only support comments starting with # to avoid confusion.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/eval.c b/src/eval.c index c569710ab5..1468070ae6 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1866,9 +1866,9 @@ eval_func( } /* - * If inside Vim9 script, "arg" points to the end of a line (ignoring comments) - * and there is a next line, return the next line (skipping blanks) and set - * "getnext". + * If inside Vim9 script, "arg" points to the end of a line (ignoring a # + * comment) and there is a next line, return the next line (skipping blanks) + * and set "getnext". * Otherwise just return "arg" unmodified and set "getnext" to FALSE. * "arg" must point somewhere inside a line, not at the start. */ @@ -1880,7 +1880,7 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext) && evalarg != NULL && evalarg->eval_cookie != NULL && (*arg == NUL || (VIM_ISWHITE(arg[-1]) - && (*arg == '"' || *arg == '#')))) + && *arg == '#' && arg[1] != '{'))) { char_u *p = getline_peek(evalarg->eval_getline, evalarg->eval_cookie); @@ -1927,6 +1927,8 @@ skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg) int getnext; char_u *p = skipwhite(arg); + if (evalarg == NULL) + return skipwhite(arg); eval_next_non_blank(p, evalarg, &getnext); if (getnext) return eval_next_line(evalarg); @@ -1934,20 +1936,6 @@ skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg) } /* - * Call eval_next_non_blank() and get the next line if needed, but not when a - * double quote follows. Used inside an expression. - */ - char_u * -skipwhite_and_linebreak_keep_string(char_u *arg, evalarg_T *evalarg) -{ - char_u *p = skipwhite(arg); - - if (*p == '"') - return p; - return skipwhite_and_linebreak(arg, evalarg); -} - -/* * After using "evalarg" filled from "eap" free the memory. */ void |