mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.0611: Vim9: no check for space before #comment
Problem: Vim9: no check for space before #comment. Solution: Add space checks.
This commit is contained in:
@@ -1773,7 +1773,7 @@ eval0(
|
|||||||
|
|
||||||
p = skipwhite(arg);
|
p = skipwhite(arg);
|
||||||
ret = eval1(&p, rettv, evaluate);
|
ret = eval1(&p, rettv, evaluate);
|
||||||
if (ret == FAIL || !ends_excmd(*p))
|
if (ret == FAIL || !ends_excmd2(arg, p))
|
||||||
{
|
{
|
||||||
if (ret != FAIL)
|
if (ret != FAIL)
|
||||||
clear_tv(rettv);
|
clear_tv(rettv);
|
||||||
|
@@ -737,7 +737,7 @@ ex_let_const(exarg_T *eap, int is_const)
|
|||||||
emsg(_(e_invarg));
|
emsg(_(e_invarg));
|
||||||
else if (expr[0] == '.')
|
else if (expr[0] == '.')
|
||||||
emsg(_("E985: .= is not supported with script version 2"));
|
emsg(_("E985: .= is not supported with script version 2"));
|
||||||
else if (!ends_excmd(*arg))
|
else if (!ends_excmd2(eap->cmd, arg))
|
||||||
// ":let var1 var2"
|
// ":let var1 var2"
|
||||||
arg = list_arg_vars(eap, arg, &first);
|
arg = list_arg_vars(eap, arg, &first);
|
||||||
else if (!eap->skip)
|
else if (!eap->skip)
|
||||||
@@ -1068,7 +1068,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
|
|||||||
char_u *tofree;
|
char_u *tofree;
|
||||||
typval_T tv;
|
typval_T tv;
|
||||||
|
|
||||||
while (!ends_excmd(*arg) && !got_int)
|
while (!ends_excmd2(eap->cmd, arg) && !got_int)
|
||||||
{
|
{
|
||||||
if (error || eap->skip)
|
if (error || eap->skip)
|
||||||
{
|
{
|
||||||
|
@@ -7903,7 +7903,7 @@ ex_findpat(exarg_T *eap)
|
|||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
|
|
||||||
// Check for trailing illegal characters
|
// Check for trailing illegal characters
|
||||||
if (!ends_excmd(*p))
|
if (!ends_excmd2(eap->arg, p))
|
||||||
eap->errmsg = e_trailing;
|
eap->errmsg = e_trailing;
|
||||||
else
|
else
|
||||||
eap->nextcmd = check_nextcmd(p);
|
eap->nextcmd = check_nextcmd(p);
|
||||||
|
@@ -1208,6 +1208,69 @@ def Test_vim9_comment_not_compiled()
|
|||||||
'let g:var = 123',
|
'let g:var = 123',
|
||||||
'unlet g:var # something',
|
'unlet g:var # something',
|
||||||
], 'E488:')
|
], '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
|
enddef
|
||||||
|
|
||||||
" Keep this last, it messes up highlighting.
|
" Keep this last, it messes up highlighting.
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
611,
|
||||||
/**/
|
/**/
|
||||||
610,
|
610,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user