** subexpr -> (simpleexp | unop subexpr) { binop subexpr } ** where `binop' is any binary operator with a priority higher than `limit' */
| 8402 | ** where `binop' is any binary operator with a priority higher than `limit' |
| 8403 | */ |
| 8404 | static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { |
| 8405 | BinOpr op; |
| 8406 | UnOpr uop; |
| 8407 | enterlevel(ls); |
| 8408 | uop = getunopr(ls->t.token); |
| 8409 | if (uop != OPR_NOUNOPR) { |
| 8410 | luaX_next(ls); |
| 8411 | subexpr(ls, v, UNARY_PRIORITY); |
| 8412 | luaK_prefix(ls->fs, uop, v); |
| 8413 | } |
| 8414 | else simpleexp(ls, v); |
| 8415 | /* expand while operators have priorities higher than `limit' */ |
| 8416 | op = getbinopr(ls->t.token); |
| 8417 | while (op != OPR_NOBINOPR && priority[op].left > limit) { |
| 8418 | expdesc v2; |
| 8419 | BinOpr nextop; |
| 8420 | luaX_next(ls); |
| 8421 | luaK_infix(ls->fs, op, v); |
| 8422 | /* read sub-expression with higher priority */ |
| 8423 | nextop = subexpr(ls, &v2, priority[op].right); |
| 8424 | luaK_posfix(ls->fs, op, v, &v2); |
| 8425 | op = nextop; |
| 8426 | } |
| 8427 | leavelevel(ls); |
| 8428 | return op; /* return first untreated operator */ |
| 8429 | } |
| 8430 | |
| 8431 | |
| 8432 | static void expr (LexState *ls, expdesc *v) { |
no test coverage detected