MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / simpleexp

Function simpleexp

third-party/lua-5.2.4/src/lparser.c:937–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

935
936
937static void simpleexp (LexState *ls, expdesc *v) {
938 /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... |
939 constructor | FUNCTION body | suffixedexp */
940 switch (ls->t.token) {
941 case TK_NUMBER: {
942 init_exp(v, VKNUM, 0);
943 v->u.nval = ls->t.seminfo.r;
944 break;
945 }
946 case TK_STRING: {
947 codestring(ls, v, ls->t.seminfo.ts);
948 break;
949 }
950 case TK_NIL: {
951 init_exp(v, VNIL, 0);
952 break;
953 }
954 case TK_TRUE: {
955 init_exp(v, VTRUE, 0);
956 break;
957 }
958 case TK_FALSE: {
959 init_exp(v, VFALSE, 0);
960 break;
961 }
962 case TK_DOTS: { /* vararg */
963 FuncState *fs = ls->fs;
964 check_condition(ls, fs->f->is_vararg,
965 "cannot use " LUA_QL("...") " outside a vararg function");
966 init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));
967 break;
968 }
969 case '{': { /* constructor */
970 constructor(ls, v);
971 return;
972 }
973 case TK_FUNCTION: {
974 luaX_next(ls);
975 body(ls, v, 0, ls->linenumber);
976 return;
977 }
978 default: {
979 suffixedexp(ls, v);
980 return;
981 }
982 }
983 luaX_next(ls);
984}
985
986
987static 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
suffixedexpFunction · 0.70

Tested by

no test coverage detected