/[bison]/bison/src/state.h
ViewVC logotype

Diff of /bison/src/state.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5.2.1 by akim, Mon Nov 19 09:14:26 2001 UTC revision 1.5.2.2 by akim, Wed Dec 5 09:18:57 2001 UTC
# Line 88  Line 88 
88  #ifndef STATE_H_  #ifndef STATE_H_
89  # define STATE_H_  # define STATE_H_
90    
91    
92    /*-------.
93    | Core.  |
94    `-------*/
95    
96  typedef struct core  typedef struct core
97  {  {
98    struct core *next;    struct core *next;
# Line 96  typedef struct core Line 101  typedef struct core
101    short accessing_symbol;    short accessing_symbol;
102    short nitems;    short nitems;
103    short items[1];    short items[1];
104  }  } core;
 core;  
105    
106  #define CORE_ALLOC(Nitems)                                              \  #define CORE_ALLOC(Nitems)                                              \
107    (core *) xcalloc ((unsigned) (sizeof (core)                           \    (core *) xcalloc ((unsigned) (sizeof (core)                           \
108                                  + (Nitems - 1) * sizeof (short)), 1)                                  + (Nitems - 1) * sizeof (short)), 1)
109    
110    /*---------.
111    | Shifts.  |
112    `---------*/
113    
114  typedef struct shifts  typedef struct shifts
115  {  {
116    struct shifts *next;    struct shifts *next;
117    short number;    short number;
118    short nshifts;    short nshifts;
119    short shifts[1];    short shifts[1];
120  }  } shifts;
121  shifts;  
122    
123  #define SHIFTS_ALLOC(Nshifts)                                           \  #define SHIFTS_ALLOC(Nshifts)                                           \
124    (shifts *) xcalloc ((unsigned) (sizeof (shifts)                       \    (shifts *) xcalloc ((unsigned) (sizeof (shifts)                       \
125                                    + (Nshifts - 1) * sizeof (short)), 1)                                    + (Nshifts - 1) * sizeof (short)), 1)
126    
127    /* Is the SHIFTS->shifts[Shift] a real shift? (as opposed to gotos.) */
128    
129    #define SHIFT_IS_SHIFT(Shifts, Shift) \
130      (ISTOKEN (state_table[Shifts->shifts[Shift]].accessing_symbol))
131    
132    /* Is the SHIFTS->shifts[Shift] a goto?. */
133    
134    #define SHIFT_IS_GOTO(Shifts, Shift) \
135      (!SHIFT_IS_SHIFT (Shifts, Shift))
136    
137    /* Is the SHIFTS->shifts[Shift] then handling of the error token?. */
138    
139    #define SHIFT_IS_ERROR(Shifts, Shift) \
140      (state_table[Shifts->shifts[Shift]].accessing_symbol == error_token_number)
141    
142    
143    /*-------.
144    | Errs.  |
145    `-------*/
146    
147  typedef struct errs  typedef struct errs
148  {  {
149    short nerrs;    short nerrs;
150    short errs[1];    short errs[1];
151  }  } errs;
 errs;  
152    
153  #define ERRS_ALLOC(Nerrs)                                               \  #define ERRS_ALLOC(Nerrs)                                               \
154    (errs *) xcalloc ((unsigned) (sizeof (errs)                           \    (errs *) xcalloc ((unsigned) (sizeof (errs)                           \
155                                    + (Nerrs - 1) * sizeof (short)), 1)                                    + (Nerrs - 1) * sizeof (short)), 1)
156    
157    
158    /*-------------.
159    | Reductions.  |
160    `-------------*/
161    
162  typedef struct reductions  typedef struct reductions
163  {  {
# Line 136  typedef struct reductions Line 165  typedef struct reductions
165    short number;    short number;
166    short nreds;    short nreds;
167    short rules[1];    short rules[1];
168  }  } reductions;
 reductions;  
169    
170  #define REDUCTIONS_ALLOC(Nreductions)                                   \  #define REDUCTIONS_ALLOC(Nreductions)                                   \
171    (reductions *) xcalloc ((unsigned) (sizeof (reductions)               \    (reductions *) xcalloc ((unsigned) (sizeof (reductions)               \

Legend:
Removed from v.1.5.2.1  
changed lines
  Added in v.1.5.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26