Add support for bytecode loading/saving.

This commit is contained in:
Mike Pall
2011-06-13 00:58:13 +02:00
parent 9da94d1355
commit 4994fcc32c
16 changed files with 1019 additions and 48 deletions

View File

@@ -408,7 +408,7 @@ static int llex(LexState *ls, TValue *tv)
/* -- Lexer API ----------------------------------------------------------- */
/* Setup lexer state. */
void lj_lex_setup(lua_State *L, LexState *ls)
int lj_lex_setup(lua_State *L, LexState *ls)
{
ls->L = L;
ls->fs = NULL;
@@ -433,14 +433,11 @@ void lj_lex_setup(lua_State *L, LexState *ls)
if (ls->current == '#') { /* Skip POSIX #! header line. */
do {
next(ls);
if (ls->current == END_OF_STREAM) return;
if (ls->current == END_OF_STREAM) return 0;
} while (!currIsNewline(ls));
inclinenumber(ls);
}
if (ls->current == LUA_SIGNATURE[0]) {
setstrV(L, L->top++, lj_err_str(L, LJ_ERR_XBCLOAD));
lj_err_throw(L, LUA_ERRSYNTAX);
}
return (ls->current == LUA_SIGNATURE[0]); /* Bytecode dump? */
}
/* Cleanup lexer state. */