aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua.stx19
1 files changed, 11 insertions, 8 deletions
diff --git a/lua.stx b/lua.stx
index 0b794fee..eb7748d2 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2/* 2/*
3** $Id: lua.stx,v 1.20 1997/12/02 12:43:54 roberto Exp roberto $ 3** $Id: lua.stx,v 1.21 1997/12/09 13:35:19 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*/
@@ -26,8 +26,7 @@
26int luaY_parse (void); 26int luaY_parse (void);
27 27
28 28
29#define AMES_LIM(x) #x 29#define MES_LIM(x) "(limit=" x ")"
30#define MES_LIM(x) "(limit=" AMES_LIM(x) ")"
31 30
32 31
33/* size of a "normal" jump instruction: OpCode + 1 byte */ 32/* size of a "normal" jump instruction: OpCode + 1 byte */
@@ -35,17 +34,21 @@ int luaY_parse (void);
35 34
36/* maximum number of local variables */ 35/* maximum number of local variables */
37#define MAXLOCALS 32 36#define MAXLOCALS 32
37#define SMAXLOCALS "32"
38 38
39#define MINGLOBAL (MAXLOCALS+1) 39#define MINGLOBAL (MAXLOCALS+1)
40 40
41/* maximum number of variables in a multiple assignment */ 41/* maximum number of variables in a multiple assignment */
42#define MAXVAR 32 42#define MAXVAR 32
43#define SMAXVAR "32"
43 44
44/* maximum number of nested functions */ 45/* maximum number of nested functions */
45#define MAXSTATES 6 46#define MAXSTATES 6
47#define SMAXSTATES "6"
46 48
47/* maximum number of upvalues */ 49/* maximum number of upvalues */
48#define MAXUPVALUES 16 50#define MAXUPVALUES 16
51#define SMAXUPVALUES "16"
49 52
50 53
51 54
@@ -162,7 +165,7 @@ static int code_oparg_at (int pc, OpCode op, int builtin, int arg, int delta)
162 L->currState->f->code[pc+2] = arg>>8; 165 L->currState->f->code[pc+2] = arg>>8;
163 return 3; 166 return 3;
164 } 167 }
165 else luaY_error("code too long " MES_LIM(64K)); 168 else luaY_error("code too long " MES_LIM("64K"));
166 return 0; /* to avoid warnings */ 169 return 0; /* to avoid warnings */
167} 170}
168 171
@@ -320,7 +323,7 @@ static void store_localvar (TaggedString *name, int n)
320 if (L->currState->nlocalvar+n < MAXLOCALS) 323 if (L->currState->nlocalvar+n < MAXLOCALS)
321 L->currState->localvar[L->currState->nlocalvar+n] = name; 324 L->currState->localvar[L->currState->nlocalvar+n] = name;
322 else 325 else
323 luaY_error("too many local variables " MES_LIM(MAXLOCALS)); 326 luaY_error("too many local variables " MES_LIM(SMAXLOCALS));
324 luaI_registerlocalvar(name, L->lexstate->linenumber); 327 luaI_registerlocalvar(name, L->lexstate->linenumber);
325} 328}
326 329
@@ -347,7 +350,7 @@ static vardesc var2store (vardesc var)
347static void add_varbuffer (vardesc var, int n) 350static void add_varbuffer (vardesc var, int n)
348{ 351{
349 if (n >= MAXVAR) 352 if (n >= MAXVAR)
350 luaY_error("variable buffer overflow " MES_LIM(MAXVAR)); 353 luaY_error("variable buffer overflow " MES_LIM(SMAXVAR));
351 L->currState->varbuffer[n] = var2store(var); 354 L->currState->varbuffer[n] = var2store(var);
352} 355}
353 356
@@ -385,7 +388,7 @@ static int indexupvalue (TaggedString *n)
385 } 388 }
386 /* new one */ 389 /* new one */
387 if (++(L->currState->nupvalues) > MAXUPVALUES) 390 if (++(L->currState->nupvalues) > MAXUPVALUES)
388 luaY_error("too many upvalues in a single function " MES_LIM(MAXUPVALUES)); 391 luaY_error("too many upvalues in a single function " MES_LIM(SMAXUPVALUES));
389 L->currState->upvalues[i] = v; /* i = L->currState->nupvalues - 1 */ 392 L->currState->upvalues[i] = v; /* i = L->currState->nupvalues - 1 */
390 return i; 393 return i;
391} 394}
@@ -586,7 +589,7 @@ static void init_state (TaggedString *filename)
586static void init_func (void) 589static void init_func (void)
587{ 590{
588 if (L->currState-L->mainState >= MAXSTATES-1) 591 if (L->currState-L->mainState >= MAXSTATES-1)
589 luaY_error("too many nested functions " MES_LIM(MAXSTATES)); 592 luaY_error("too many nested functions " MES_LIM(SMAXSTATES));
590 L->currState++; 593 L->currState++;
591 init_state(L->mainState->f->fileName); 594 init_state(L->mainState->f->fileName);
592 luaY_codedebugline(L->lexstate->linenumber); 595 luaY_codedebugline(L->lexstate->linenumber);