MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / subexpr

Function subexpr

lua/lparser.c:874–899  ·  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

872** where `binop' is any binary operator with a priority higher than `limit'
873*/
874static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) {
875 BinOpr op;
876 UnOpr uop;
877 enterlevel(ls);
878 uop = getunopr(ls->t.token);
879 if (uop != OPR_NOUNOPR) {
880 luaX_next(ls);
881 subexpr(ls, v, UNARY_PRIORITY);
882 luaK_prefix(ls->fs, uop, v);
883 }
884 else simpleexp(ls, v);
885 /* expand while operators have priorities higher than `limit' */
886 op = getbinopr(ls->t.token);
887 while (op != OPR_NOBINOPR && priority[op].left > limit) {
888 expdesc v2;
889 BinOpr nextop;
890 luaX_next(ls);
891 luaK_infix(ls->fs, op, v);
892 /* read sub-expression with higher priority */
893 nextop = subexpr(ls, &v2, priority[op].right);
894 luaK_posfix(ls->fs, op, v, &v2);
895 op = nextop;
896 }
897 leavelevel(ls);
898 return op; /* return first untreated operator */
899}
900
901
902static 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