MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / subexpr

Function subexpr

ThirdParty/lua/lua/lparser.c:1042–1069  ·  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

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

Callers 1

exprFunction · 0.85

Calls 8

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

Tested by

no test coverage detected