first implementation of centralized global state.

This commit is contained in:
Roberto Ierusalimschy
1997-11-19 15:29:23 -02:00
parent 9cdeb275e7
commit 592a3f289b
25 changed files with 782 additions and 829 deletions

32
llex.h
View File

@@ -1,5 +1,5 @@
/*
** $Id: llex.h,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $
** $Id: llex.h,v 1.2 1997/11/04 15:27:53 roberto Exp roberto $
** Lexical Analizer
** See Copyright Notice in lua.h
*/
@@ -11,11 +11,39 @@
#include "lzio.h"
#define MAX_IFS 5
/* "ifstate" keeps the state of each nested $if the lexical is dealing with. */
struct ifState {
int elsepart; /* true if its in the $else part */
int condition; /* true if $if condition is true */
int skip; /* true if part must be skiped */
};
struct textBuff {
char *text;
int tokensize;
int buffsize;
};
typedef struct LexState {
int current; /* look ahead character */
struct zio *lex_z;
int linenumber;
struct ifState ifstate[MAX_IFS];
int iflevel; /* level of nested $if's (for lexical analysis) */
struct textBuff textbuff;
int linelasttoken;
int lastline;
} LexState;
extern int luaX_linenumber;
void luaX_init (void);
int luaY_lex (void);
void luaX_setinput (ZIO *z);
char *luaX_lasttoken (void);