diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-10-28 15:26:53 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-10-28 15:26:53 -0200 |
commit | 9c965d0ffb8fd930a149d6c20266e32c30ba8a0c (patch) | |
tree | 3a0cbb68ab52f8ef6211de9a358aaf6785a69ae0 | |
parent | 6103dca8ee311299bd438acf7fe74774821b8f07 (diff) | |
download | lua-9c965d0ffb8fd930a149d6c20266e32c30ba8a0c.tar.gz lua-9c965d0ffb8fd930a149d6c20266e32c30ba8a0c.tar.bz2 lua-9c965d0ffb8fd930a149d6c20266e32c30ba8a0c.zip |
more precise error messages for compiler limits.
-rw-r--r-- | lua.stx | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,6 +1,6 @@ | |||
1 | %{ | 1 | %{ |
2 | /* | 2 | /* |
3 | ** $Id: lua.stx,v 1.13 1997/10/24 17:17:24 roberto Exp roberto $ | 3 | ** $Id: lua.stx,v 1.14 1997/10/24 18:40:29 roberto Exp roberto $ |
4 | ** Syntax analizer and code generator | 4 | ** Syntax analizer and code generator |
5 | ** See Copyright Notice in lua.h | 5 | ** See Copyright Notice in lua.h |
6 | */ | 6 | */ |
@@ -131,7 +131,7 @@ static void deltastack (int delta) | |||
131 | currState->stacksize += delta; | 131 | currState->stacksize += delta; |
132 | if (currState->stacksize > currState->maxstacksize) { | 132 | if (currState->stacksize > currState->maxstacksize) { |
133 | if (currState->stacksize > 255) | 133 | if (currState->stacksize > 255) |
134 | luaY_error("expression too complex"); | 134 | luaY_error("function/expression too complex (limit 256)"); |
135 | currState->maxstacksize = currState->stacksize; | 135 | currState->maxstacksize = currState->stacksize; |
136 | } | 136 | } |
137 | } | 137 | } |
@@ -155,7 +155,7 @@ static int code_oparg_at (int pc, OpCode op, int builtin, int arg, int delta) | |||
155 | currState->f->code[pc+2] = arg>>8; | 155 | currState->f->code[pc+2] = arg>>8; |
156 | return 3; | 156 | return 3; |
157 | } | 157 | } |
158 | else luaY_error("construction too big - unable to compile"); | 158 | else luaY_error("code too long (limit 64K)"); |
159 | return 0; /* to avoid warnings */ | 159 | return 0; /* to avoid warnings */ |
160 | } | 160 | } |
161 | 161 | ||
@@ -313,7 +313,7 @@ static void store_localvar (TaggedString *name, int n) | |||
313 | if (currState->nlocalvar+n < MAXLOCALS) | 313 | if (currState->nlocalvar+n < MAXLOCALS) |
314 | currState->localvar[currState->nlocalvar+n] = name; | 314 | currState->localvar[currState->nlocalvar+n] = name; |
315 | else | 315 | else |
316 | luaY_error("too many local variables"); | 316 | luaY_error("too many local variables (limit 32)"); |
317 | luaI_registerlocalvar(name, luaX_linenumber); | 317 | luaI_registerlocalvar(name, luaX_linenumber); |
318 | } | 318 | } |
319 | 319 | ||
@@ -340,7 +340,7 @@ static vardesc var2store (vardesc var) | |||
340 | static void add_varbuffer (vardesc var, int n) | 340 | static void add_varbuffer (vardesc var, int n) |
341 | { | 341 | { |
342 | if (n >= MAXVAR) | 342 | if (n >= MAXVAR) |
343 | luaY_error("variable buffer overflow"); | 343 | luaY_error("variable buffer overflow (limit 32)"); |
344 | currState->varbuffer[n] = var2store(var); | 344 | currState->varbuffer[n] = var2store(var); |
345 | } | 345 | } |
346 | 346 | ||
@@ -378,7 +378,7 @@ static int indexupvalue (TaggedString *n) | |||
378 | } | 378 | } |
379 | /* new one */ | 379 | /* new one */ |
380 | if (++(currState->nupvalues) > MAXUPVALUES) | 380 | if (++(currState->nupvalues) > MAXUPVALUES) |
381 | luaY_error("too many upvalues in a single function"); | 381 | luaY_error("too many upvalues in a single function (limit 16)"); |
382 | currState->upvalues[i] = v; /* i = currState->nupvalues - 1 */ | 382 | currState->upvalues[i] = v; /* i = currState->nupvalues - 1 */ |
383 | return i; | 383 | return i; |
384 | } | 384 | } |
@@ -579,7 +579,7 @@ static void init_state (TaggedString *filename) | |||
579 | static void init_func (void) | 579 | static void init_func (void) |
580 | { | 580 | { |
581 | if (currState-mainState >= MAXSTATES-1) | 581 | if (currState-mainState >= MAXSTATES-1) |
582 | luaY_error("too many nested functions"); | 582 | luaY_error("too many nested functions (limit 6)"); |
583 | currState++; | 583 | currState++; |
584 | init_state(mainState->f->fileName); | 584 | init_state(mainState->f->fileName); |
585 | luaY_codedebugline(luaX_linenumber); | 585 | luaY_codedebugline(luaX_linenumber); |