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

Function simpleexp

app/redis-6.2.6/deps/lua/src/lparser.c:731–779  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729
730
731static void simpleexp (LexState *ls, expdesc *v) {
732 /* simpleexp -> NUMBER | STRING | NIL | true | false | ... |
733 constructor | FUNCTION body | primaryexp */
734 switch (ls->t.token) {
735 case TK_NUMBER: {
736 init_exp(v, VKNUM, 0);
737 v->u.nval = ls->t.seminfo.r;
738 break;
739 }
740 case TK_STRING: {
741 codestring(ls, v, ls->t.seminfo.ts);
742 break;
743 }
744 case TK_NIL: {
745 init_exp(v, VNIL, 0);
746 break;
747 }
748 case TK_TRUE: {
749 init_exp(v, VTRUE, 0);
750 break;
751 }
752 case TK_FALSE: {
753 init_exp(v, VFALSE, 0);
754 break;
755 }
756 case TK_DOTS: { /* vararg */
757 FuncState *fs = ls->fs;
758 check_condition(ls, fs->f->is_vararg,
759 "cannot use " LUA_QL("...") " outside a vararg function");
760 fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */
761 init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));
762 break;
763 }
764 case '{': { /* constructor */
765 constructor(ls, v);
766 return;
767 }
768 case TK_FUNCTION: {
769 luaX_next(ls);
770 body(ls, v, 0, ls->linenumber);
771 return;
772 }
773 default: {
774 primaryexp(ls, v);
775 return;
776 }
777 }
778 luaX_next(ls);
779}
780
781
782static UnOpr getunopr (int op) {

Callers 1

subexprFunction · 0.70

Calls 7

init_expFunction · 0.70
codestringFunction · 0.70
luaK_codeABCFunction · 0.70
constructorFunction · 0.70
luaX_nextFunction · 0.70
bodyFunction · 0.70
primaryexpFunction · 0.70

Tested by

no test coverage detected