diff src/vim9compile.c @ 21759:25b659fa5ca5 v8.2.1429

patch 8.2.1429: Vim9: no error for missing white after : in dict Commit: https://github.com/vim/vim/commit/17a836cbee6b8d8ff555f8e307f48a779908db41 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 12 17:35:58 2020 +0200 patch 8.2.1429: Vim9: no error for missing white after : in dict Problem: Vim9: no error for missing white after : in dict. Solution: Check for white space. (closes https://github.com/vim/vim/issues/6671) Also check that there is no white before the :.
author Bram Moolenaar <Bram@vim.org>
date Wed, 12 Aug 2020 17:45:04 +0200
parents 3b312e56e2b8
children 5a2373c25a86
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2593,14 +2593,21 @@ compile_dict(char_u **arg, cctx_T *cctx,
 	    }
 	}
 
-	*arg = skipwhite(*arg);
 	if (**arg != ':')
 	{
-	    semsg(_(e_missing_dict_colon), *arg);
+	    if (*skipwhite(*arg) == ':')
+		semsg(_(e_no_white_before), ":");
+	    else
+		semsg(_(e_missing_dict_colon), *arg);
 	    return FAIL;
 	}
-
 	whitep = *arg + 1;
+	if (!IS_WHITE_OR_NUL(*whitep))
+	{
+	    semsg(_(e_white_after), ":");
+	    return FAIL;
+	}
+
 	*arg = skipwhite(*arg + 1);
 	if (may_get_next_line(whitep, arg, cctx) == FAIL)
 	{