From 3735537a508c5690c4622ebe450e6f3f15706670 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 1 Oct 2017 15:54:46 +0300 Subject: viml/parser/expressions: Fix call inside nested parenthesis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It may have incorrectly tried to call everything because of essentially “value” nodes being treated as not such. --- src/nvim/viml/parser/expressions.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 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 fc64fee140..1713d0c89f 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -612,6 +612,7 @@ viml_pexpr_repr_token_end: #ifdef UNIT_TESTING #include + REAL_FATTR_UNUSED static inline void viml_pexpr_debug_print_ast_node( const ExprASTNode *const *const eastnode_p, @@ -626,6 +627,7 @@ static inline void viml_pexpr_debug_print_ast_node( (*eastnode_p)->start.col, (*eastnode_p)->len); } } + REAL_FATTR_UNUSED static inline void viml_pexpr_debug_print_ast_stack( const ExprASTStack *const ast_stack, @@ -640,6 +642,7 @@ static inline void viml_pexpr_debug_print_ast_stack( } } +REAL_FATTR_UNUSED static inline void viml_pexpr_debug_print_token( const ParserState *const pstate, const LexExprToken token) FUNC_ATTR_ALWAYS_INLINE @@ -794,6 +797,7 @@ static inline ExprASTNode *viml_pexpr_new_node(const ExprASTNodeType type) typedef enum { kEOpLvlInvalid = 0, + kEOpLvlComplexIdentifier, kEOpLvlParens, kEOpLvlArrow, kEOpLvlComma, @@ -806,7 +810,6 @@ typedef enum { kEOpLvlMultiplication, ///< Multiplication, division and modulo. kEOpLvlUnary, ///< Unary operations: not, minus, plus. kEOpLvlSubscript, ///< Subscripts. - kEOpLvlComplexIdentifier, ///< Plain identifier, curly braces name. kEOpLvlValue, ///< Values: literals, variables, nested expressions, … } ExprOpLvl; @@ -843,10 +846,10 @@ static const ExprOpLvl node_type_to_op_lvl[] = { [kExprNodeSubscript] = kEOpLvlSubscript, - [kExprNodeComplexIdentifier] = kEOpLvlComplexIdentifier, - [kExprNodePlainIdentifier] = kEOpLvlComplexIdentifier, [kExprNodeCurlyBracesIdentifier] = kEOpLvlComplexIdentifier, + [kExprNodeComplexIdentifier] = kEOpLvlValue, + [kExprNodePlainIdentifier] = kEOpLvlValue, [kExprNodeRegister] = kEOpLvlValue, [kExprNodeListLiteral] = kEOpLvlValue, }; @@ -884,10 +887,10 @@ static const ExprOpAssociativity node_type_to_op_ass[] = { [kExprNodeSubscript] = kEOpAssLeft, - [kExprNodePlainIdentifier] = kEOpAssLeft, - [kExprNodeComplexIdentifier] = kEOpAssLeft, [kExprNodeCurlyBracesIdentifier] = kEOpAssLeft, + [kExprNodeComplexIdentifier] = kEOpAssLeft, + [kExprNodePlainIdentifier] = kEOpAssNo, [kExprNodeRegister] = kEOpAssNo, [kExprNodeListLiteral] = kEOpAssNo, }; -- cgit