MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / simpleexp

Function simpleexp

lib/lua/src/lparser.c:1140–1192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

subexprFunction · 0.85

Calls 6

init_expFunction · 0.85
codestringFunction · 0.85
constructorFunction · 0.85
luaX_nextFunction · 0.85
suffixedexpFunction · 0.85
bodyFunction · 0.70

Tested by

no test coverage detected