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

Function simpleexp

third-party/lua-5.3.5/src/lparser.c:931–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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