Redesign of prototype generation, part 1: varinfo and uvname.

Use a growable, per-chunk variable stack.
Collect varinfo/uvname for prototype at the end.
This commit is contained in:
Mike Pall
2010-02-08 05:26:52 +01:00
parent 1307f49137
commit 60b5af4422
6 changed files with 109 additions and 96 deletions

View File

@@ -50,10 +50,14 @@ typedef struct LexState {
BCLine lastline; /* Line of last token. */
GCstr *chunkname; /* Current chunk name (interned string). */
const char *chunkarg; /* Chunk name argument. */
VarInfo *vstack; /* Stack for names and extents of local variables. */
MSize sizevstack; /* Size of variable stack. */
MSize vtop; /* Top of variable stack. */
uint32_t level; /* Syntactical nesting level. */
} LexState;
LJ_FUNC void lj_lex_start(lua_State *L, LexState *ls);
LJ_FUNC void lj_lex_setup(lua_State *L, LexState *ls);
LJ_FUNC void lj_lex_cleanup(lua_State *L, LexState *ls);
LJ_FUNC void lj_lex_next(LexState *ls);
LJ_FUNC LexToken lj_lex_lookahead(LexState *ls);
LJ_FUNC const char *lj_lex_token2str(LexState *ls, LexToken token);