aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-08-16 17:52:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-08-16 17:52:00 -0300
commitc787dccd9b5c3e55547a2c4bb598c0276de65034 (patch)
treec4cdf2f7319fee48e048472a2044119f541e8da2 /lparser.c
parentb44e35b773bcaa9891d80a117392911ab5f656e5 (diff)
downloadlua-c787dccd9b5c3e55547a2c4bb598c0276de65034.tar.gz
lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.tar.bz2
lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.zip
"const" !!!
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/lparser.c b/lparser.c
index 37f1c854..0ba30b5e 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 1.37 1999/06/17 17:04:03 roberto Exp roberto $ 2** $Id: lparser.c,v 1.38 1999/07/22 19:29:42 roberto Exp roberto $
3** LL(1) Parser and code generator for Lua 3** LL(1) Parser and code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -142,7 +142,7 @@ static void var_or_func_tail (LexState *ls, vardesc *v);
142 142
143 143
144 144
145static void checklimit (LexState *ls, int val, int limit, char *msg) { 145static void checklimit (LexState *ls, int val, int limit, const char *msg) {
146 if (val > limit) { 146 if (val > limit) {
147 char buff[100]; 147 char buff[100];
148 sprintf(buff, "too many %.50s (limit=%d)", msg, limit); 148 sprintf(buff, "too many %.50s (limit=%d)", msg, limit);
@@ -498,7 +498,7 @@ static void lua_pushvar (LexState *ls, vardesc *var) {
498} 498}
499 499
500 500
501static void storevar (LexState *ls, vardesc *var) { 501static void storevar (LexState *ls, const vardesc *var) {
502 switch (var->k) { 502 switch (var->k) {
503 case VLOCAL: 503 case VLOCAL:
504 code_oparg(ls, SETLOCAL, var->info, -1); 504 code_oparg(ls, SETLOCAL, var->info, -1);
@@ -597,12 +597,13 @@ static void close_func (LexState *ls) {
597 597
598 598
599 599
600static int expfollow [] = {ELSE, ELSEIF, THEN, IF, WHILE, REPEAT, DO, NAME, 600static const int expfollow [] = {ELSE, ELSEIF, THEN, IF, WHILE, REPEAT,
601 LOCAL, FUNCTION, END, UNTIL, RETURN, ')', ']', '}', ';', EOS, ',', 0}; 601 DO, NAME, LOCAL, FUNCTION, END, UNTIL, RETURN, ')', ']', '}', ';',
602 EOS, ',', 0};
602 603
603 604
604static int is_in (int tok, int *toks) { 605static int is_in (int tok, const int *toks) {
605 int *t; 606 const int *t;
606 for (t=toks; *t; t++) 607 for (t=toks; *t; t++)
607 if (*t == tok) return t-toks; 608 if (*t == tok) return t-toks;
608 return -1; 609 return -1;
@@ -923,13 +924,13 @@ static void ret (LexState *ls) {
923*/ 924*/
924#define POW 13 925#define POW 13
925 926
926static int binop [] = {EQ, NE, '>', '<', LE, GE, CONC, 927static const int binop [] = {EQ, NE, '>', '<', LE, GE, CONC,
927 '+', '-', '*', '/', '^', 0}; 928 '+', '-', '*', '/', '^', 0};
928 929
929static int priority [POW+1] = {5, 5, 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, 4, 6}; 930static const int priority [POW+1] = {5, 5, 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, 4, 6};
930 931
931static OpCode opcodes [POW+1] = {NOTOP, MINUSOP, EQOP, NEQOP, GTOP, LTOP, 932static const OpCode opcodes [POW+1] = {NOTOP, MINUSOP, EQOP, NEQOP, GTOP,
932 LEOP, GEOP, CONCOP, ADDOP, SUBOP, MULTOP, DIVOP, POWOP}; 933 LTOP, LEOP, GEOP, CONCOP, ADDOP, SUBOP, MULTOP, DIVOP, POWOP};
933 934
934#define MAXOPS 20 /* op's stack size (arbitrary limit) */ 935#define MAXOPS 20 /* op's stack size (arbitrary limit) */
935 936