From 419819b6245e120aba8897e3ddea711b2cd0246c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 5 Mar 2023 09:18:42 +0800 Subject: vim-patch:9.0.1380: CTRL-X on 2**64 subtracts two (#22530) Problem: CTRL-X on 2**64 subtracts two. (James McCoy) Solution: Correct computation for large number. (closes vim/vim#12103) https://github.com/vim/vim/commit/5fb78c3fa5c996c08a65431d698bd2c251eef5c7 Co-authored-by: Bram Moolenaar --- src/nvim/viml/parser/expressions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 53224f2ee9..35d9de069b 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -376,7 +376,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags) } if (exp_start) { vim_str2nr(pline.data + exp_start, NULL, NULL, 0, NULL, &exp_part, - (int)(ret.len - exp_start), false); + (int)(ret.len - exp_start), false, NULL); } if (exp_negative) { exp_part += frac_size; @@ -394,7 +394,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags) int len; int prep; vim_str2nr(pline.data, &prep, &len, STR2NR_ALL, NULL, - &ret.data.num.val.integer, (int)pline.size, false); + &ret.data.num.val.integer, (int)pline.size, false, NULL); ret.len = (size_t)len; const uint8_t bases[] = { [0] = 10, -- cgit From a1b045f60a22d366e255dfff1c54ed42ebe49284 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 26 Apr 2023 18:28:49 +0200 Subject: refactor(clang-tidy): remove redundant casts --- src/nvim/viml/parser/expressions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 35d9de069b..d1c6426cba 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -367,7 +367,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags) // uses recorded position to scale number down when processing exponent. float_T significand_part = 0; uvarnumber_T exp_part = 0; - const size_t frac_size = (size_t)(frac_end - frac_start); + const size_t frac_size = frac_end - frac_start; for (size_t i = 0; i < frac_end; i++) { if (i == frac_start - 1) { continue; -- cgit From 08991b078267e5de0a19a136d00d4f71ad651a32 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 13 May 2023 21:33:22 +0200 Subject: docs: small fixes Co-authored-by: Christian Clason Co-authored-by: Gregory Anders Co-authored-by: HiPhish Co-authored-by: Julio B Co-authored-by: T727 <74924917+T-727@users.noreply.github.com> Co-authored-by: camoz Co-authored-by: champignoom <66909116+champignoom@users.noreply.github.com> --- src/nvim/viml/parser/expressions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index d1c6426cba..830d8c5f34 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -2866,7 +2866,7 @@ viml_pexpr_parse_no_paren_closing_error: {} case kENodeOperator: if (prev_token.type == kExprLexSpacing) { // For some reason "function (args)" is a function call, but - // "(funcref) (args)" is not. AFAIR this somehow involves + // "(funcref) (args)" is not. As far as I remember this somehow involves // compatibility and Bram was commenting that this is // intentionally inconsistent and he is not very happy with the // situation himself. -- cgit From 2f17ef1fc4b96cf1106fd95ba090d34a2e4b977b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 22 Jun 2023 04:09:14 -0700 Subject: fix(messages): use "Vimscript" instead of "VimL" #24111 followup to #24109 fix #16150 --- src/nvim/viml/parser/expressions.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 830d8c5f34..b53508bc6c 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -1,10 +1,10 @@ // 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 -/// VimL expression parser +/// Vimscript expression 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 // 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 typedef enum { - /// Parsing regular VimL expression + /// Parsing regular Vimscript expression kEPTExpr = 0, /// Parsing lambda arguments /// @@ -171,7 +171,7 @@ static inline float_T scale_number(const float_T num, const uint8_t base, return ret; } -/// Get next token for the VimL expression input +/// Get next token for the Vimscript expression input /// /// @param pstate Parser state. /// @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 // "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 - // 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. [kExprNodeComma] = { kEOpLvlComma, kEOpAssRight }, @@ -1915,7 +1915,7 @@ static const uint8_t base_to_prefix_length[] = { [16] = 2, }; -/// Parse one VimL expression +/// Parse one Vimscript expression /// /// @param pstate Parser state. /// @param[in] flags Additional flags, see ExprParserFlags -- cgit From cf8b2c0e74fd5e723b0c15c2ce84e6900fd322d3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 12:05:28 +0800 Subject: build(iwyu): add a few more _defs.h mappings (#25435) --- src/nvim/viml/parser/expressions.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index b53508bc6c..0ab58a8b37 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -61,7 +61,6 @@ #include "nvim/ascii.h" #include "nvim/assert.h" #include "nvim/charset.h" -#include "nvim/eval/typval.h" #include "nvim/gettext.h" #include "nvim/keycodes.h" #include "nvim/macros.h" @@ -938,7 +937,6 @@ static const char *intchar2str(const int ch) } #ifdef UNIT_TESTING -# include REAL_FATTR_UNUSED static inline void viml_pexpr_debug_print_ast_node(const ExprASTNode *const *const eastnode_p, -- cgit From 353a4be7e84fdc101318215bdcc8a7e780d737fe Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 13:13:58 +0100 Subject: build: remove PVS We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable. --- src/nvim/viml/parser/expressions.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 0ab58a8b37..784d5c1210 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -1,6 +1,3 @@ -// 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 - /// Vimscript expression parser // Planned incompatibilities (to be included into vim_diff.txt when this parser -- cgit From a6e3d93421ba13c407a96fac9cc01fa41ec7ad98 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 16 Nov 2023 10:59:11 +0100 Subject: refactor: enable formatting for ternaries This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators. --- src/nvim/viml/parser/expressions.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 784d5c1210..d4e850eaa6 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -1268,8 +1268,8 @@ static bool viml_pexpr_handle_bop(const ParserState *const pstate, ExprASTStack const ExprOpAssociativity bop_node_ass = ( (bop_node->type == kExprNodeCall || bop_node->type == kExprNodeSubscript) - ? kEOpAssLeft - : node_ass(*bop_node)); + ? kEOpAssLeft + : node_ass(*bop_node)); #endif do { ExprASTNode **new_top_node_p = kv_last(*ast_stack); @@ -2202,8 +2202,8 @@ viml_pexpr_parse_process_token: cur_node->data.opt.ident_len = 0; cur_node->data.opt.scope = ( cur_token.len == 3 - ? (ExprOptScope)pline.data[cur_token.start.col + 1] - : kExprOptScopeUnspecified); + ? (ExprOptScope)pline.data[cur_token.start.col + 1] + : kExprOptScopeUnspecified); } else { cur_node->data.opt.ident = cur_token.data.opt.name; cur_node->data.opt.ident_len = cur_token.data.opt.len; -- cgit From 8b428ca8b79ebb7b36c3e403ff3bcb6924a635a6 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 16:00:21 +0100 Subject: build(IWYU): fix includes for func_attr.h --- src/nvim/viml/parser/expressions.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index d4e850eaa6..82e01f7d9c 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -58,6 +58,7 @@ #include "nvim/ascii.h" #include "nvim/assert.h" #include "nvim/charset.h" +#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/keycodes.h" #include "nvim/macros.h" -- cgit From 6c14ae6bfaf51415b555e9a6b85d1d280976358d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:27:32 +0100 Subject: refactor: rename types.h to types_defs.h --- src/nvim/viml/parser/expressions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 82e01f7d9c..804f78b2b7 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -64,7 +64,7 @@ #include "nvim/macros.h" #include "nvim/mbyte.h" #include "nvim/memory.h" -#include "nvim/types.h" +#include "nvim/types_defs.h" #include "nvim/vim.h" #include "nvim/viml/parser/expressions.h" #include "nvim/viml/parser/parser.h" -- cgit From 79b6ff28ad1204fbb4199b9092f5c578d88cb28e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 Nov 2023 20:31:00 +0100 Subject: refactor: fix headers with IWYU --- src/nvim/viml/parser/expressions.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 804f78b2b7..914f9ef445 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -55,17 +55,17 @@ #include #include "klib/kvec.h" -#include "nvim/ascii.h" -#include "nvim/assert.h" +#include "nvim/ascii_defs.h" +#include "nvim/assert_defs.h" #include "nvim/charset.h" #include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/keycodes.h" -#include "nvim/macros.h" +#include "nvim/macros_defs.h" #include "nvim/mbyte.h" #include "nvim/memory.h" #include "nvim/types_defs.h" -#include "nvim/vim.h" +#include "nvim/vim_defs.h" #include "nvim/viml/parser/expressions.h" #include "nvim/viml/parser/parser.h" -- cgit From a6cba103cebce535279db197f9efeb34e9d1171f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 29 Nov 2023 20:32:40 +0800 Subject: refactor: move some constants out of vim_defs.h (#26298) --- src/nvim/viml/parser/expressions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/viml/parser/expressions.c') diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 914f9ef445..8b637fbb9b 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -58,6 +58,7 @@ #include "nvim/ascii_defs.h" #include "nvim/assert_defs.h" #include "nvim/charset.h" +#include "nvim/eval.h" #include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/keycodes.h" @@ -65,7 +66,6 @@ #include "nvim/mbyte.h" #include "nvim/memory.h" #include "nvim/types_defs.h" -#include "nvim/vim_defs.h" #include "nvim/viml/parser/expressions.h" #include "nvim/viml/parser/parser.h" -- cgit