static void ICACHE_FLASH_ATTR check_match (LexState *ls, int what, int who, int where) { if (!testnext(ls, what)) { if (where == ls->linenumber) error_expected(ls, what); else { luaX_syntaxerror(ls, luaO_pushfstring(ls->L, LUA_QS " expected (to close " LUA_QS " at line %d)", luaX_token2str(ls, what), luaX_token2str(ls, who), where)); } } }
static void check_match (LexState *ls, int what, int who, int where) { if (!testnext(ls, what)) { if (where == ls->linenumber) error_expected(ls, what); else { luaX_syntaxerror(ls, luaO_pushfstring(ls->L, "%s expected (to close %s at line %d)", luaX_token2str(ls, what), luaX_token2str(ls, who), where)); } } }
/*static*/ void LexState::check_match (/*LexState *ls,*/ int what, int who, int where) { if (!testnext(what)) { if (where == linenumber) error_expected(what); else { luaX_syntaxerror( luaO_pushfstring(L, "%s expected (to close %s at line %d)", luaX_token2str(what), luaX_token2str(who), where)); } } }
static void check_match (LexState *ls, int what, int who, int where) { if (ls->t.token != what) { if (where == ls->linenumber) error_expected(ls, what); else { char buff[100]; char t_what[TOKEN_LEN], t_who[TOKEN_LEN]; luaX_token2str(what, t_what); luaX_token2str(who, t_who); sprintf(buff, "`%.20s' expected (to close `%.20s' at line %d)", t_what, t_who, where); luaK_error(ls, buff); } } next(ls); }
void luaX_error (LexState *ls, const char *s, int token) { char buff[TOKEN_LEN]; luaX_token2str(token, buff); if (buff[0] == '\0') luaX_syntaxerror(ls, s, ls->L->Mbuffer); else luaX_syntaxerror(ls, s, buff); }
static const char *txtToken (LexState *ls, int token) { switch (token) { case TK_NAME: case TK_STRING: case TK_FLT: case TK_INT: save(ls, '\0'); return luaO_pushfstring(ls->L, "'%s'", luaZ_buffer(ls->buff)); default: return luaX_token2str(ls, token); } }
void luaX_syntaxerror (LexState *ls, const char *msg) { const char *lasttoken; switch (ls->t.token) { case TK_NAME: lasttoken = getstr(ls->t.seminfo.ts); break; case TK_STRING: case TK_NUMBER: lasttoken = luaZ_buffer(ls->buff); break; default: lasttoken = luaX_token2str(ls, ls->t.token); break; } luaX_error(ls, msg, lasttoken); }
static l_noret error_expected (LexState *ls, int token) { luaX_syntaxerror(ls, luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token))); }
static void error_expected (LexState *ls, int token) { luaX_syntaxerror(ls, luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); }
static void luaX_lexerror (LexState *ls, const char *s, int token) { if (token == TK_EOS) luaX_error(ls, s, luaX_token2str(ls, token)); else luaX_error(ls, s, luaZ_buffer(ls->buff)); }
static void error_expected (LexState *ls, int token) { char buff[100], t[TOKEN_LEN]; luaX_token2str(token, t); sprintf(buff, "`%.20s' expected", t); luaK_error(ls, buff); }
/*static*/ l_noret LexState::error_expected (/*LexState *ls,*/ int token) { luaX_syntaxerror( luaO_pushfstring(L, "%s expected", luaX_token2str(token))); }