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

Function simpleexp

third-party/lua-5.4.6/src/lparser.c:1139–1191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1137
1138
1139static void simpleexp (LexState *ls, expdesc *v) {
1140 /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... |
1141 constructor | FUNCTION body | suffixedexp */
1142 switch (ls->t.token) {
1143 case TK_FLT: {
1144 init_exp(v, VKFLT, 0);
1145 v->u.nval = ls->t.seminfo.r;
1146 break;
1147 }
1148 case TK_INT: {
1149 init_exp(v, VKINT, 0);
1150 v->u.ival = ls->t.seminfo.i;
1151 break;
1152 }
1153 case TK_STRING: {
1154 codestring(v, ls->t.seminfo.ts);
1155 break;
1156 }
1157 case TK_NIL: {
1158 init_exp(v, VNIL, 0);
1159 break;
1160 }
1161 case TK_TRUE: {
1162 init_exp(v, VTRUE, 0);
1163 break;
1164 }
1165 case TK_FALSE: {
1166 init_exp(v, VFALSE, 0);
1167 break;
1168 }
1169 case TK_DOTS: { /* vararg */
1170 FuncState *fs = ls->fs;
1171 check_condition(ls, fs->f->is_vararg,
1172 "cannot use '...' outside a vararg function");
1173 init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 0, 1));
1174 break;
1175 }
1176 case '{': { /* constructor */
1177 constructor(ls, v);
1178 return;
1179 }
1180 case TK_FUNCTION: {
1181 luaX_next(ls);
1182 body(ls, v, 0, ls->linenumber);
1183 return;
1184 }
1185 default: {
1186 suffixedexp(ls, v);
1187 return;
1188 }
1189 }
1190 luaX_next(ls);
1191}
1192
1193
1194static UnOpr getunopr (int op) {

Callers 1

subexprFunction · 0.70

Calls 7

init_expFunction · 0.70
codestringFunction · 0.70
constructorFunction · 0.70
luaX_nextFunction · 0.70
bodyFunction · 0.70
suffixedexpFunction · 0.70
luaK_codeABCFunction · 0.50

Tested by

no test coverage detected