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

Function simpleexp

third-party/lua-5.5.0/src/lparser.c:1254–1306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1252
1253
1254static void simpleexp (LexState *ls, expdesc *v) {
1255 /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... |
1256 constructor | FUNCTION body | suffixedexp */
1257 switch (ls->t.token) {
1258 case TK_FLT: {
1259 init_exp(v, VKFLT, 0);
1260 v->u.nval = ls->t.seminfo.r;
1261 break;
1262 }
1263 case TK_INT: {
1264 init_exp(v, VKINT, 0);
1265 v->u.ival = ls->t.seminfo.i;
1266 break;
1267 }
1268 case TK_STRING: {
1269 codestring(v, ls->t.seminfo.ts);
1270 break;
1271 }
1272 case TK_NIL: {
1273 init_exp(v, VNIL, 0);
1274 break;
1275 }
1276 case TK_TRUE: {
1277 init_exp(v, VTRUE, 0);
1278 break;
1279 }
1280 case TK_FALSE: {
1281 init_exp(v, VFALSE, 0);
1282 break;
1283 }
1284 case TK_DOTS: { /* vararg */
1285 FuncState *fs = ls->fs;
1286 check_condition(ls, isvararg(fs->f),
1287 "cannot use '...' outside a vararg function");
1288 init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, fs->f->numparams, 1));
1289 break;
1290 }
1291 case '{' /*}*/: { /* constructor */
1292 constructor(ls, v);
1293 return;
1294 }
1295 case TK_FUNCTION: {
1296 luaX_next(ls);
1297 body(ls, v, 0, ls->linenumber);
1298 return;
1299 }
1300 default: {
1301 suffixedexp(ls, v);
1302 return;
1303 }
1304 }
1305 luaX_next(ls);
1306}
1307
1308
1309static 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