mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(messages): use "Vimscript" instead of "VimL" #24111
followup to #24109 fix #16150
This commit is contained in:
		| @@ -81,7 +81,7 @@ Project layout | |||||||
|     ├─ runtime/         plugins and docs |     ├─ runtime/         plugins and docs | ||||||
|     ├─ src/nvim/        application source code (see src/nvim/README.md) |     ├─ src/nvim/        application source code (see src/nvim/README.md) | ||||||
|     │  ├─ api/          API subsystem |     │  ├─ api/          API subsystem | ||||||
|     │  ├─ eval/         VimL subsystem |     │  ├─ eval/         Vimscript subsystem | ||||||
|     │  ├─ event/        event-loop subsystem |     │  ├─ event/        event-loop subsystem | ||||||
|     │  ├─ generators/   code generation (pre-compilation) |     │  ├─ generators/   code generation (pre-compilation) | ||||||
|     │  ├─ lib/          generic data structures |     │  ├─ lib/          generic data structures | ||||||
|   | |||||||
| @@ -101,8 +101,8 @@ function s:msgpack_init_python() abort | |||||||
|   " @return Formatted timestamp. |   " @return Formatted timestamp. | ||||||
|   " |   " | ||||||
|   " @warning Without +python or +python3 this function does not work correctly.  |   " @warning Without +python or +python3 this function does not work correctly.  | ||||||
|   "          The VimL code contains “reference” implementation which does not  |   "          The Vimscript code contains “reference” implementation which does | ||||||
|   "          really work because of precision loss. |   "          not really work because of precision loss. | ||||||
|   function s:msgpack_dict_strftime(format, timestamp) |   function s:msgpack_dict_strftime(format, timestamp) | ||||||
|     return msgpack#strftime(a:format, +msgpack#int_dict_to_str(a:timestamp)) |     return msgpack#strftime(a:format, +msgpack#int_dict_to_str(a:timestamp)) | ||||||
|   endfunction |   endfunction | ||||||
| @@ -541,8 +541,8 @@ let s:MSGPACK_SPECIAL_OBJECTS = { | |||||||
| \} | \} | ||||||
|  |  | ||||||
| "" | "" | ||||||
| " Convert msgpack object dumped by msgpack#string() to a VimL object suitable  | " Convert msgpack object dumped by msgpack#string() to a Vimscript object | ||||||
| " for msgpackdump(). | " suitable for msgpackdump(). | ||||||
| " | " | ||||||
| " @param[in]  s             String to evaluate. | " @param[in]  s             String to evaluate. | ||||||
| " @param[in]  special_objs  Additional special objects, in the same format as  | " @param[in]  special_objs  Additional special objects, in the same format as  | ||||||
|   | |||||||
| @@ -487,7 +487,7 @@ let s:SHADA_ENTRY_OBJECT_SEQUENCE = ['type', 'timestamp', 'length', 'data'] | |||||||
| "" | "" | ||||||
| " Convert list returned by msgpackparse() to a list of ShaDa objects | " Convert list returned by msgpackparse() to a list of ShaDa objects | ||||||
| " | " | ||||||
| " @param[in]  mpack  List of VimL objects returned by msgpackparse(). | " @param[in]  mpack  List of Vimscript objects returned by msgpackparse(). | ||||||
| " | " | ||||||
| " @return List of dictionaries with keys type, timestamp, length and data. Each  | " @return List of dictionaries with keys type, timestamp, length and data. Each  | ||||||
| "         dictionary describes one ShaDa entry. | "         dictionary describes one ShaDa entry. | ||||||
|   | |||||||
| @@ -460,7 +460,7 @@ Lua interface (|lua.txt|): | |||||||
|   that prints `a` and `b` on separate lines, exactly like |   that prints `a` and `b` on separate lines, exactly like | ||||||
|   `:lua print("a\nb")` . |   `:lua print("a\nb")` . | ||||||
| - `:lua error('TEST')` emits the error “E5105: Error while calling Lua chunk: | - `:lua error('TEST')` emits the error “E5105: Error while calling Lua chunk: | ||||||
|   [string "<VimL compiled string>"]:1: TEST”, whereas Vim emits only “TEST”. |   [string "<Vimscript compiled string>"]:1: TEST”, whereas Vim emits only “TEST”. | ||||||
| - Lua has direct access to Nvim |API| via `vim.api`. | - Lua has direct access to Nvim |API| via `vim.api`. | ||||||
| - Lua package.path and package.cpath are automatically updated according to | - Lua package.path and package.cpath are automatically updated according to | ||||||
|   'runtimepath': |lua-require|. |   'runtimepath': |lua-require|. | ||||||
|   | |||||||
| @@ -5364,7 +5364,7 @@ theend: | |||||||
|   xfree(trans_name); |   xfree(trans_name); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get the line number from VimL object | /// Get the line number from Vimscript object | ||||||
| /// | /// | ||||||
| /// @note Unlike tv_get_lnum(), this one supports only "$" special string. | /// @note Unlike tv_get_lnum(), this one supports only "$" special string. | ||||||
| /// | /// | ||||||
| @@ -5517,9 +5517,9 @@ void get_user_input(const typval_T *const argvars, typval_T *const rettv, const | |||||||
|   cmd_silent = cmd_silent_save; |   cmd_silent = cmd_silent_save; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Builds a process argument vector from a VimL object (typval_T). | /// Builds a process argument vector from a Vimscript object (typval_T). | ||||||
| /// | /// | ||||||
| /// @param[in]  cmd_tv      VimL object | /// @param[in]  cmd_tv      Vimscript object | ||||||
| /// @param[out] cmd         Returns the command or executable name. | /// @param[out] cmd         Returns the command or executable name. | ||||||
| /// @param[out] executable  Returns `false` if argv[0] is not executable. | /// @param[out] executable  Returns `false` if argv[0] is not executable. | ||||||
| /// | /// | ||||||
| @@ -6192,7 +6192,7 @@ int read_blob(FILE *const fd, typval_T *rettv, off_T offset, off_T size_arg) | |||||||
| /// @param[out] len  Length of the resulting string or -1 on error. | /// @param[out] len  Length of the resulting string or -1 on error. | ||||||
| /// @param[in]  endnl If true, the output will end in a newline (if a list). | /// @param[in]  endnl If true, the output will end in a newline (if a list). | ||||||
| /// @param[in]  crlf  If true, list items will be joined with CRLF (if a list). | /// @param[in]  crlf  If true, list items will be joined with CRLF (if a list). | ||||||
| /// @returns an allocated string if `tv` represents a VimL string, list, or | /// @returns an allocated string if `tv` represents a Vimscript string, list, or | ||||||
| ///          number; NULL otherwise. | ///          number; NULL otherwise. | ||||||
| char *save_tv_as_string(typval_T *tv, ptrdiff_t *const len, bool endnl, bool crlf) | char *save_tv_as_string(typval_T *tv, ptrdiff_t *const len, bool endnl, bool crlf) | ||||||
|   FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL |   FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL | ||||||
| @@ -6338,7 +6338,7 @@ int buf_charidx_to_byteidx(buf_T *buf, linenr_T lnum, int charidx) | |||||||
|   return (int)(t - str); |   return (int)(t - str); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Translate a VimL object into a position | /// Translate a Vimscript object into a position | ||||||
| /// | /// | ||||||
| /// Accepts VAR_LIST and VAR_STRING objects. Does not give an error for invalid | /// Accepts VAR_LIST and VAR_STRING objects. Does not give an error for invalid | ||||||
| /// type. | /// type. | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| -- base  For methods: the argument to use as the base argument (1-indexed): | -- base  For methods: the argument to use as the base argument (1-indexed): | ||||||
| --       base->method() | --       base->method() | ||||||
| --       Defaults to BASE_NONE (function cannot be used as a method). | --       Defaults to BASE_NONE (function cannot be used as a method). | ||||||
| -- func  Name of the C function which implements the VimL function. Defaults to | -- func  Name of the C function which implements the Vimscript function. Defaults to | ||||||
| --       `f_{funcname}`. | --       `f_{funcname}`. | ||||||
| -- fast  Function can run in |api-fast| events. Defaults to false. | -- fast  Function can run in |api-fast| events. Defaults to false. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -227,7 +227,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack | |||||||
| /// | /// | ||||||
| /// @param[out]  ret_tv  Address where new special dictionary is saved. | /// @param[out]  ret_tv  Address where new special dictionary is saved. | ||||||
| /// @param[in]  len  Expected number of items to be populated before list | /// @param[in]  len  Expected number of items to be populated before list | ||||||
| ///                  becomes accessible from VimL. It is still valid to | ///                  becomes accessible from Vimscript. It is still valid to | ||||||
| ///                  underpopulate a list, value only controls how many elements | ///                  underpopulate a list, value only controls how many elements | ||||||
| ///                  will be allocated in advance. @see ListLenSpecials. | ///                  will be allocated in advance. @see ListLenSpecials. | ||||||
| /// | /// | ||||||
| @@ -645,7 +645,7 @@ parse_json_number_ret: | |||||||
|     } \ |     } \ | ||||||
|   } while (0) |   } while (0) | ||||||
|  |  | ||||||
| /// Convert JSON string into VimL object | /// Convert JSON string into Vimscript object | ||||||
| /// | /// | ||||||
| /// @param[in]  buf  String to convert. UTF-8 encoding is assumed. | /// @param[in]  buf  String to convert. UTF-8 encoding is assumed. | ||||||
| /// @param[in]  buf_len  Length of the string. | /// @param[in]  buf_len  Length of the string. | ||||||
| @@ -921,7 +921,7 @@ json_decode_string_ret: | |||||||
|  |  | ||||||
| #undef DICT_LEN | #undef DICT_LEN | ||||||
|  |  | ||||||
| /// Convert msgpack object to a VimL one | /// Convert msgpack object to a Vimscript one | ||||||
| int msgpack_to_vim(const msgpack_object mobj, typval_T *const rettv) | int msgpack_to_vim(const msgpack_object mobj, typval_T *const rettv) | ||||||
|   FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT |   FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT | ||||||
| { | { | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
|  |  | ||||||
| /// @file encode.c | /// @file encode.c | ||||||
| /// | /// | ||||||
| /// File containing functions for encoding and decoding VimL values. | /// File containing functions for encoding and decoding Vimscript values. | ||||||
| /// | /// | ||||||
| /// Split out from eval.c. | /// Split out from eval.c. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ | |||||||
| #include "nvim/garray.h" | #include "nvim/garray.h" | ||||||
| #include "nvim/vim.h" | #include "nvim/vim.h" | ||||||
|  |  | ||||||
| /// Convert VimL value to msgpack string | /// Convert Vimscript value to msgpack string | ||||||
| /// | /// | ||||||
| /// @param[out]  packer  Packer to save results in. | /// @param[out]  packer  Packer to save results in. | ||||||
| /// @param[in]  tv  Dumped value. | /// @param[in]  tv  Dumped value. | ||||||
| @@ -21,7 +21,7 @@ | |||||||
| /// @return OK in case of success, FAIL otherwise. | /// @return OK in case of success, FAIL otherwise. | ||||||
| int encode_vim_to_msgpack(msgpack_packer *packer, typval_T *tv, const char *objname); | int encode_vim_to_msgpack(msgpack_packer *packer, typval_T *tv, const char *objname); | ||||||
|  |  | ||||||
| /// Convert VimL value to :echo output | /// Convert Vimscript value to :echo output | ||||||
| /// | /// | ||||||
| /// @param[out]  packer  Packer to save results in. | /// @param[out]  packer  Packer to save results in. | ||||||
| /// @param[in]  tv  Dumped value. | /// @param[in]  tv  Dumped value. | ||||||
|   | |||||||
| @@ -8304,7 +8304,7 @@ static void f_synstack(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| /// f_system - the VimL system() function | /// f_system - the Vimscript system() function | ||||||
| static void f_system(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) | static void f_system(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) | ||||||
| { | { | ||||||
|   get_system_output_as_rettv(argvars, rettv, false); |   get_system_output_as_rettv(argvars, rettv, false); | ||||||
|   | |||||||
| @@ -9,14 +9,14 @@ | |||||||
| #include "nvim/eval/typval_defs.h" | #include "nvim/eval/typval_defs.h" | ||||||
| #include "nvim/types.h" | #include "nvim/types.h" | ||||||
|  |  | ||||||
| /// Prototype of C function that implements VimL function | /// Prototype of C function that implements Vimscript function | ||||||
| typedef void (*VimLFunc)(typval_T *args, typval_T *rvar, EvalFuncData data); | typedef void (*VimLFunc)(typval_T *args, typval_T *rvar, EvalFuncData data); | ||||||
|  |  | ||||||
| /// Special flags for base_arg @see EvalFuncDef | /// Special flags for base_arg @see EvalFuncDef | ||||||
| #define BASE_NONE 0          ///< Not a method (no base argument). | #define BASE_NONE 0          ///< Not a method (no base argument). | ||||||
| #define BASE_LAST UINT8_MAX  ///< Use the last argument as the method base. | #define BASE_LAST UINT8_MAX  ///< Use the last argument as the method base. | ||||||
|  |  | ||||||
| /// Structure holding VimL function definition | /// Structure holding Vimscript function definition | ||||||
| typedef struct { | typedef struct { | ||||||
|   char *name;         ///< Name of the function. |   char *name;         ///< Name of the function. | ||||||
|   uint8_t min_argc;   ///< Minimal number of arguments. |   uint8_t min_argc;   ///< Minimal number of arguments. | ||||||
|   | |||||||
| @@ -170,7 +170,7 @@ void tv_list_watch_fix(list_T *const l, const listitem_T *const item) | |||||||
| /// Caller should take care of the reference count. | /// Caller should take care of the reference count. | ||||||
| /// | /// | ||||||
| /// @param[in]  len  Expected number of items to be populated before list | /// @param[in]  len  Expected number of items to be populated before list | ||||||
| ///                  becomes accessible from VimL. It is still valid to | ///                  becomes accessible from Vimscript. It is still valid to | ||||||
| ///                  underpopulate a list, value only controls how many elements | ///                  underpopulate a list, value only controls how many elements | ||||||
| ///                  will be allocated in advance. Currently does nothing. | ///                  will be allocated in advance. Currently does nothing. | ||||||
| ///                  @see ListLenSpecials. | ///                  @see ListLenSpecials. | ||||||
| @@ -398,7 +398,7 @@ void tv_list_insert(list_T *const l, listitem_T *const ni, listitem_T *const ite | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Insert VimL value into a list | /// Insert Vimscript value into a list | ||||||
| /// | /// | ||||||
| /// @param[out]  l  List to insert to. | /// @param[out]  l  List to insert to. | ||||||
| /// @param[in,out]  tv  Value to insert. Is copied (@see tv_copy()) to an | /// @param[in,out]  tv  Value to insert. Is copied (@see tv_copy()) to an | ||||||
| @@ -434,7 +434,7 @@ void tv_list_append(list_T *const l, listitem_T *const item) | |||||||
|   item->li_next = NULL; |   item->li_next = NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Append VimL value to the end of list | /// Append Vimscript value to the end of list | ||||||
| /// | /// | ||||||
| /// @param[out]  l  List to append to. | /// @param[out]  l  List to append to. | ||||||
| /// @param[in,out]  tv  Value to append. Is copied (@see tv_copy()) to an | /// @param[in,out]  tv  Value to append. Is copied (@see tv_copy()) to an | ||||||
| @@ -3086,7 +3086,7 @@ void f_list2blob(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) | |||||||
| /// | /// | ||||||
| /// @param[out]  ret_tv  Structure where list is saved. | /// @param[out]  ret_tv  Structure where list is saved. | ||||||
| /// @param[in]  len  Expected number of items to be populated before list | /// @param[in]  len  Expected number of items to be populated before list | ||||||
| ///                  becomes accessible from VimL. It is still valid to | ///                  becomes accessible from Vimscript. It is still valid to | ||||||
| ///                  underpopulate a list, value only controls how many elements | ///                  underpopulate a list, value only controls how many elements | ||||||
| ///                  will be allocated in advance. @see ListLenSpecials. | ///                  will be allocated in advance. @see ListLenSpecials. | ||||||
| /// | /// | ||||||
| @@ -3538,7 +3538,7 @@ void tv_clear(typval_T *const tv) | |||||||
|  |  | ||||||
| //{{{3 Free | //{{{3 Free | ||||||
|  |  | ||||||
| /// Free allocated VimL object and value stored inside | /// Free allocated Vimscript object and value stored inside | ||||||
| /// | /// | ||||||
| /// @param  tv  Object to free. | /// @param  tv  Object to free. | ||||||
| void tv_free(typval_T *tv) | void tv_free(typval_T *tv) | ||||||
| @@ -3716,7 +3716,7 @@ void tv_item_lock(typval_T *const tv, const int deep, const bool lock, const boo | |||||||
|   recurse--; |   recurse--; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Check whether VimL value is locked itself or refers to a locked container | /// Check whether Vimscript value is locked itself or refers to a locked container | ||||||
| /// | /// | ||||||
| /// @warning Fixed container is not the same as locked. | /// @warning Fixed container is not the same as locked. | ||||||
| /// | /// | ||||||
| @@ -3815,7 +3815,7 @@ bool value_check_lock(VarLockStatus lock, const char *name, size_t name_len) | |||||||
|  |  | ||||||
| static int tv_equal_recurse_limit; | static int tv_equal_recurse_limit; | ||||||
|  |  | ||||||
| /// Compare two VimL values | /// Compare two Vimscript values | ||||||
| /// | /// | ||||||
| /// Like "==", but strings and numbers are different, as well as floats and | /// Like "==", but strings and numbers are different, as well as floats and | ||||||
| /// numbers. | /// numbers. | ||||||
| @@ -4011,7 +4011,7 @@ static const char *const str_errors[] = { | |||||||
|  |  | ||||||
| #undef FUNC_ERROR | #undef FUNC_ERROR | ||||||
|  |  | ||||||
| /// Check that given value is a VimL String or can be "cast" to it. | /// Check that given value is a Vimscript String or can be "cast" to it. | ||||||
| /// | /// | ||||||
| /// Error messages are compatible with tv_get_string_chk() previously used for | /// Error messages are compatible with tv_get_string_chk() previously used for | ||||||
| /// the same purpose. | /// the same purpose. | ||||||
| @@ -4044,7 +4044,7 @@ bool tv_check_str(const typval_T *const tv) | |||||||
|  |  | ||||||
| //{{{2 Get | //{{{2 Get | ||||||
|  |  | ||||||
| /// Get the number value of a VimL object | /// Get the number value of a Vimscript object | ||||||
| /// | /// | ||||||
| /// @note Use tv_get_number_chk() if you need to determine whether there was an | /// @note Use tv_get_number_chk() if you need to determine whether there was an | ||||||
| ///       error. | ///       error. | ||||||
| @@ -4060,7 +4060,7 @@ varnumber_T tv_get_number(const typval_T *const tv) | |||||||
|   return tv_get_number_chk(tv, &error); |   return tv_get_number_chk(tv, &error); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get the number value of a VimL object | /// Get the number value of a Vimscript object | ||||||
| /// | /// | ||||||
| /// @param[in]  tv  Object to get value from. | /// @param[in]  tv  Object to get value from. | ||||||
| /// @param[out]  ret_error  If type error occurred then `true` will be written | /// @param[out]  ret_error  If type error occurred then `true` will be written | ||||||
| @@ -4119,7 +4119,7 @@ varnumber_T tv_get_bool_chk(const typval_T *const tv, bool *const ret_error) | |||||||
|   return tv_get_number_chk(tv, ret_error); |   return tv_get_number_chk(tv, ret_error); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get the line number from VimL object | /// Get the line number from Vimscript object | ||||||
| /// | /// | ||||||
| /// @param[in]  tv  Object to get value from. Is expected to be a number or | /// @param[in]  tv  Object to get value from. Is expected to be a number or | ||||||
| ///                 a special string like ".", "$", … (works with current buffer | ///                 a special string like ".", "$", … (works with current buffer | ||||||
| @@ -4142,7 +4142,7 @@ linenr_T tv_get_lnum(const typval_T *const tv) | |||||||
|   return lnum; |   return lnum; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get the floating-point value of a VimL object | /// Get the floating-point value of a Vimscript object | ||||||
| /// | /// | ||||||
| /// Raises an error if object is not number or floating-point. | /// Raises an error if object is not number or floating-point. | ||||||
| /// | /// | ||||||
| @@ -4385,7 +4385,7 @@ int tv_check_for_list_or_blob_arg(const typval_T *const args, const int idx) | |||||||
|   return OK; |   return OK; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get the string value of a "stringish" VimL object. | /// Get the string value of a "stringish" Vimscript object. | ||||||
| /// | /// | ||||||
| /// @param[in]  tv  Object to get value of. | /// @param[in]  tv  Object to get value of. | ||||||
| /// @param  buf  Buffer used to hold numbers and special variables converted to | /// @param  buf  Buffer used to hold numbers and special variables converted to | ||||||
| @@ -4430,7 +4430,7 @@ const char *tv_get_string_buf_chk(const typval_T *const tv, char *const buf) | |||||||
|   return NULL; |   return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get the string value of a "stringish" VimL object. | /// Get the string value of a "stringish" Vimscript object. | ||||||
| /// | /// | ||||||
| /// @warning For number and special values it uses a single, static buffer. It | /// @warning For number and special values it uses a single, static buffer. It | ||||||
| ///          may be used only once, next call to tv_get_string may reuse it. Use | ///          may be used only once, next call to tv_get_string may reuse it. Use | ||||||
| @@ -4449,7 +4449,7 @@ const char *tv_get_string_chk(const typval_T *const tv) | |||||||
|   return tv_get_string_buf_chk(tv, mybuf); |   return tv_get_string_buf_chk(tv, mybuf); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get the string value of a "stringish" VimL object. | /// Get the string value of a "stringish" Vimscript object. | ||||||
| /// | /// | ||||||
| /// @warning For number and special values it uses a single, static buffer. It | /// @warning For number and special values it uses a single, static buffer. It | ||||||
| ///          may be used only once, next call to tv_get_string may reuse it. Use | ///          may be used only once, next call to tv_get_string may reuse it. Use | ||||||
| @@ -4471,7 +4471,7 @@ const char *tv_get_string(const typval_T *const tv) | |||||||
|   return tv_get_string_buf((typval_T *)tv, mybuf); |   return tv_get_string_buf((typval_T *)tv, mybuf); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get the string value of a "stringish" VimL object. | /// Get the string value of a "stringish" Vimscript object. | ||||||
| /// | /// | ||||||
| /// @note tv_get_string_chk() and tv_get_string_buf_chk() are similar, but | /// @note tv_get_string_chk() and tv_get_string_buf_chk() are similar, but | ||||||
| ///       return NULL on error. | ///       return NULL on error. | ||||||
|   | |||||||
| @@ -312,7 +312,7 @@ static inline void tv_blob_set(blob_T *const blob, int idx, uint8_t c) | |||||||
|   ((uint8_t *)blob->bv_ga.ga_data)[idx] = c; |   ((uint8_t *)blob->bv_ga.ga_data)[idx] = c; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Initialize VimL object | /// Initialize Vimscript object | ||||||
| /// | /// | ||||||
| /// Initializes to unlocked VAR_UNKNOWN object. | /// Initializes to unlocked VAR_UNKNOWN object. | ||||||
| /// | /// | ||||||
| @@ -424,7 +424,7 @@ static inline bool tv_get_float_chk(const typval_T *tv, float_T *ret_f) | |||||||
| /// | /// | ||||||
| /// Raises an error if object is not number or floating-point. | /// Raises an error if object is not number or floating-point. | ||||||
| /// | /// | ||||||
| /// @param[in]  tv  VimL object to get value from. | /// @param[in]  tv  Vimscript object to get value from. | ||||||
| /// @param[out]  ret_f  Location where resulting float is stored. | /// @param[out]  ret_f  Location where resulting float is stored. | ||||||
| /// | /// | ||||||
| /// @return true in case of success, false if tv is not a number or float. | /// @return true in case of success, false if tv is not a number or float. | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ | |||||||
| #include "nvim/pos.h" | #include "nvim/pos.h" | ||||||
| #include "nvim/types.h" | #include "nvim/types.h" | ||||||
|  |  | ||||||
| /// Type used for VimL VAR_NUMBER values | /// Type used for Vimscript VAR_NUMBER values | ||||||
| typedef int64_t varnumber_T; | typedef int64_t varnumber_T; | ||||||
| typedef uint64_t uvarnumber_T; | typedef uint64_t uvarnumber_T; | ||||||
|  |  | ||||||
| @@ -100,7 +100,7 @@ typedef enum { | |||||||
|   VAR_FIXED = 2,     ///< Locked forever. |   VAR_FIXED = 2,     ///< Locked forever. | ||||||
| } VarLockStatus; | } VarLockStatus; | ||||||
|  |  | ||||||
| /// VimL variable types, for use in typval_T.v_type | /// Vimscript variable types, for use in typval_T.v_type | ||||||
| typedef enum { | typedef enum { | ||||||
|   VAR_UNKNOWN = 0,  ///< Unknown (unspecified) value. |   VAR_UNKNOWN = 0,  ///< Unknown (unspecified) value. | ||||||
|   VAR_NUMBER,       ///< Number, .v_number is used. |   VAR_NUMBER,       ///< Number, .v_number is used. | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ typedef enum { | |||||||
|   kMPConvPartialEnd,  ///< Already converted everything. |   kMPConvPartialEnd,  ///< Already converted everything. | ||||||
| } MPConvPartialStage; | } MPConvPartialStage; | ||||||
|  |  | ||||||
| /// Structure representing current VimL to messagepack conversion state | /// Structure representing current Vimscript to messagepack conversion state | ||||||
| typedef struct { | typedef struct { | ||||||
|   MPConvStackValType type;  ///< Type of the stack entry. |   MPConvStackValType type;  ///< Type of the stack entry. | ||||||
|   typval_T *tv;  ///< Currently converted typval_T. |   typval_T *tv;  ///< Currently converted typval_T. | ||||||
| @@ -60,7 +60,7 @@ typedef struct { | |||||||
|   } data;  ///< Data to convert. |   } data;  ///< Data to convert. | ||||||
| } MPConvStackVal; | } MPConvStackVal; | ||||||
|  |  | ||||||
| /// Stack used to convert VimL values to messagepack. | /// Stack used to convert Vimscript values to messagepack. | ||||||
| typedef kvec_withinit_t(MPConvStackVal, 8) MPConvStack; | typedef kvec_withinit_t(MPConvStackVal, 8) MPConvStack; | ||||||
|  |  | ||||||
| // Defines for MPConvStack | // Defines for MPConvStack | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ | |||||||
| // | // | ||||||
| // The main reason for this queue hierarchy is to allow focusing on a single | // The main reason for this queue hierarchy is to allow focusing on a single | ||||||
| // event emitter while blocking the main loop. For example, if the `jobwait` | // event emitter while blocking the main loop. For example, if the `jobwait` | ||||||
| // VimL function is called on job1, the main loop will temporarily stop polling | // Vimscript function is called on job1, the main loop will temporarily stop polling | ||||||
| // the event loop queue and poll job1 queue instead. Same with channels, when | // the event loop queue and poll job1 queue instead. Same with channels, when | ||||||
| // calling `rpcrequest` we want to temporarily stop processing events from | // calling `rpcrequest` we want to temporarily stop processing events from | ||||||
| // other sources and focus on a specific channel. | // other sources and focus on a specific channel. | ||||||
|   | |||||||
| @@ -222,9 +222,9 @@ | |||||||
| # define FUNC_API_FAST | # define FUNC_API_FAST | ||||||
| /// Internal C function not exposed in the RPC API. | /// Internal C function not exposed in the RPC API. | ||||||
| # define FUNC_API_NOEXPORT | # define FUNC_API_NOEXPORT | ||||||
| /// API function not exposed in VimL/eval. | /// API function not exposed in Vimscript/eval. | ||||||
| # define FUNC_API_REMOTE_ONLY | # define FUNC_API_REMOTE_ONLY | ||||||
| /// API function not exposed in VimL/remote. | /// API function not exposed in Vimscript/remote. | ||||||
| # define FUNC_API_LUA_ONLY | # define FUNC_API_LUA_ONLY | ||||||
| /// API function checked textlock. | /// API function checked textlock. | ||||||
| # define FUNC_API_CHECK_TEXTLOCK | # define FUNC_API_CHECK_TEXTLOCK | ||||||
|   | |||||||
| @@ -2432,7 +2432,7 @@ theend: | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Add a match to the list of matches from VimL object | /// Add a match to the list of matches from Vimscript object | ||||||
| /// | /// | ||||||
| /// @param[in]  tv  Object to get matches from. | /// @param[in]  tv  Object to get matches from. | ||||||
| /// @param[in]  dir  Completion direction. | /// @param[in]  dir  Completion direction. | ||||||
|   | |||||||
| @@ -183,7 +183,7 @@ typedef struct { | |||||||
|   int idx;  ///< Container index (used to detect self-referencing structures). |   int idx;  ///< Container index (used to detect self-referencing structures). | ||||||
| } TVPopStackItem; | } TVPopStackItem; | ||||||
|  |  | ||||||
| /// Convert lua object to VimL typval_T | /// Convert lua object to Vimscript typval_T | ||||||
| /// | /// | ||||||
| /// Should pop exactly one value from lua stack. | /// Should pop exactly one value from lua stack. | ||||||
| /// | /// | ||||||
| @@ -601,7 +601,7 @@ static bool typval_conv_special = false; | |||||||
| #undef TYPVAL_ENCODE_CONV_RECURSE | #undef TYPVAL_ENCODE_CONV_RECURSE | ||||||
| #undef TYPVAL_ENCODE_ALLOW_SPECIALS | #undef TYPVAL_ENCODE_ALLOW_SPECIALS | ||||||
|  |  | ||||||
| /// Convert VimL typval_T to lua value | /// Convert Vimscript typval_T to lua value | ||||||
| /// | /// | ||||||
| /// Should leave single value in lua stack. May only fail if lua failed to grow | /// Should leave single value in lua stack. May only fail if lua failed to grow | ||||||
| /// stack. | /// stack. | ||||||
| @@ -628,8 +628,7 @@ bool nlua_push_typval(lua_State *lstate, typval_T *const tv, bool special) | |||||||
|  |  | ||||||
| /// Push value which is a type index | /// Push value which is a type index | ||||||
| /// | /// | ||||||
| /// Used for all “typed” tables: i.e. for all tables which represent VimL | /// Used for all “typed” tables: i.e. for all tables which represent Vimscript values. | ||||||
| /// values. |  | ||||||
| static inline void nlua_push_type_idx(lua_State *lstate) | static inline void nlua_push_type_idx(lua_State *lstate) | ||||||
|   FUNC_ATTR_NONNULL_ALL |   FUNC_ATTR_NONNULL_ALL | ||||||
| { | { | ||||||
| @@ -657,7 +656,7 @@ static inline void nlua_push_type(lua_State *lstate, ObjectType type) | |||||||
|   lua_pushnumber(lstate, (lua_Number)type); |   lua_pushnumber(lstate, (lua_Number)type); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Create lua table which has an entry that determines its VimL type | /// Create Lua table which has an entry that determines its Vimscript type | ||||||
| /// | /// | ||||||
| /// @param[out]  lstate  Lua state. | /// @param[out]  lstate  Lua state. | ||||||
| /// @param[in]   narr    Number of “array” entries to be populated later. | /// @param[in]   narr    Number of “array” entries to be populated later. | ||||||
|   | |||||||
| @@ -1487,7 +1487,7 @@ int nlua_source_using_linegetter(LineGetter fgetline, void *cookie, char *name) | |||||||
|  |  | ||||||
| /// Call a LuaCallable given some typvals | /// Call a LuaCallable given some typvals | ||||||
| /// | /// | ||||||
| /// Used to call any lua callable passed from Lua into VimL | /// Used to call any Lua callable passed from Lua into Vimscript. | ||||||
| /// | /// | ||||||
| /// @param[in]  lstate Lua State | /// @param[in]  lstate Lua State | ||||||
| /// @param[in]  lua_cb Lua Callable | /// @param[in]  lua_cb Lua Callable | ||||||
| @@ -1622,7 +1622,7 @@ bool nlua_is_deferred_safe(void) | |||||||
| /// | /// | ||||||
| /// Used for :lua. | /// Used for :lua. | ||||||
| /// | /// | ||||||
| /// @param  eap  VimL command being run. | /// @param  eap  Vimscript command being run. | ||||||
| void ex_lua(exarg_T *const eap) | void ex_lua(exarg_T *const eap) | ||||||
|   FUNC_ATTR_NONNULL_ALL |   FUNC_ATTR_NONNULL_ALL | ||||||
| { | { | ||||||
| @@ -1654,7 +1654,7 @@ void ex_lua(exarg_T *const eap) | |||||||
| /// | /// | ||||||
| /// Used for :luado. | /// Used for :luado. | ||||||
| /// | /// | ||||||
| /// @param  eap  VimL command being run. | /// @param  eap  Vimscript command being run. | ||||||
| void ex_luado(exarg_T *const eap) | void ex_luado(exarg_T *const eap) | ||||||
|   FUNC_ATTR_NONNULL_ALL |   FUNC_ATTR_NONNULL_ALL | ||||||
| { | { | ||||||
| @@ -1735,7 +1735,7 @@ void ex_luado(exarg_T *const eap) | |||||||
| /// | /// | ||||||
| /// Used for :luafile. | /// Used for :luafile. | ||||||
| /// | /// | ||||||
| /// @param  eap  VimL command being run. | /// @param  eap  Vimscript command being run. | ||||||
| void ex_luafile(exarg_T *const eap) | void ex_luafile(exarg_T *const eap) | ||||||
|   FUNC_ATTR_NONNULL_ALL |   FUNC_ATTR_NONNULL_ALL | ||||||
| { | { | ||||||
|   | |||||||
| @@ -7276,7 +7276,7 @@ void f_getqflist(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) | |||||||
|   get_qf_loc_list(true, NULL, &argvars[0], rettv); |   get_qf_loc_list(true, NULL, &argvars[0], rettv); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Create quickfix/location list from VimL values | /// Create quickfix/location list from Vimscript values | ||||||
| /// | /// | ||||||
| /// Used by `setqflist()` and `setloclist()` functions. Accepts invalid | /// Used by `setqflist()` and `setloclist()` functions. Accepts invalid | ||||||
| /// args argument in which case errors out, including VAR_UNKNOWN parameters. | /// args argument in which case errors out, including VAR_UNKNOWN parameters. | ||||||
|   | |||||||
| @@ -1770,7 +1770,7 @@ static FILE *fopen_noinh_readbin(char *filename) | |||||||
|   return fdopen(fd_tmp, READBIN); |   return fdopen(fd_tmp, READBIN); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Concatenate VimL line if it starts with a line continuation into a growarray | /// Concatenate Vimscript line if it starts with a line continuation into a growarray | ||||||
| /// (excluding the continuation chars and leading whitespace) | /// (excluding the continuation chars and leading whitespace) | ||||||
| /// | /// | ||||||
| /// @note Growsize of the growarray may be changed to speed up concatenations! | /// @note Growsize of the growarray may be changed to speed up concatenations! | ||||||
|   | |||||||
| @@ -3396,7 +3396,7 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const | |||||||
|       if (msgpack_to_vim(obj, &adtv) == FAIL \ |       if (msgpack_to_vim(obj, &adtv) == FAIL \ | ||||||
|           || adtv.v_type != VAR_DICT) { \ |           || adtv.v_type != VAR_DICT) { \ | ||||||
|         semsg(_(READERR(name, \ |         semsg(_(READERR(name, \ | ||||||
|                         "cannot be converted to a VimL dictionary")), \ |                         "cannot be converted to a Vimscript dictionary")), \ | ||||||
|               initial_fpos); \ |               initial_fpos); \ | ||||||
|         ga_clear(&ad_ga); \ |         ga_clear(&ad_ga); \ | ||||||
|         tv_clear(&adtv); \ |         tv_clear(&adtv); \ | ||||||
| @@ -3420,7 +3420,7 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const | |||||||
|       }; \ |       }; \ | ||||||
|       typval_T aetv; \ |       typval_T aetv; \ | ||||||
|       if (msgpack_to_vim(obj, &aetv) == FAIL) { \ |       if (msgpack_to_vim(obj, &aetv) == FAIL) { \ | ||||||
|         semsg(_(READERR(name, "cannot be converted to a VimL list")), \ |         semsg(_(READERR(name, "cannot be converted to a Vimscript list")), \ | ||||||
|               initial_fpos); \ |               initial_fpos); \ | ||||||
|         tv_clear(&aetv); \ |         tv_clear(&aetv); \ | ||||||
|         goto shada_read_next_item_error; \ |         goto shada_read_next_item_error; \ | ||||||
| @@ -3819,7 +3819,7 @@ shada_read_next_item_start: | |||||||
|     } else if (msgpack_to_vim(unpacked.data.via.array.ptr[1], |     } else if (msgpack_to_vim(unpacked.data.via.array.ptr[1], | ||||||
|                               &(entry->data.global_var.value)) == FAIL) { |                               &(entry->data.global_var.value)) == FAIL) { | ||||||
|       semsg(_(READERR("variable", "has value that cannot " |       semsg(_(READERR("variable", "has value that cannot " | ||||||
|                       "be converted to the VimL value")), initial_fpos); |                       "be converted to the Vimscript value")), initial_fpos); | ||||||
|       goto shada_read_next_item_error; |       goto shada_read_next_item_error; | ||||||
|     } |     } | ||||||
|     break; |     break; | ||||||
|   | |||||||
| @@ -500,13 +500,10 @@ static const char *const e_printf = | |||||||
|  |  | ||||||
| /// Get number argument from idxp entry in tvs | /// Get number argument from idxp entry in tvs | ||||||
| /// | /// | ||||||
| /// Will give an error message for VimL entry with invalid type or for | /// Will give an error message for Vimscript entry with invalid type or for insufficient entries. | ||||||
| /// insufficient entries. |  | ||||||
| /// | /// | ||||||
| /// @param[in]  tvs  List of VimL values. List is terminated by VAR_UNKNOWN | /// @param[in]  tvs  List of Vimscript values. List is terminated by VAR_UNKNOWN value. | ||||||
| ///                  value. | /// @param[in,out]  idxp  Index in a list. Will be incremented. Indexing starts at 1. | ||||||
| /// @param[in,out]  idxp  Index in a list. Will be incremented. Indexing starts |  | ||||||
| ///                       at 1. |  | ||||||
| /// | /// | ||||||
| /// @return Number value or 0 in case of error. | /// @return Number value or 0 in case of error. | ||||||
| static varnumber_T tv_nr(typval_T *tvs, int *idxp) | static varnumber_T tv_nr(typval_T *tvs, int *idxp) | ||||||
| @@ -530,10 +527,10 @@ static varnumber_T tv_nr(typval_T *tvs, int *idxp) | |||||||
|  |  | ||||||
| /// Get string argument from idxp entry in tvs | /// Get string argument from idxp entry in tvs | ||||||
| /// | /// | ||||||
| /// Will give an error message for VimL entry with invalid type or for | /// Will give an error message for Vimscript entry with invalid type or for | ||||||
| /// insufficient entries. | /// insufficient entries. | ||||||
| /// | /// | ||||||
| /// @param[in]  tvs  List of VimL values. List is terminated by VAR_UNKNOWN | /// @param[in]  tvs  List of Vimscript values. List is terminated by VAR_UNKNOWN | ||||||
| ///                  value. | ///                  value. | ||||||
| /// @param[in,out]  idxp  Index in a list. Will be incremented. | /// @param[in,out]  idxp  Index in a list. Will be incremented. | ||||||
| /// @param[out]  tofree  If the idxp entry in tvs is not a String or a Number, | /// @param[out]  tofree  If the idxp entry in tvs is not a String or a Number, | ||||||
| @@ -564,7 +561,7 @@ static const char *tv_str(typval_T *tvs, int *idxp, char **const tofree) | |||||||
|  |  | ||||||
| /// Get pointer argument from the next entry in tvs | /// Get pointer argument from the next entry in tvs | ||||||
| /// | /// | ||||||
| /// Will give an error message for VimL entry with invalid type or for | /// Will give an error message for Vimscript entry with invalid type or for | ||||||
| /// insufficient entries. | /// insufficient entries. | ||||||
| /// | /// | ||||||
| /// @param[in]  tvs  List of typval_T values. | /// @param[in]  tvs  List of typval_T values. | ||||||
| @@ -595,11 +592,10 @@ static const void *tv_ptr(const typval_T *const tvs, int *const idxp) | |||||||
|  |  | ||||||
| /// Get float argument from idxp entry in tvs | /// Get float argument from idxp entry in tvs | ||||||
| /// | /// | ||||||
| /// Will give an error message for VimL entry with invalid type or for | /// Will give an error message for Vimscript entry with invalid type or for | ||||||
| /// insufficient entries. | /// insufficient entries. | ||||||
| /// | /// | ||||||
| /// @param[in]  tvs  List of VimL values. List is terminated by VAR_UNKNOWN | /// @param[in]  tvs  List of Vimscript values. List is terminated by VAR_UNKNOWN value. | ||||||
| ///                  value. |  | ||||||
| /// @param[in,out]  idxp  Index in a list. Will be incremented. | /// @param[in,out]  idxp  Index in a list. Will be incremented. | ||||||
| /// | /// | ||||||
| /// @return Floating-point value or zero in case of error. | /// @return Floating-point value or zero in case of error. | ||||||
| @@ -727,7 +723,7 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) | |||||||
| /// @param[in]  str_m  String length. | /// @param[in]  str_m  String length. | ||||||
| /// @param[in]  fmt  String format. | /// @param[in]  fmt  String format. | ||||||
| /// @param[in]  ap  Values that should be formatted. Ignored if tvs is not NULL. | /// @param[in]  ap  Values that should be formatted. Ignored if tvs is not NULL. | ||||||
| /// @param[in]  tvs  Values that should be formatted, for printf() VimL | /// @param[in]  tvs  Values that should be formatted, for printf() Vimscript | ||||||
| ///                  function. Must be NULL in other cases. | ///                  function. Must be NULL in other cases. | ||||||
| /// | /// | ||||||
| /// @return Number of bytes excluding NUL byte that would be written to the | /// @return Number of bytes excluding NUL byte that would be written to the | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ typedef int handle_T; | |||||||
| // absent callback etc. | // absent callback etc. | ||||||
| typedef int LuaRef; | typedef int LuaRef; | ||||||
|  |  | ||||||
| /// Type used for VimL VAR_FLOAT values | /// Type used for Vimscript VAR_FLOAT values | ||||||
| typedef double float_T; | typedef double float_T; | ||||||
|  |  | ||||||
| typedef struct MsgpackRpcRequestHandler MsgpackRpcRequestHandler; | typedef struct MsgpackRpcRequestHandler MsgpackRpcRequestHandler; | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| // This is an open source non-commercial project. Dear PVS-Studio, please check | // This is an open source non-commercial project. Dear PVS-Studio, please check | ||||||
| // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com | // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com | ||||||
|  |  | ||||||
| /// VimL expression parser | /// Vimscript expression parser | ||||||
|  |  | ||||||
| // Planned incompatibilities (to be included into vim_diff.txt when this parser | // Planned incompatibilities (to be included into vim_diff.txt when this parser | ||||||
| // will be an actual part of VimL evaluation process): | // will be an actual part of Vimscript evaluation process): | ||||||
| // | // | ||||||
| // 1. Expressions are first fully parsed and only then executed.  This means | // 1. Expressions are first fully parsed and only then executed.  This means | ||||||
| //    that while ":echo [system('touch abc')" will create file "abc" in Vim and | //    that while ":echo [system('touch abc')" will create file "abc" in Vim and | ||||||
| @@ -89,7 +89,7 @@ typedef enum { | |||||||
|  |  | ||||||
| /// Parse type: what is being parsed currently | /// Parse type: what is being parsed currently | ||||||
| typedef enum { | typedef enum { | ||||||
|   /// Parsing regular VimL expression |   /// Parsing regular Vimscript expression | ||||||
|   kEPTExpr = 0, |   kEPTExpr = 0, | ||||||
|   /// Parsing lambda arguments |   /// Parsing lambda arguments | ||||||
|   /// |   /// | ||||||
| @@ -171,7 +171,7 @@ static inline float_T scale_number(const float_T num, const uint8_t base, | |||||||
|   return ret; |   return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// Get next token for the VimL expression input | /// Get next token for the Vimscript expression input | ||||||
| /// | /// | ||||||
| /// @param  pstate  Parser state. | /// @param  pstate  Parser state. | ||||||
| /// @param[in]  flags  Flags, @see LexExprFlags. | /// @param[in]  flags  Flags, @see LexExprFlags. | ||||||
| @@ -1168,7 +1168,7 @@ static struct { | |||||||
|   // represented as "list(comma(a, comma(b, comma(c, d))))" then if it is |   // represented as "list(comma(a, comma(b, comma(c, d))))" then if it is | ||||||
|   // "list(comma(comma(comma(a, b), c), d))" in which case you will need to |   // "list(comma(comma(comma(a, b), c), d))" in which case you will need to | ||||||
|   // traverse all three comma() structures. And with comma operator (including |   // traverse all three comma() structures. And with comma operator (including | ||||||
|   // actual comma operator from C which is not present in VimL) nobody cares |   // actual comma operator from C which is not present in Vimscript) nobody cares | ||||||
|   // about associativity, only about order of execution. |   // about associativity, only about order of execution. | ||||||
|   [kExprNodeComma] = { kEOpLvlComma, kEOpAssRight }, |   [kExprNodeComma] = { kEOpLvlComma, kEOpAssRight }, | ||||||
|  |  | ||||||
| @@ -1915,7 +1915,7 @@ static const uint8_t base_to_prefix_length[] = { | |||||||
|   [16] = 2, |   [16] = 2, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /// Parse one VimL expression | /// Parse one Vimscript expression | ||||||
| /// | /// | ||||||
| /// @param  pstate  Parser state. | /// @param  pstate  Parser state. | ||||||
| /// @param[in]  flags  Additional flags, see ExprParserFlags | /// @param[in]  flags  Additional flags, see ExprParserFlags | ||||||
|   | |||||||
| @@ -346,15 +346,15 @@ describe('API', function() | |||||||
|       os.remove(fname) |       os.remove(fname) | ||||||
|     end) |     end) | ||||||
|  |  | ||||||
|     it('VimL validation error: fails with specific error', function() |     it('Vimscript validation error: fails with specific error', function() | ||||||
|       local status, rv = pcall(nvim, "command", "bogus_command") |       local status, rv = pcall(nvim, "command", "bogus_command") | ||||||
|       eq(false, status)                       -- nvim_command() failed. |       eq(false, status)                       -- nvim_command() failed. | ||||||
|       eq("E492:", string.match(rv, "E%d*:"))  -- VimL error was returned. |       eq("E492:", string.match(rv, "E%d*:"))  -- Vimscript error was returned. | ||||||
|       eq('', nvim('eval', 'v:errmsg'))        -- v:errmsg was not updated. |       eq('', nvim('eval', 'v:errmsg'))        -- v:errmsg was not updated. | ||||||
|       eq('', eval('v:exception')) |       eq('', eval('v:exception')) | ||||||
|     end) |     end) | ||||||
|  |  | ||||||
|     it('VimL execution error: fails with specific error', function() |     it('Vimscript execution error: fails with specific error', function() | ||||||
|       local status, rv = pcall(nvim, "command", "buffer 23487") |       local status, rv = pcall(nvim, "command", "buffer 23487") | ||||||
|       eq(false, status)                 -- nvim_command() failed. |       eq(false, status)                 -- nvim_command() failed. | ||||||
|       eq("E86: Buffer 23487 does not exist", string.match(rv, "E%d*:.*")) |       eq("E86: Buffer 23487 does not exist", string.match(rv, "E%d*:.*")) | ||||||
| @@ -422,7 +422,7 @@ describe('API', function() | |||||||
|       eq(':!echo foo\r\n\nfoo'..win_lf..'\n', nvim('command_output', [[!echo foo]])) |       eq(':!echo foo\r\n\nfoo'..win_lf..'\n', nvim('command_output', [[!echo foo]])) | ||||||
|     end) |     end) | ||||||
|  |  | ||||||
|     it('VimL validation error: fails with specific error', function() |     it('Vimscript validation error: fails with specific error', function() | ||||||
|       local status, rv = pcall(nvim, "command_output", "bogus commannnd") |       local status, rv = pcall(nvim, "command_output", "bogus commannnd") | ||||||
|       eq(false, status)                 -- nvim_command_output() failed. |       eq(false, status)                 -- nvim_command_output() failed. | ||||||
|       eq("E492: Not an editor command: bogus commannnd", |       eq("E492: Not an editor command: bogus commannnd", | ||||||
| @@ -432,7 +432,7 @@ describe('API', function() | |||||||
|       eq({mode='n', blocking=false}, nvim("get_mode")) |       eq({mode='n', blocking=false}, nvim("get_mode")) | ||||||
|     end) |     end) | ||||||
|  |  | ||||||
|     it('VimL execution error: fails with specific error', function() |     it('Vimscript execution error: fails with specific error', function() | ||||||
|       local status, rv = pcall(nvim, "command_output", "buffer 42") |       local status, rv = pcall(nvim, "command_output", "buffer 42") | ||||||
|       eq(false, status)                 -- nvim_command_output() failed. |       eq(false, status)                 -- nvim_command_output() failed. | ||||||
|       eq("E86: Buffer 42 does not exist", string.match(rv, "E%d*:.*")) |       eq("E86: Buffer 42 does not exist", string.match(rv, "E%d*:.*")) | ||||||
| @@ -463,7 +463,7 @@ describe('API', function() | |||||||
|       eq(2, request("vim_eval", "1+1")) |       eq(2, request("vim_eval", "1+1")) | ||||||
|     end) |     end) | ||||||
|  |  | ||||||
|     it("VimL error: returns error details, does NOT update v:errmsg", function() |     it("Vimscript error: returns error details, does NOT update v:errmsg", function() | ||||||
|       eq('Vim:E121: Undefined variable: bogus', |       eq('Vim:E121: Undefined variable: bogus', | ||||||
|         pcall_err(request, 'nvim_eval', 'bogus expression')) |         pcall_err(request, 'nvim_eval', 'bogus expression')) | ||||||
|       eq('', eval('v:errmsg'))  -- v:errmsg was not updated. |       eq('', eval('v:errmsg'))  -- v:errmsg was not updated. | ||||||
| @@ -478,7 +478,7 @@ describe('API', function() | |||||||
|       eq('foo', nvim('call_function', 'simplify', {'this/./is//redundant/../../../foo'})) |       eq('foo', nvim('call_function', 'simplify', {'this/./is//redundant/../../../foo'})) | ||||||
|     end) |     end) | ||||||
|  |  | ||||||
|     it("VimL validation error: returns specific error, does NOT update v:errmsg", function() |     it("Vimscript validation error: returns specific error, does NOT update v:errmsg", function() | ||||||
|       eq('Vim:E117: Unknown function: bogus function', |       eq('Vim:E117: Unknown function: bogus function', | ||||||
|         pcall_err(request, 'nvim_call_function', 'bogus function', {'arg1'})) |         pcall_err(request, 'nvim_call_function', 'bogus function', {'arg1'})) | ||||||
|       eq('Vim:E119: Not enough arguments for function: atan', |       eq('Vim:E119: Not enough arguments for function: atan', | ||||||
| @@ -487,7 +487,7 @@ describe('API', function() | |||||||
|       eq('', eval('v:errmsg'))  -- v:errmsg was not updated. |       eq('', eval('v:errmsg'))  -- v:errmsg was not updated. | ||||||
|     end) |     end) | ||||||
|  |  | ||||||
|     it("VimL error: returns error details, does NOT update v:errmsg", function() |     it("Vimscript error: returns error details, does NOT update v:errmsg", function() | ||||||
|       eq('Vim:E808: Number or Float required', |       eq('Vim:E808: Number or Float required', | ||||||
|         pcall_err(request, 'nvim_call_function', 'atan', {'foo'})) |         pcall_err(request, 'nvim_call_function', 'atan', {'foo'})) | ||||||
|       eq('Vim:Invalid channel stream "xxx"', |       eq('Vim:Invalid channel stream "xxx"', | ||||||
| @@ -498,7 +498,7 @@ describe('API', function() | |||||||
|       eq('', eval('v:errmsg'))  -- v:errmsg was not updated. |       eq('', eval('v:errmsg'))  -- v:errmsg was not updated. | ||||||
|     end) |     end) | ||||||
|  |  | ||||||
|     it("VimL exception: returns exception details, does NOT update v:errmsg", function() |     it("Vimscript exception: returns exception details, does NOT update v:errmsg", function() | ||||||
|       source([[ |       source([[ | ||||||
|         function! Foo() abort |         function! Foo() abort | ||||||
|           throw 'wtf' |           throw 'wtf' | ||||||
| @@ -523,7 +523,7 @@ describe('API', function() | |||||||
|   end) |   end) | ||||||
|  |  | ||||||
|   describe('nvim_call_dict_function', function() |   describe('nvim_call_dict_function', function() | ||||||
|     it('invokes VimL dict function', function() |     it('invokes Vimscript dict function', function() | ||||||
|       source([[ |       source([[ | ||||||
|         function! F(name) dict |         function! F(name) dict | ||||||
|           return self.greeting.', '.a:name.'!' |           return self.greeting.', '.a:name.'!' | ||||||
| @@ -653,7 +653,7 @@ describe('API', function() | |||||||
|   end) |   end) | ||||||
|  |  | ||||||
|   describe('nvim_input', function() |   describe('nvim_input', function() | ||||||
|     it("VimL error: does NOT fail, updates v:errmsg", function() |     it("Vimscript error: does NOT fail, updates v:errmsg", function() | ||||||
|       local status, _ = pcall(nvim, "input", ":call bogus_fn()<CR>") |       local status, _ = pcall(nvim, "input", ":call bogus_fn()<CR>") | ||||||
|       local v_errnum = string.match(nvim("eval", "v:errmsg"), "E%d*:") |       local v_errnum = string.match(nvim("eval", "v:errmsg"), "E%d*:") | ||||||
|       eq(true, status)        -- nvim_input() did not fail. |       eq(true, status)        -- nvim_input() did not fail. | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ local command = helpers.command | |||||||
| local eval = helpers.eval | local eval = helpers.eval | ||||||
|  |  | ||||||
|  |  | ||||||
| describe('VimL dictionary notifications', function() | describe('Vimscript dictionary notifications', function() | ||||||
|   local channel |   local channel | ||||||
|  |  | ||||||
|   before_each(function() |   before_each(function() | ||||||
|   | |||||||
| @@ -191,7 +191,7 @@ describe('swapfile detection', function() | |||||||
|     feed('e')  -- Chose "Edit" at the swap dialog. |     feed('e')  -- Chose "Edit" at the swap dialog. | ||||||
|     screen2:expect(expected_no_dialog) |     screen2:expect(expected_no_dialog) | ||||||
|  |  | ||||||
|     -- With API (via eval/VimL) call and shortmess+=F |     -- With API (via eval/Vimscript) call and shortmess+=F | ||||||
|     feed(':call nvim_command("edit %")<CR>') |     feed(':call nvim_command("edit %")<CR>') | ||||||
|     screen2:expect{any=[[Found a swap file by the name ".*]] |     screen2:expect{any=[[Found a swap file by the name ".*]] | ||||||
|                        ..[[Xtest_swapdialog_dir[/\].*]]..testfile..[[%.swp"]]} |                        ..[[Xtest_swapdialog_dir[/\].*]]..testfile..[[%.swp"]]} | ||||||
|   | |||||||
| @@ -265,7 +265,7 @@ function module.nvim_prog_abs() | |||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Executes an ex-command. VimL errors manifest as client (lua) errors, but | -- Executes an ex-command. Vimscript errors manifest as client (lua) errors, but | ||||||
| -- v:errmsg will not be updated. | -- v:errmsg will not be updated. | ||||||
| function module.command(cmd) | function module.command(cmd) | ||||||
|   module.request('nvim_command', cmd) |   module.request('nvim_command', cmd) | ||||||
| @@ -289,26 +289,26 @@ function module.expect_exit(fn_or_timeout, ...) | |||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Evaluates a VimL expression. | -- Evaluates a Vimscript expression. | ||||||
| -- Fails on VimL error, but does not update v:errmsg. | -- Fails on Vimscript error, but does not update v:errmsg. | ||||||
| function module.eval(expr) | function module.eval(expr) | ||||||
|   return module.request('nvim_eval', expr) |   return module.request('nvim_eval', expr) | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Executes a VimL function via RPC. | -- Executes a Vimscript function via RPC. | ||||||
| -- Fails on VimL error, but does not update v:errmsg. | -- Fails on Vimscript error, but does not update v:errmsg. | ||||||
| function module.call(name, ...) | function module.call(name, ...) | ||||||
|   return module.request('nvim_call_function', name, {...}) |   return module.request('nvim_call_function', name, {...}) | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Executes a VimL function via Lua. | -- Executes a Vimscript function via Lua. | ||||||
| -- Fails on VimL error, but does not update v:errmsg. | -- Fails on Vimscript error, but does not update v:errmsg. | ||||||
| function module.call_lua(name, ...) | function module.call_lua(name, ...) | ||||||
|   return module.exec_lua([[return vim.call(...)]], name, ...) |   return module.exec_lua([[return vim.call(...)]], name, ...) | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Sends user input to Nvim. | -- Sends user input to Nvim. | ||||||
| -- Does not fail on VimL error, but v:errmsg will be updated. | -- Does not fail on Vimscript error, but v:errmsg will be updated. | ||||||
| local function nvim_feed(input) | local function nvim_feed(input) | ||||||
|   while #input > 0 do |   while #input > 0 do | ||||||
|     local written = module.request('nvim_input', input) |     local written = module.request('nvim_input', input) | ||||||
| @@ -518,7 +518,7 @@ function module.insert(...) | |||||||
|   nvim_feed('<ESC>') |   nvim_feed('<ESC>') | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Executes an ex-command by user input. Because nvim_input() is used, VimL | -- Executes an ex-command by user input. Because nvim_input() is used, Vimscript | ||||||
| -- errors will not manifest as client (lua) errors. Use command() for that. | -- errors will not manifest as client (lua) errors. Use command() for that. | ||||||
| function module.feed_command(...) | function module.feed_command(...) | ||||||
|   for _, v in ipairs({...}) do |   for _, v in ipairs({...}) do | ||||||
|   | |||||||
| @@ -211,7 +211,7 @@ describe('clipboard', function() | |||||||
|     eq('', eval('provider#clipboard#Error()')) |     eq('', eval('provider#clipboard#Error()')) | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|   it('g:clipboard using VimL functions', function() |   it('g:clipboard using Vimscript functions', function() | ||||||
|     -- Implements a fake clipboard provider. cache_enabled is meaningless here. |     -- Implements a fake clipboard provider. cache_enabled is meaningless here. | ||||||
|     source([[let g:clipboard = { |     source([[let g:clipboard = { | ||||||
|             \  'name': 'custom', |             \  'name': 'custom', | ||||||
| @@ -245,7 +245,7 @@ describe('clipboard', function() | |||||||
|     eq({{'star', ''}, 'b'}, eval("g:dummy_clipboard_star")) |     eq({{'star', ''}, 'b'}, eval("g:dummy_clipboard_star")) | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|   describe('g:clipboard[paste] VimL function', function() |   describe('g:clipboard[paste] Vimscript function', function() | ||||||
|     it('can return empty list for empty clipboard', function() |     it('can return empty list for empty clipboard', function() | ||||||
|       source([[let g:dummy_clipboard = [] |       source([[let g:dummy_clipboard = [] | ||||||
|               let g:clipboard = { |               let g:clipboard = { | ||||||
|   | |||||||
| @@ -552,7 +552,7 @@ describe('confirm()', function() | |||||||
|     feed(':silent edit foo<cr>') |     feed(':silent edit foo<cr>') | ||||||
|     check_and_clear(':silent edit foo         |\n') |     check_and_clear(':silent edit foo         |\n') | ||||||
|  |  | ||||||
|     -- With API (via eval/VimL) call and shortmess+=F |     -- With API (via eval/Vimscript) call and shortmess+=F | ||||||
|     feed(':call nvim_command("edit x")<cr>') |     feed(':call nvim_command("edit x")<cr>') | ||||||
|     check_and_clear(':call nvim_command("edit |\n') |     check_and_clear(':call nvim_command("edit |\n') | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Justin M. Keyes
					Justin M. Keyes