Patch 8.2.0611
Problem:    Vim9: no check for space before #comment.
Solution:   Add space checks.
Files:      src/eval.c, src/evalvars.c, src/ex_docmd.c,
            src/testdir/test_vim9_script.vim


*** ../vim-8.2.0610/src/eval.c  2020-04-19 16:28:55.296495996 +0200
--- src/eval.c  2020-04-20 17:14:52.786652572 +0200
***************
*** 1773,1779 ****
  
      p = skipwhite(arg);
      ret = eval1(&p, rettv, evaluate);
!     if (ret == FAIL || !ends_excmd(*p))
      {
        if (ret != FAIL)
            clear_tv(rettv);
--- 1773,1779 ----
  
      p = skipwhite(arg);
      ret = eval1(&p, rettv, evaluate);
!     if (ret == FAIL || !ends_excmd2(arg, p))
      {
        if (ret != FAIL)
            clear_tv(rettv);
*** ../vim-8.2.0610/src/evalvars.c      2020-04-19 22:57:40.948355213 +0200
--- src/evalvars.c      2020-04-20 17:23:06.776536887 +0200
***************
*** 737,743 ****
            emsg(_(e_invarg));
        else if (expr[0] == '.')
            emsg(_("E985: .= is not supported with script version 2"));
!       else if (!ends_excmd(*arg))
            // ":let var1 var2"
            arg = list_arg_vars(eap, arg, &first);
        else if (!eap->skip)
--- 737,743 ----
            emsg(_(e_invarg));
        else if (expr[0] == '.')
            emsg(_("E985: .= is not supported with script version 2"));
!       else if (!ends_excmd2(eap->cmd, arg))
            // ":let var1 var2"
            arg = list_arg_vars(eap, arg, &first);
        else if (!eap->skip)
***************
*** 1068,1074 ****
      char_u    *tofree;
      typval_T    tv;
  
!     while (!ends_excmd(*arg) && !got_int)
      {
        if (error || eap->skip)
        {
--- 1068,1074 ----
      char_u    *tofree;
      typval_T    tv;
  
!     while (!ends_excmd2(eap->cmd, arg) && !got_int)
      {
        if (error || eap->skip)
        {
*** ../vim-8.2.0610/src/ex_docmd.c      2020-04-19 18:13:14.542129938 +0200
--- src/ex_docmd.c      2020-04-20 17:36:45.110048382 +0200
***************
*** 7903,7909 ****
            p = skipwhite(p);
  
            // Check for trailing illegal characters
!           if (!ends_excmd(*p))
                eap->errmsg = e_trailing;
            else
                eap->nextcmd = check_nextcmd(p);
--- 7903,7909 ----
            p = skipwhite(p);
  
            // Check for trailing illegal characters
!           if (!ends_excmd2(eap->arg, p))
                eap->errmsg = e_trailing;
            else
                eap->nextcmd = check_nextcmd(p);
*** ../vim-8.2.0610/src/testdir/test_vim9_script.vim    2020-04-19 
18:27:20.791953204 +0200
--- src/testdir/test_vim9_script.vim    2020-04-20 17:37:04.705994963 +0200
***************
*** 1208,1213 ****
--- 1208,1276 ----
        'let g:var = 123',
        'unlet g:var # something',
        ], 'E488:')
+ 
+   CheckScriptSuccess([
+       'vim9script',
+       'if 1 # comment',
+       '  echo "yes"',
+       'elseif 2 #comment',
+       '  echo "no"',
+       'endif',
+       ])
+ 
+   CheckScriptFailure([
+       'vim9script',
+       'if 1# comment',
+       '  echo "yes"',
+       'endif',
+       ], 'E15:')
+ 
+   CheckScriptFailure([
+       'vim9script',
+       'if 0 # comment',
+       '  echo "yes"',
+       'elseif 2#comment',
+       '  echo "no"',
+       'endif',
+       ], 'E15:')
+ 
+   CheckScriptSuccess([
+       'vim9script',
+       'let # comment',
+       ])
+ 
+   CheckScriptFailure([
+       'vim9script',
+       'let# comment',
+       ], 'E121:')
+ 
+   CheckScriptSuccess([
+       'vim9script',
+       'let v:version # comment',
+       ])
+ 
+   CheckScriptFailure([
+       'vim9script',
+       'let v:version# comment',
+       ], 'E121:')
+ 
+   CheckScriptSuccess([
+       'vim9script',
+       'new'
+       'call setline(1, ["# define pat", "last"])',
+       '$',
+       'dsearch /pat/ #comment',
+       'bwipe!',
+       ])
+ 
+   CheckScriptFailure([
+       'vim9script',
+       'new'
+       'call setline(1, ["# define pat", "last"])',
+       '$',
+       'dsearch /pat/#comment',
+       'bwipe!',
+       ], 'E488:')
  enddef
  
  " Keep this last, it messes up highlighting.
*** ../vim-8.2.0610/src/version.c       2020-04-20 16:49:56.705830066 +0200
--- src/version.c       2020-04-20 17:13:44.566802898 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     611,
  /**/

-- 
An alien life briefly visits earth.  Just before departing it leaves a
message in the dust on the back of a white van.  The world is shocked
and wants to know what it means.  After months of studies the worlds
best linguistic scientists are able to decipher the message: "Wash me!".

 /// 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/202004201546.03KFkjrl001119%40masaka.moolenaar.net.

Raspunde prin e-mail lui