MCPcopy Create free account
hub / github.com/F-Stack/f-stack / simpleexp

Function simpleexp

freebsd/contrib/openzfs/module/lua/lparser.c:941–988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939
940
941static void simpleexp (LexState *ls, expdesc *v) {
942 /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... |
943 constructor | FUNCTION body | suffixedexp */
944 switch (ls->t.token) {
945 case TK_NUMBER: {
946 init_exp(v, VKNUM, 0);
947 v->u.nval = ls->t.seminfo.r;
948 break;
949 }
950 case TK_STRING: {
951 codestring(ls, v, ls->t.seminfo.ts);
952 break;
953 }
954 case TK_NIL: {
955 init_exp(v, VNIL, 0);
956 break;
957 }
958 case TK_TRUE: {
959 init_exp(v, VTRUE, 0);
960 break;
961 }
962 case TK_FALSE: {
963 init_exp(v, VFALSE, 0);
964 break;
965 }
966 case TK_DOTS: { /* vararg */
967 FuncState *fs = ls->fs;
968 check_condition(ls, fs->f->is_vararg,
969 "cannot use " LUA_QL("...") " outside a vararg function");
970 init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));
971 break;
972 }
973 case '{': { /* constructor */
974 constructor(ls, v);
975 return;
976 }
977 case TK_FUNCTION: {
978 luaX_next(ls);
979 body(ls, v, 0, ls->linenumber);
980 return;
981 }
982 default: {
983 suffixedexp(ls, v);
984 return;
985 }
986 }
987 luaX_next(ls);
988}
989
990
991static UnOpr getunopr (int op) {

Callers 1

subexprFunction · 0.70

Calls 7

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

Tested by

no test coverage detected