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

Function simpleexp

lua/lparser.c:766–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

764
765
766static void simpleexp (LexState *ls, expdesc *v) {
767 /* simpleexp -> NUMBER | STRING | NIL | true | false | ... |
768 constructor | FUNCTION body | primaryexp */
769 switch (ls->t.token) {
770 case TK_NUMBER: {
771 init_exp(v, VKNUM, 0);
772 v->u.nval = ls->t.seminfo.r;
773 break;
774 }
775 case TK_STRING: {
776 codestring(ls, v, ls->t.seminfo.ts);
777 break;
778 }
779 case TK_BLOB: {
780 codeblob(ls, v, ls->t.seminfo.ts);
781 break;
782 }
783 case TK_NIL: {
784 init_exp(v, VNIL, 0);
785 break;
786 }
787 case TK_TRUE: {
788 init_exp(v, VTRUE, 0);
789 break;
790 }
791 case TK_FALSE: {
792 init_exp(v, VFALSE, 0);
793 break;
794 }
795 case TK_DOTS: { /* vararg */
796 FuncState *fs = ls->fs;
797 check_condition(ls, fs->f->is_vararg,
798 "cannot use " LUA_QL("...") " outside a vararg function");
799 fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */
800 init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));
801 break;
802 }
803 case '{': { /* constructor */
804 constructor(ls, v);
805 return;
806 }
807 case TK_FUNCTION: {
808 luaX_next(ls);
809 body(ls, v, 0, ls->linenumber);
810 return;
811 }
812 default: {
813 primaryexp(ls, v);
814 return;
815 }
816 }
817 luaX_next(ls);
818}
819
820
821static UnOpr getunopr (int op) {

Callers 1

subexprFunction · 0.85

Calls 8

init_expFunction · 0.85
codestringFunction · 0.85
codeblobFunction · 0.85
luaK_codeABCFunction · 0.85
constructorFunction · 0.85
luaX_nextFunction · 0.85
bodyFunction · 0.85
primaryexpFunction · 0.85

Tested by

no test coverage detected