Mercurial > vim
comparison src/ex_eval.c @ 28895:228154db3ce6 v8.2.4970
patch 8.2.4970: "eval 123" gives an error, "eval 'abc'" does not
Commit: https://github.com/vim/vim/commit/0d03263fd731986c0eee1a08e0f1b19f1bc3a7ad
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 17 12:45:15 2022 +0100
patch 8.2.4970: "eval 123" gives an error, "eval 'abc'" does not
Problem: "eval 123" gives an error, "eval 'abc'" does not.
Solution: Also give an error when evaluating only a string. (closes https://github.com/vim/vim/issues/10434)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 17 May 2022 14:00:05 +0200 |
parents | d59c8dc8be20 |
children | 6a8c2ff5b2ef |
comparison
equal
deleted
inserted
replaced
28894:05217054f93c | 28895:228154db3ce6 |
---|---|
886 verbose_leave(); | 886 verbose_leave(); |
887 } | 887 } |
888 } | 888 } |
889 | 889 |
890 /* | 890 /* |
891 * Return TRUE if "arg" is only a variable, register, environment variable or | 891 * Return TRUE if "arg" is only a variable, register, environment variable, |
892 * option name. | 892 * option name or string. |
893 */ | 893 */ |
894 int | 894 int |
895 cmd_is_name_only(char_u *arg) | 895 cmd_is_name_only(char_u *arg) |
896 { | 896 { |
897 char_u *p = arg; | 897 char_u *p = arg; |
901 if (*p == '@') | 901 if (*p == '@') |
902 { | 902 { |
903 ++p; | 903 ++p; |
904 if (*p != NUL) | 904 if (*p != NUL) |
905 ++p; | 905 ++p; |
906 } | |
907 else if (*p == '\'' || *p == '"') | |
908 { | |
909 int r; | |
910 | |
911 if (*p == '"') | |
912 r = eval_string(&p, NULL, FALSE, FALSE); | |
913 else | |
914 r = eval_lit_string(&p, NULL, FALSE, FALSE); | |
915 if (r == FAIL) | |
916 return FALSE; | |
906 } | 917 } |
907 else | 918 else |
908 { | 919 { |
909 if (*p == '&') | 920 if (*p == '&') |
910 { | 921 { |