diff src/ex_eval.c @ 20113:2c23053c654a v8.2.0612

patch 8.2.0612: Vim9: no check for space before #comment Commit: https://github.com/vim/vim/commit/2c5ed4e3300378ce76c8d9c3818d6f73e5119f68 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 20 19:42:10 2020 +0200 patch 8.2.0612: Vim9: no check for space before #comment Problem: Vim9: no check for space before #comment. Solution: Add space checks.
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 Apr 2020 19:45:03 +0200
parents 8fb1cf4c44d5
children c225be44692a
line wrap: on
line diff
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -1021,12 +1021,12 @@ ex_else(exarg_T *eap)
     if (eap->cmdidx == CMD_elseif)
     {
 	result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
+
 	// When throwing error exceptions, we want to throw always the first
 	// of several errors in a row.  This is what actually happens when
 	// a conditional error was detected above and there is another failure
 	// when parsing the expression.  Since the skip flag is set in this
 	// case, the parsing error will be ignored by emsg().
-
 	if (!skip && !error)
 	{
 	    if (result)
@@ -1518,7 +1518,7 @@ ex_catch(exarg_T *eap)
 						       &cstack->cs_looplevel);
     }
 
-    if (ends_excmd(*eap->arg))	// no argument, catch all errors
+    if (ends_excmd2(eap->cmd, eap->arg))   // no argument, catch all errors
     {
 	pat = (char_u *)".*";
 	end = NULL;
@@ -1527,7 +1527,9 @@ ex_catch(exarg_T *eap)
     else
     {
 	pat = eap->arg + 1;
-	end = skip_regexp(pat, *eap->arg, TRUE);
+	end = skip_regexp_err(pat, *eap->arg, TRUE);
+	if (end == NULL)
+	    give_up = TRUE;
     }
 
     if (!give_up)
@@ -1548,7 +1550,8 @@ ex_catch(exarg_T *eap)
 	if (!skip && (cstack->cs_flags[idx] & CSF_THROWN)
 		&& !(cstack->cs_flags[idx] & CSF_CAUGHT))
 	{
-	    if (end != NULL && *end != NUL && !ends_excmd(*skipwhite(end + 1)))
+	    if (end != NULL && *end != NUL
+				      && !ends_excmd2(end, skipwhite(end + 1)))
 	    {
 		emsg(_(e_trailing));
 		return;