Fix table underrun when looking up the character class of the EOF character,
-1.
This commit is contained in:
parent
b94199aba7
commit
003799f898
|
@ -47,7 +47,7 @@ struct hshtab hshtab[HSHSIZ];
|
||||||
int hshused;
|
int hshused;
|
||||||
int eof;
|
int eof;
|
||||||
int peekc;
|
int peekc;
|
||||||
char ctab[128];
|
const char* ctab;
|
||||||
struct hshtab *bsym;
|
struct hshtab *bsym;
|
||||||
struct hshtab *paraml, *parame;
|
struct hshtab *paraml, *parame;
|
||||||
int cval;
|
int cval;
|
||||||
|
|
|
@ -1287,7 +1287,8 @@ int opdope[] = {
|
||||||
000000 /* NAME */
|
000000 /* NAME */
|
||||||
};
|
};
|
||||||
|
|
||||||
char ctab[128] = {
|
const char ctaba[129] = {
|
||||||
|
EOFC, /* -1 */
|
||||||
EOFC, UNKN, UNKN, UNKN, UNKN, UNKN, UNKN, UNKN,
|
EOFC, UNKN, UNKN, UNKN, UNKN, UNKN, UNKN, UNKN,
|
||||||
LETTER, SPACE, NEWLN, SPACE, SPACE, UNKN, UNKN, UNKN,
|
LETTER, SPACE, NEWLN, SPACE, SPACE, UNKN, UNKN, UNKN,
|
||||||
UNKN, UNKN, UNKN, UNKN, UNKN, UNKN, UNKN, UNKN,
|
UNKN, UNKN, UNKN, UNKN, UNKN, UNKN, UNKN, UNKN,
|
||||||
|
@ -1305,6 +1306,7 @@ char ctab[128] = {
|
||||||
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
||||||
LETTER, LETTER, LETTER, LBRACE, OR, RBRACE, NOT, UNKN
|
LETTER, LETTER, LETTER, LBRACE, OR, RBRACE, NOT, UNKN
|
||||||
};
|
};
|
||||||
|
const char* ctab = &ctaba[1]; /* allows indexing with -1 */
|
||||||
|
|
||||||
/* debug function */
|
/* debug function */
|
||||||
void printtoken(int tok, FILE *out)
|
void printtoken(int tok, FILE *out)
|
||||||
|
|
Loading…
Reference in a new issue