diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-19 22:57:13 +0000 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-19 22:57:13 +0000 |
| commit | 9be89f131f87608f224f0ee06d199fcd09d32176 (patch) | |
| tree | 11022dcfa9e08cb4ac5581b16734196128688d48 /src/nvim/viml | |
| parent | ff7ed8f586589d620a806c3758fac4a47a8e7e15 (diff) | |
| parent | 88085c2e80a7e3ac29aabb6b5420377eed99b8b6 (diff) | |
| download | rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.gz rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.bz2 rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.zip | |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'src/nvim/viml')
| -rw-r--r-- | src/nvim/viml/parser/expressions.c | 12 | ||||
| -rw-r--r-- | src/nvim/viml/parser/expressions.h | 2 | ||||
| -rw-r--r-- | src/nvim/viml/parser/parser.h | 22 |
3 files changed, 9 insertions, 27 deletions
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 3403fb7926..7fb4c62b35 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -1264,21 +1264,12 @@ static bool viml_pexpr_handle_bop(const ParserState *const pstate, ExprASTStack || bop_node->type == kExprNodeSubscript) ? kEOpLvlSubscript : node_lvl(*bop_node)); -#ifndef NDEBUG - const ExprOpAssociativity bop_node_ass = ( - (bop_node->type == kExprNodeCall - || bop_node->type == kExprNodeSubscript) - ? kEOpAssLeft - : node_ass(*bop_node)); -#endif do { ExprASTNode **new_top_node_p = kv_last(*ast_stack); ExprASTNode *new_top_node = *new_top_node_p; assert(new_top_node != NULL); const ExprOpLvl new_top_node_lvl = node_lvl(*new_top_node); const ExprOpAssociativity new_top_node_ass = node_ass(*new_top_node); - assert(bop_node_lvl != new_top_node_lvl - || bop_node_ass == new_top_node_ass); if (top_node_p != NULL && ((bop_node_lvl > new_top_node_lvl || (bop_node_lvl == new_top_node_lvl @@ -3014,8 +3005,7 @@ viml_pexpr_parse_end: break; case kExprNodeCurlyBracesIdentifier: // Until trailing "}" it is impossible to distinguish curly braces - // identifier and dictionary, so it must not appear in the stack like - // this. + // identifier and Dict, so it must not appear in the stack like this. abort(); case kExprNodeInteger: case kExprNodeFloat: diff --git a/src/nvim/viml/parser/expressions.h b/src/nvim/viml/parser/expressions.h index ba54c4de07..60c3db8c8f 100644 --- a/src/nvim/viml/parser/expressions.h +++ b/src/nvim/viml/parser/expressions.h @@ -216,7 +216,7 @@ typedef enum { /// kExprNodeCurlyBracesIdentifier. kExprNodeUnknownFigure, kExprNodeLambda, ///< Lambda. - kExprNodeDictLiteral, ///< Dictionary literal. + kExprNodeDictLiteral, ///< Dict literal. kExprNodeCurlyBracesIdentifier, ///< Part of the curly braces name. kExprNodeComma, ///< Comma “operator”. kExprNodeColon, ///< Colon “operator”. diff --git a/src/nvim/viml/parser/parser.h b/src/nvim/viml/parser/parser.h index 31decdc798..c4ebc1589a 100644 --- a/src/nvim/viml/parser/parser.h +++ b/src/nvim/viml/parser/parser.h @@ -5,13 +5,13 @@ #include <stddef.h> #include "klib/kvec.h" -#include "nvim/func_attr.h" #include "nvim/mbyte_defs.h" #include "nvim/viml/parser/parser_defs.h" // IWYU pragma: keep -static inline void viml_parser_init(ParserState *ret_pstate, ParserLineGetter get_line, - void *cookie, ParserHighlight *colors) - REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ARG(1, 2); +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "viml/parser/parser.h.generated.h" +# include "viml/parser/parser.h.inline.generated.h" +#endif /// Initialize a new parser state instance /// @@ -22,6 +22,7 @@ static inline void viml_parser_init(ParserState *ret_pstate, ParserLineGetter ge /// needed. static inline void viml_parser_init(ParserState *const ret_pstate, const ParserLineGetter get_line, void *const cookie, ParserHighlight *const colors) + FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ARG(1, 2) { *ret_pstate = (ParserState) { .reader = { @@ -37,9 +38,6 @@ static inline void viml_parser_init(ParserState *const ret_pstate, const ParserL kvi_init(ret_pstate->stack); } -static inline void viml_parser_advance(ParserState *pstate, size_t len) - REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ALL; - /// Advance position by a given number of bytes /// /// At maximum advances to the next line. @@ -47,6 +45,7 @@ static inline void viml_parser_advance(ParserState *pstate, size_t len) /// @param pstate Parser state to advance. /// @param[in] len Number of bytes to advance. static inline void viml_parser_advance(ParserState *const pstate, const size_t len) + FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL { assert(pstate->pos.line == kv_size(pstate->reader.lines) - 1); const ParserLine pline = kv_last(pstate->reader.lines); @@ -58,10 +57,6 @@ static inline void viml_parser_advance(ParserState *const pstate, const size_t l } } -static inline void viml_parser_highlight(ParserState *pstate, ParserPosition start, size_t len, - const char *group) - REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ALL; - /// Record highlighting of some region of text /// /// @param pstate Parser state to work with. @@ -70,6 +65,7 @@ static inline void viml_parser_highlight(ParserState *pstate, ParserPosition sta /// @param[in] group Highlight group. static inline void viml_parser_highlight(ParserState *const pstate, const ParserPosition start, const size_t len, const char *const group) + FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL { if (pstate->colors == NULL || len == 0) { return; @@ -83,7 +79,3 @@ static inline void viml_parser_highlight(ParserState *const pstate, const Parser .group = group, })); } - -#ifdef INCLUDE_GENERATED_DECLARATIONS -# include "viml/parser/parser.h.generated.h" -#endif |