aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-24 10:54:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-24 10:54:49 -0300
commitef62b340e0a6b7b18931000dcbb19c4703bfe0e8 (patch)
treed9d995116a8a686b798d1b625b06ead26f28ba58 /llex.c
parent5c2dd7a9e0a5b871a71ba66c4683cd88fe4f5aa4 (diff)
downloadlua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.tar.gz
lua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.tar.bz2
lua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.zip
code cleaner for 16 bits.
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/llex.c b/llex.c
index ae498715..00a248a9 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.57 2000/04/12 18:57:19 roberto Exp roberto $ 2** $Id: llex.c,v 1.58 2000/05/08 19:32:53 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -49,6 +49,16 @@ void luaX_init (lua_State *L) {
49 49
50#define MAXSRC 80 50#define MAXSRC 80
51 51
52
53void luaX_checklimit (LexState *ls, int val, int limit, const char *msg) {
54 if (val > limit) {
55 char buff[100];
56 sprintf(buff, "too many %.50s (limit=%d)", msg, limit);
57 luaX_error(ls, buff, ls->token);
58 }
59}
60
61
52void luaX_syntaxerror (LexState *ls, const char *s, const char *token) { 62void luaX_syntaxerror (LexState *ls, const char *s, const char *token) {
53 char buff[MAXSRC]; 63 char buff[MAXSRC];
54 luaL_chunkid(buff, zname(ls->z), sizeof(buff)); 64 luaL_chunkid(buff, zname(ls->z), sizeof(buff));
@@ -175,6 +185,7 @@ static void inclinenumber (lua_State *L, LexState *LS) {
175 {"debug", "nodebug", "endinput", "end", "ifnot", "if", "else", NULL}; 185 {"debug", "nodebug", "endinput", "end", "ifnot", "if", "else", NULL};
176 next(LS); /* skip '\n' */ 186 next(LS); /* skip '\n' */
177 ++LS->linenumber; 187 ++LS->linenumber;
188 luaX_checklimit(LS, LS->linenumber, MAX_INT, "lines in a chunk");
178 if (LS->current == '$') { /* is a pragma? */ 189 if (LS->current == '$') { /* is a pragma? */
179 char buff[PRAGMASIZE+1]; 190 char buff[PRAGMASIZE+1];
180 int ifnot = 0; 191 int ifnot = 0;