mirror of
https://github.com/lua/lua
synced 2024-11-22 12:51:30 +03:00
details
This commit is contained in:
parent
12dacd3c0e
commit
e1c2fb6eed
13
llex.c
13
llex.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: llex.c,v 2.5 2004/11/24 19:16:03 roberto Exp roberto $
|
||||
** $Id: llex.c,v 2.6 2004/12/01 15:46:18 roberto Exp roberto $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -32,13 +32,14 @@
|
||||
|
||||
|
||||
/* ORDER RESERVED */
|
||||
static const char *const token2string [] = {
|
||||
const char *const luaX_tokens [] = {
|
||||
"and", "break", "do", "else", "elseif",
|
||||
"end", "false", "for", "function", "if",
|
||||
"in", "local", "nil", "not", "or", "repeat",
|
||||
"return", "then", "true", "until", "while", "*name",
|
||||
"..", "...", "==", ">=", "<=", "~=",
|
||||
"*number", "*string", "<eof>"
|
||||
"*number", "*string", "<eof>",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@ -61,9 +62,9 @@ static void save (LexState *ls, int c) {
|
||||
void luaX_init (lua_State *L) {
|
||||
int i;
|
||||
for (i=0; i<NUM_RESERVED; i++) {
|
||||
TString *ts = luaS_new(L, token2string[i]);
|
||||
TString *ts = luaS_new(L, luaX_tokens[i]);
|
||||
luaS_fix(ts); /* reserved words are never collected */
|
||||
lua_assert(strlen(token2string[i])+1 <= TOKEN_LEN);
|
||||
lua_assert(strlen(luaX_tokens[i])+1 <= TOKEN_LEN);
|
||||
ts->tsv.reserved = cast(lu_byte, i+1); /* reserved word */
|
||||
}
|
||||
}
|
||||
@ -79,7 +80,7 @@ const char *luaX_token2str (LexState *ls, int token) {
|
||||
luaO_pushfstring(ls->L, "%c", token);
|
||||
}
|
||||
else
|
||||
return token2string[token-FIRST_RESERVED];
|
||||
return luaX_tokens[token-FIRST_RESERVED];
|
||||
}
|
||||
|
||||
|
||||
|
6
llex.h
6
llex.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: llex.h,v 1.49 2003/10/20 12:24:34 roberto Exp roberto $
|
||||
** $Id: llex.h,v 1.50 2004/03/12 19:53:56 roberto Exp roberto $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -36,6 +36,10 @@ enum RESERVED {
|
||||
#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
|
||||
|
||||
|
||||
/* array with token `names' */
|
||||
extern const char *const luaX_tokens [];
|
||||
|
||||
|
||||
typedef union {
|
||||
lua_Number r;
|
||||
TString *ts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lopcodes.c,v 1.28 2004/07/16 13:15:32 roberto Exp $
|
||||
** $Id: lopcodes.c,v 1.29 2004/10/04 19:01:53 roberto Exp roberto $
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
/* ORDER OP */
|
||||
|
||||
const char *const luaP_opnames[NUM_OPCODES] = {
|
||||
const char *const luaP_opnames[NUM_OPCODES+1] = {
|
||||
"MOVE",
|
||||
"LOADK",
|
||||
"LOADBOOL",
|
||||
@ -51,7 +51,8 @@ const char *const luaP_opnames[NUM_OPCODES] = {
|
||||
"SETLIST",
|
||||
"CLOSE",
|
||||
"CLOSURE",
|
||||
"VARARG"
|
||||
"VARARG",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lopcodes.h,v 1.112 2004/10/04 19:01:53 roberto Exp roberto $
|
||||
** $Id: lopcodes.h,v 1.113 2004/10/04 19:07:42 roberto Exp roberto $
|
||||
** Opcodes for Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -257,7 +257,7 @@ extern const lu_byte luaP_opmodes[NUM_OPCODES];
|
||||
#define testTMode(m) (luaP_opmodes[m] & (1 << 7))
|
||||
|
||||
|
||||
extern const char *const luaP_opnames[NUM_OPCODES]; /* opcode names */
|
||||
extern const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
|
||||
|
||||
|
||||
/* number of list items to accumulate before a SETLIST instruction */
|
||||
|
Loading…
Reference in New Issue
Block a user