MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / subexpr

Function subexpr

third-party/lua-5.2.4/src/lparser.c:1037–1064  ·  view source on GitHub ↗

** subexpr -> (simpleexp | unop subexpr) { binop subexpr } ** where `binop' is any binary operator with a priority higher than `limit' */

Source from the content-addressed store, hash-verified

1035** where `binop' is any binary operator with a priority higher than `limit'
1036*/
1037static BinOpr subexpr (LexState *ls, expdesc *v, int limit) {
1038 BinOpr op;
1039 UnOpr uop;
1040 enterlevel(ls);
1041 uop = getunopr(ls->t.token);
1042 if (uop != OPR_NOUNOPR) {
1043 int line = ls->linenumber;
1044 luaX_next(ls);
1045 subexpr(ls, v, UNARY_PRIORITY);
1046 luaK_prefix(ls->fs, uop, v, line);
1047 }
1048 else simpleexp(ls, v);
1049 /* expand while operators have priorities higher than `limit' */
1050 op = getbinopr(ls->t.token);
1051 while (op != OPR_NOBINOPR && priority[op].left > limit) {
1052 expdesc v2;
1053 BinOpr nextop;
1054 int line = ls->linenumber;
1055 luaX_next(ls);
1056 luaK_infix(ls->fs, op, v);
1057 /* read sub-expression with higher priority */
1058 nextop = subexpr(ls, &v2, priority[op].right);
1059 luaK_posfix(ls->fs, op, v, &v2, line);
1060 op = nextop;
1061 }
1062 leavelevel(ls);
1063 return op; /* return first untreated operator */
1064}
1065
1066
1067static void expr (LexState *ls, expdesc *v) {

Callers 1

exprFunction · 0.70

Calls 8

enterlevelFunction · 0.70
getunoprFunction · 0.70
luaX_nextFunction · 0.70
luaK_prefixFunction · 0.70
simpleexpFunction · 0.70
getbinoprFunction · 0.70
luaK_infixFunction · 0.70
luaK_posfixFunction · 0.70

Tested by

no test coverage detected