Make priority array max size explicit.

we were implicitly depending on UMINUS being the last entry
in the operator table -- that's fragile.
This commit is contained in:
Ori Bernstein 2020-04-19 11:26:31 -07:00
parent 15a32f0683
commit 260d1eaaa7
2 changed files with 2 additions and 2 deletions

View file

@ -17,7 +17,7 @@ enum toktype { END, UNCLASS, NAME, NUMBER, STRING, CCON, NL, WS, DSHARP,
COLON, ASGN, COMMA, XCOMMA, SHARP, SEMIC, CBRA, CKET,
ASPLUS, ASMINUS, ASSTAR, ASSLASH, ASPCT, ASCIRC, ASLSH,
ASRSH, ASOR, ASAND, ELLIPS,
DSHARP1, NAME1, DEFINED, UMINUS };
DSHARP1, NAME1, DEFINED, UMINUS, MAXTOK};
enum kwtype { KIF, KIFDEF, KIFNDEF, KELIF, KELSE, KENDIF, KINCLUDE, KDEFINE,
KUNDEF, KLINE, KERROR, KWARNING, KPRAGMA, KDEFINED,

View file

@ -31,7 +31,7 @@ const struct pri {
char assoc;
char arity;
char ctype;
} priority[] = {
} priority[MAXTOK] = {
[END] { 0, 0, 0, 0 },
[EQ] { 11, 0, 2, RELAT },
[NEQ] { 11, 0, 2, RELAT },