MCPcopy Create free account
hub / github.com/F-Stack/f-stack / subexpr

Function subexpr

app/redis-6.2.6/deps/lua/src/lparser.c:832–857  ·  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

830** where `binop' is any binary operator with a priority higher than `limit'
831*/
832static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) {
833 BinOpr op;
834 UnOpr uop;
835 enterlevel(ls);
836 uop = getunopr(ls->t.token);
837 if (uop != OPR_NOUNOPR) {
838 luaX_next(ls);
839 subexpr(ls, v, UNARY_PRIORITY);
840 luaK_prefix(ls->fs, uop, v);
841 }
842 else simpleexp(ls, v);
843 /* expand while operators have priorities higher than `limit' */
844 op = getbinopr(ls->t.token);
845 while (op != OPR_NOBINOPR && priority[op].left > limit) {
846 expdesc v2;
847 BinOpr nextop;
848 luaX_next(ls);
849 luaK_infix(ls->fs, op, v);
850 /* read sub-expression with higher priority */
851 nextop = subexpr(ls, &v2, priority[op].right);
852 luaK_posfix(ls->fs, op, v, &v2);
853 op = nextop;
854 }
855 leavelevel(ls);
856 return op; /* return first untreated operator */
857}
858
859
860static 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