MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / simpleexp

Function simpleexp

extlibs/lua/src/lparser.c:1121–1173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1119
1120
1121static void simpleexp (LexState *ls, expdesc *v) {
1122 /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... |
1123 constructor | FUNCTION body | suffixedexp */
1124 switch (ls->t.token) {
1125 case TK_FLT: {
1126 init_exp(v, VKFLT, 0);
1127 v->u.nval = ls->t.seminfo.r;
1128 break;
1129 }
1130 case TK_INT: {
1131 init_exp(v, VKINT, 0);
1132 v->u.ival = ls->t.seminfo.i;
1133 break;
1134 }
1135 case TK_STRING: {
1136 codestring(v, ls->t.seminfo.ts);
1137 break;
1138 }
1139 case TK_NIL: {
1140 init_exp(v, VNIL, 0);
1141 break;
1142 }
1143 case TK_TRUE: {
1144 init_exp(v, VTRUE, 0);
1145 break;
1146 }
1147 case TK_FALSE: {
1148 init_exp(v, VFALSE, 0);
1149 break;
1150 }
1151 case TK_DOTS: { /* vararg */
1152 FuncState *fs = ls->fs;
1153 check_condition(ls, fs->f->is_vararg,
1154 "cannot use '...' outside a vararg function");
1155 init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 0, 1));
1156 break;
1157 }
1158 case '{': { /* constructor */
1159 constructor(ls, v);
1160 return;
1161 }
1162 case TK_FUNCTION: {
1163 luaX_next(ls);
1164 body(ls, v, 0, ls->linenumber);
1165 return;
1166 }
1167 default: {
1168 suffixedexp(ls, v);
1169 return;
1170 }
1171 }
1172 luaX_next(ls);
1173}
1174
1175
1176static 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
bodyFunction · 0.85
suffixedexpFunction · 0.85

Tested by

no test coverage detected