X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser_def.h;h=bfba94bef3e514a6e3df0185650c4c9672ed5caf;hp=de5afe9c559e1253bbdd9a82237cba213bb279a2;hb=7df12c88a4e14611a2585d6e7c994c59e8d7485a;hpb=8c3b5c915ddf11e03e595d7db8917b2b4711a35b diff --git a/src/parser_def.h b/src/parser_def.h index de5afe9..bfba94b 100644 --- a/src/parser_def.h +++ b/src/parser_def.h @@ -80,16 +80,19 @@ DEF(%syntax_error, { }) DEF(%nonassoc, NAME.) +DEF(%left, LSHIFT RSHIFT.) DEF(%left, PLUS MINUS.) DEF(%left, ASTERISK SLASH.) DEF(%nonassoc, AMPERSAND.) +DEF(%nonassoc, CARET.) +DEF(%nonassoc, PIPE.) DEF(%fallback, NAME TEMP FREE SET LET RETURN CALLOC CALLBACK ZVAL LIB STRING COUNT.) DEF(%token_class, const_type_token BOOL INT FLOAT STRING.) DEF(%token_class, decl_type_token FLOAT DOUBLE INT8 UINT8 INT16 UINT16 INT32 UINT32 INT64 UINT64 NAME.) DEF(%token_class, impl_def_val_token NULL NUMBER TRUE FALSE QUOTED_STRING.) DEF(%token_class, num_exp_token NUMBER NSNAME.) -DEF(%token_class, num_exp_op_token PLUS MINUS ASTERISK SLASH.) +DEF(%token_class, num_exp_op_token LSHIFT RSHIFT PLUS MINUS ASTERISK SLASH AMPERSAND CARET PIPE.) DEF(%token_class, let_func_token ZVAL OBJVAL ARRVAL PATHVAL STRLEN STRVAL FLOATVAL INTVAL BOOLVAL COUNT.) DEF(%token_class, set_func_token TO_OBJECT TO_ARRAY TO_STRING TO_INT TO_FLOAT TO_BOOL ZVAL VOID.) DEF(%token_class, impl_type_token VOID MIXED BOOL INT FLOAT STRING ARRAY OBJECT CALLABLE.) @@ -1419,12 +1422,18 @@ PARSE_TYPED(num_exp, exp, * num_exp: num_exp num_exp_op_token num_exp */ PARSE_TYPED(num_exp, exp, - TYPED(num_exp, exp_) + TYPED(num_exp, exp1) NAMED(num_exp_op_token, operator_) - TYPED(num_exp, operand_)) { - exp_->op = operator_->type; - exp_->operand = operand_; - exp = exp_; + TYPED(num_exp, exp2)) { + exp = exp1; + do { + struct psi_num_exp *op = exp1; + while (op->operand) { + op = op->operand; + } + op->op = operator_->type; + op->operand = exp2; + } while(0); free(operator_); } @@ -1782,10 +1791,11 @@ PARSE_TYPED(return_stmt, ret, * free_stmt: FREE free_exps ; */ PARSE_TYPED(free_stmt, free, - TOKEN(FREE) + NAMED(FREE, T) TYPED(free_exps, calls) TOKEN(EOS)) { free = psi_free_stmt_init(calls); + free->token = T; } /*