MCPcopy Create free account
hub / github.com/Tencent/sluaunreal / subexpr

Function subexpr

Plugins/slua_unreal/External/lua/lparser.cpp:1046–1073  ·  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

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