diff options
Diffstat (limited to 'contrib/byacc/lalr.c')
-rw-r--r-- | contrib/byacc/lalr.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/contrib/byacc/lalr.c b/contrib/byacc/lalr.c index bf7e6a8..8d19b1a 100644 --- a/contrib/byacc/lalr.c +++ b/contrib/byacc/lalr.c @@ -1,4 +1,4 @@ -/* $Id: lalr.c,v 1.11 2014/09/18 00:26:39 tom Exp $ */ +/* $Id: lalr.c,v 1.12 2016/06/07 00:28:03 tom Exp $ */ #include "defs.h" @@ -10,12 +10,12 @@ typedef struct shorts shorts; static Value_t map_goto(int state, int symbol); -static Value_t **transpose(Value_t ** R, int n); +static Value_t **transpose(Value_t **R, int n); static void add_lookback_edge(int stateno, int ruleno, int gotono); static void build_relations(void); static void compute_FOLLOWS(void); static void compute_lookaheads(void); -static void digraph(Value_t ** relation); +static void digraph(Value_t **relation); static void initialize_F(void); static void initialize_LA(void); static void set_accessing_symbol(void); @@ -147,12 +147,12 @@ initialize_LA(void) k = 0; for (i = 0; i < nstates; i++) { - lookaheads[i] = (Value_t) k; + lookaheads[i] = (Value_t)k; rp = reduction_table[i]; if (rp) k += rp->nreds; } - lookaheads[nstates] = (Value_t) k; + lookaheads[nstates] = (Value_t)k; LA = NEW2(k * tokensetsize, unsigned); LAruleno = NEW2(k, Value_t); @@ -212,15 +212,15 @@ set_goto_map(void) k = 0; for (i = ntokens; i < nsyms; i++) { - temp_map[i] = (Value_t) k; + temp_map[i] = (Value_t)k; k += goto_map[i]; } for (i = ntokens; i < nsyms; i++) goto_map[i] = temp_map[i]; - goto_map[nsyms] = (Value_t) ngotos; - temp_map[nsyms] = (Value_t) ngotos; + goto_map[nsyms] = (Value_t)ngotos; + temp_map[nsyms] = (Value_t)ngotos; from_state = NEW2(ngotos, Value_t); to_state = NEW2(ngotos, Value_t); @@ -264,7 +264,7 @@ map_goto(int state, int symbol) middle = (low + high) >> 1; s = from_state[middle]; if (s == state) - return (Value_t) (middle); + return (Value_t)(middle); else if (s < state) low = middle + 1; else @@ -463,12 +463,12 @@ add_lookback_edge(int stateno, int ruleno, int gotono) sp = NEW(shorts); sp->next = lookback[i]; - sp->value = (Value_t) gotono; + sp->value = (Value_t)gotono; lookback[i] = sp; } static Value_t ** -transpose(Value_t ** R2, int n) +transpose(Value_t **R2, int n) { Value_t **new_R; Value_t **temp_R; @@ -512,7 +512,7 @@ transpose(Value_t ** R2, int n) if (sp) { while (*sp >= 0) - *temp_R[*sp++]++ = (Value_t) i; + *temp_R[*sp++]++ = (Value_t)i; } } @@ -562,11 +562,11 @@ compute_lookaheads(void) } static void -digraph(Value_t ** relation) +digraph(Value_t **relation) { int i; - infinity = (Value_t) (ngotos + 2); + infinity = (Value_t)(ngotos + 2); INDEX = NEW2(ngotos + 1, Value_t); VERTICES = NEW2(ngotos + 1, Value_t); top = 0; @@ -598,7 +598,7 @@ traverse(int i) Value_t height; unsigned *base; - VERTICES[++top] = (Value_t) i; + VERTICES[++top] = (Value_t)i; INDEX[i] = height = top; base = F + i * tokensetsize; |