comparison src/vim9script.c @ 19511:7e76d5fba19f v8.2.0313

patch 8.2.0313: Vim9: insufficient script tests Commit: https://github.com/vim/vim/commit/fa29c8abd62c2733d5505563600ea35dddf73dca Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 23 22:35:05 2020 +0100 patch 8.2.0313: Vim9: insufficient script tests Problem: Vim9: insufficient script tests. Solution: Add tests. Make import of alphanumeric name work.
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Feb 2020 22:45:04 +0100
parents 17f0d6dc6a73
children 2fee087c94cb
comparison
equal deleted inserted replaced
19510:8a070de5d840 19511:7e76d5fba19f
170 int idx = -1; 170 int idx = -1;
171 svar_T *sv; 171 svar_T *sv;
172 scriptitem_T *script = SCRIPT_ITEM(sid); 172 scriptitem_T *script = SCRIPT_ITEM(sid);
173 173
174 // isolate one name 174 // isolate one name
175 while (eval_isnamec1(*arg)) 175 while (eval_isnamec(*arg))
176 ++arg; 176 ++arg;
177 *name_len = (int)(arg - name); 177 *name_len = (int)(arg - name);
178 178
179 // find name in "script" 179 // find name in "script"
180 // TODO: also find script-local user function 180 // TODO: also find script-local user function
260 } 260 }
261 else 261 else
262 { 262 {
263 if (*arg == '*') 263 if (*arg == '*')
264 arg = skipwhite(arg + 1); 264 arg = skipwhite(arg + 1);
265 else 265 else if (eval_isnamec1(*arg))
266 { 266 {
267 while (eval_isnamec1(*arg)) 267 while (eval_isnamec(*arg))
268 ++arg; 268 ++arg;
269 arg = skipwhite(arg); 269 arg = skipwhite(arg);
270 } 270 }
271 if (STRNCMP("as", arg, 2) == 0 && VIM_ISWHITE(arg[2])) 271 if (STRNCMP("as", arg, 2) == 0 && VIM_ISWHITE(arg[2]))
272 { 272 {
273 // skip over "as Name " 273 // skip over "as Name "
274 arg = skipwhite(arg + 2); 274 arg = skipwhite(arg + 2);
275 as_ptr = arg; 275 as_ptr = arg;
276 while (eval_isnamec1(*arg)) 276 if (eval_isnamec1(*arg))
277 ++arg; 277 while (eval_isnamec(*arg))
278 ++arg;
278 as_len = (int)(arg - as_ptr); 279 as_len = (int)(arg - as_ptr);
279 arg = skipwhite(arg); 280 arg = skipwhite(arg);
280 } 281 }
281 else if (*arg_start == '*') 282 else if (*arg_start == '*')
282 { 283 {
284 return NULL; 285 return NULL;
285 } 286 }
286 } 287 }
287 if (STRNCMP("from", arg, 4) != 0 || !VIM_ISWHITE(arg[4])) 288 if (STRNCMP("from", arg, 4) != 0 || !VIM_ISWHITE(arg[4]))
288 { 289 {
289 emsg(_("E1045: Missing \"from\"")); 290 emsg(_("E1070: Missing \"from\""));
290 return NULL; 291 return NULL;
291 } 292 }
292 from_ptr = arg; 293 from_ptr = arg;
293 arg = skipwhite(arg + 4); 294 arg = skipwhite(arg + 4);
294 tv.v_type = VAR_UNKNOWN; 295 tv.v_type = VAR_UNKNOWN;
297 ret = get_lit_string_tv(&arg, &tv, TRUE); 298 ret = get_lit_string_tv(&arg, &tv, TRUE);
298 else if (*arg == '"') 299 else if (*arg == '"')
299 ret = get_string_tv(&arg, &tv, TRUE); 300 ret = get_string_tv(&arg, &tv, TRUE);
300 if (ret == FAIL || tv.vval.v_string == NULL || *tv.vval.v_string == NUL) 301 if (ret == FAIL || tv.vval.v_string == NULL || *tv.vval.v_string == NUL)
301 { 302 {
302 emsg(_("E1045: Invalid string after \"from\"")); 303 emsg(_("E1071: Invalid string after \"from\""));
303 return NULL; 304 return NULL;
304 } 305 }
305 cmd_end = arg; 306 cmd_end = arg;
306 307
307 // find script tv.vval.v_string 308 // find script tv.vval.v_string
421 } 422 }
422 arg = skipwhite(arg + 1); 423 arg = skipwhite(arg + 1);
423 } 424 }
424 if (arg != from_ptr) 425 if (arg != from_ptr)
425 { 426 {
427 // cannot happen, just in case the above has a flaw
426 emsg(_("E1047: syntax error in import")); 428 emsg(_("E1047: syntax error in import"));
427 return NULL; 429 return NULL;
428 } 430 }
429 } 431 }
430 return cmd_end; 432 return cmd_end;