Patch 8.2.1125
Problem:    Vim9: double quote can be a string or a comment.
Solution:   Only support comments starting with # to avoid confusion.
Files:      src/eval.c, src/proto/eval.pro, src/dict.c, src/list.c,
            src/vim9script.c


*** ../vim-8.2.1124/src/eval.c  2020-07-03 21:09:48.865268894 +0200
--- src/eval.c  2020-07-04 14:03:35.668292053 +0200
***************
*** 1866,1874 ****
  }
  
  /*
!  * 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".
   * Otherwise just return "arg" unmodified and set "getnext" to FALSE.
   * "arg" must point somewhere inside a line, not at the start.
   */
--- 1866,1874 ----
  }
  
  /*
!  * 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,1886 ****
            && evalarg != NULL
            && evalarg->eval_cookie != NULL
            && (*arg == NUL || (VIM_ISWHITE(arg[-1])
!                                            && (*arg == '"' || *arg == '#'))))
      {
        char_u *p = getline_peek(evalarg->eval_getline, evalarg->eval_cookie);
  
--- 1880,1886 ----
            && evalarg != NULL
            && evalarg->eval_cookie != NULL
            && (*arg == NUL || (VIM_ISWHITE(arg[-1])
!                                            && *arg == '#' && arg[1] != '{')))
      {
        char_u *p = getline_peek(evalarg->eval_getline, evalarg->eval_cookie);
  
***************
*** 1927,1932 ****
--- 1927,1934 ----
      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,1953 ****
  }
  
  /*
-  * 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
--- 1936,1941 ----
*** ../vim-8.2.1124/src/proto/eval.pro  2020-07-01 17:28:30.343443234 +0200
--- src/proto/eval.pro  2020-07-04 14:04:10.996097003 +0200
***************
*** 32,38 ****
  char_u *eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext);
  char_u *eval_next_line(evalarg_T *evalarg);
  char_u *skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg);
- char_u *skipwhite_and_linebreak_keep_string(char_u *arg, evalarg_T *evalarg);
  void clear_evalarg(evalarg_T *evalarg, exarg_T *eap);
  int eval0(char_u *arg, typval_T *rettv, exarg_T *eap, evalarg_T *evalarg);
  int eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg);
--- 32,37 ----
*** ../vim-8.2.1124/src/dict.c  2020-07-01 17:28:30.343443234 +0200
--- src/dict.c  2020-07-04 14:03:26.768341926 +0200
***************
*** 787,794 ****
  
  /*
   * Allocate a variable for a Dictionary and fill it from "*arg".
   * "literal" is TRUE for #{key: val}
-  * "flags" can have EVAL_EVALUATE and other EVAL_ flags.
   * Return OK or FAIL.  Returns NOTDONE for {expr}.
   */
      int
--- 787,794 ----
  
  /*
   * Allocate a variable for a Dictionary and fill it from "*arg".
+  * "*arg" points to the "{".
   * "literal" is TRUE for #{key: val}
   * Return OK or FAIL.  Returns NOTDONE for {expr}.
   */
      int
***************
*** 830,836 ****
      tvkey.v_type = VAR_UNKNOWN;
      tv.v_type = VAR_UNKNOWN;
  
!     *arg = skipwhite_and_linebreak_keep_string(*arg + 1, evalarg);
      while (**arg != '}' && **arg != NUL)
      {
        if ((literal
--- 830,836 ----
      tvkey.v_type = VAR_UNKNOWN;
      tv.v_type = VAR_UNKNOWN;
  
!     *arg = skipwhite_and_linebreak(*arg + 1, evalarg);
      while (**arg != '}' && **arg != NUL)
      {
        if ((literal
***************
*** 862,868 ****
            goto failret;
        }
  
!       *arg = skipwhite_and_linebreak_keep_string(*arg + 1, evalarg);
        if (eval1(arg, &tv, evalarg) == FAIL)   // recursive!
        {
            if (evaluate)
--- 862,868 ----
            goto failret;
        }
  
!       *arg = skipwhite_and_linebreak(*arg + 1, evalarg);
        if (eval1(arg, &tv, evalarg) == FAIL)   // recursive!
        {
            if (evaluate)
***************
*** 904,910 ****
        }
  
        // the "}" can be on the next line
!       *arg = skipwhite_and_linebreak_keep_string(*arg, evalarg);
        if (**arg == '}')
            break;
        if (!had_comma)
--- 904,910 ----
        }
  
        // the "}" can be on the next line
!       *arg = skipwhite_and_linebreak(*arg, evalarg);
        if (**arg == '}')
            break;
        if (!had_comma)
*** ../vim-8.2.1124/src/list.c  2020-07-01 18:29:23.681143435 +0200
--- src/list.c  2020-07-04 14:03:51.108206259 +0200
***************
*** 1177,1183 ****
            return FAIL;
      }
  
!     *arg = skipwhite_and_linebreak_keep_string(*arg + 1, evalarg);
      while (**arg != ']' && **arg != NUL)
      {
        if (eval1(arg, &tv, evalarg) == FAIL)   // recursive!
--- 1177,1183 ----
            return FAIL;
      }
  
!     *arg = skipwhite_and_linebreak(*arg + 1, evalarg);
      while (**arg != ']' && **arg != NUL)
      {
        if (eval1(arg, &tv, evalarg) == FAIL)   // recursive!
***************
*** 1209,1215 ****
  
        // The "]" can be on the next line.  But a double quoted string may
        // follow, not a comment.
!       *arg = skipwhite_and_linebreak_keep_string(*arg, evalarg);
        if (**arg == ']')
            break;
  
--- 1209,1215 ----
  
        // The "]" can be on the next line.  But a double quoted string may
        // follow, not a comment.
!       *arg = skipwhite_and_linebreak(*arg, evalarg);
        if (**arg == ']')
            break;
  
*** ../vim-8.2.1124/src/vim9script.c    2020-07-04 13:15:26.506990170 +0200
--- src/vim9script.c    2020-07-04 14:03:56.024179123 +0200
***************
*** 342,348 ****
        goto erret;
      }
  
!     arg = skipwhite_and_linebreak_keep_string(arg + 4, evalarg);
      tv.v_type = VAR_UNKNOWN;
      // TODO: should we accept any expression?
      if (*arg == '\'')
--- 342,348 ----
        goto erret;
      }
  
!     arg = skipwhite_and_linebreak(arg + 4, evalarg);
      tv.v_type = VAR_UNKNOWN;
      // TODO: should we accept any expression?
      if (*arg == '\'')
*** ../vim-8.2.1124/src/version.c       2020-07-04 13:15:26.510990159 +0200
--- src/version.c       2020-07-04 14:01:54.496877645 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1125,
  /**/

-- 
BLACK KNIGHT: The Black Knight always triumphs. Have at you!
   ARTHUR takes his last leg off.  The BLACK KNIGHT's body lands upright.
BLACK KNIGHT: All right, we'll call it a draw.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202007041215.064CFkYn307164%40masaka.moolenaar.net.

Raspunde prin e-mail lui