diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-08-16 17:52:00 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-08-16 17:52:00 -0300 |
commit | c787dccd9b5c3e55547a2c4bb598c0276de65034 (patch) | |
tree | c4cdf2f7319fee48e048472a2044119f541e8da2 /lparser.c | |
parent | b44e35b773bcaa9891d80a117392911ab5f656e5 (diff) | |
download | lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.tar.gz lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.tar.bz2 lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.zip |
"const" !!!
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -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 | ||
145 | static void checklimit (LexState *ls, int val, int limit, char *msg) { | 145 | static 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 | ||
501 | static void storevar (LexState *ls, vardesc *var) { | 501 | static 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 | ||
600 | static int expfollow [] = {ELSE, ELSEIF, THEN, IF, WHILE, REPEAT, DO, NAME, | 600 | static 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 | ||
604 | static int is_in (int tok, int *toks) { | 605 | static 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 | ||
926 | static int binop [] = {EQ, NE, '>', '<', LE, GE, CONC, | 927 | static const int binop [] = {EQ, NE, '>', '<', LE, GE, CONC, |
927 | '+', '-', '*', '/', '^', 0}; | 928 | '+', '-', '*', '/', '^', 0}; |
928 | 929 | ||
929 | static int priority [POW+1] = {5, 5, 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, 4, 6}; | 930 | static const int priority [POW+1] = {5, 5, 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, 4, 6}; |
930 | 931 | ||
931 | static OpCode opcodes [POW+1] = {NOTOP, MINUSOP, EQOP, NEQOP, GTOP, LTOP, | 932 | static 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 | ||