69 * Line number for the purposes of error checking |
69 * Line number for the purposes of error checking |
70 */ |
70 */ |
71 int first_line; |
71 int first_line; |
72 int first_column; |
72 int first_column; |
73 const char *first_file; /* filename referenced by first line/column */ |
73 const char *first_file; /* filename referenced by first line/column */ |
|
74 long int first_order; /* relative order in which it is read by lexcial analyser */ |
74 int last_line; |
75 int last_line; |
75 int last_column; |
76 int last_column; |
76 const char *last_file; /* filename referenced by last line/column */ |
77 const char *last_file; /* filename referenced by last line/column */ |
|
78 long int last_order; /* relative order in which it is read by lexcial analyser */ |
77 |
79 |
78 public: |
80 public: |
79 /* default constructor */ |
81 /* default constructor */ |
80 symbol_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, |
82 symbol_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
81 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */ |
83 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |
82 ); |
84 ); |
83 |
85 |
84 /* default destructor */ |
86 /* default destructor */ |
85 /* must be virtual so compiler does not complain... */ |
87 /* must be virtual so compiler does not complain... */ |
86 virtual ~symbol_c(void) {return;}; |
88 virtual ~symbol_c(void) {return;}; |
107 public: |
109 public: |
108 int n; |
110 int n; |
109 symbol_c **elements; |
111 symbol_c **elements; |
110 |
112 |
111 public: |
113 public: |
112 list_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, |
114 list_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
113 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */ |
115 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |
114 ); |
116 ); |
115 |
117 |
116 list_c(symbol_c *elem, |
118 list_c(symbol_c *elem, |
117 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, |
119 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
118 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */ |
120 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |
119 ); |
121 ); |
120 /* insert a new element */ |
122 /* insert a new element */ |
121 virtual void add_element(symbol_c *elem); |
123 virtual void add_element(symbol_c *elem); |
122 }; |
124 }; |
123 |
125 |
126 |
128 |
127 #define SYM_LIST(class_name_c) \ |
129 #define SYM_LIST(class_name_c) \ |
128 class class_name_c: public list_c { \ |
130 class class_name_c: public list_c { \ |
129 public: \ |
131 public: \ |
130 class_name_c( \ |
132 class_name_c( \ |
131 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
133 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
132 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
134 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
133 class_name_c(symbol_c *elem, \ |
135 class_name_c(symbol_c *elem, \ |
134 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
136 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
135 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
137 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
136 virtual void *accept(visitor_c &visitor); \ |
138 virtual void *accept(visitor_c &visitor); \ |
137 }; |
139 }; |
138 |
140 |
139 |
141 |
140 #define SYM_TOKEN(class_name_c) \ |
142 #define SYM_TOKEN(class_name_c) \ |
141 class class_name_c: public token_c { \ |
143 class class_name_c: public token_c { \ |
142 public: \ |
144 public: \ |
143 class_name_c(const char *value, \ |
145 class_name_c(const char *value, \ |
144 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
146 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
145 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
147 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
146 virtual void *accept(visitor_c &visitor); \ |
148 virtual void *accept(visitor_c &visitor); \ |
147 }; |
149 }; |
148 |
150 |
149 |
151 |
150 #define SYM_REF0(class_name_c) \ |
152 #define SYM_REF0(class_name_c) \ |
151 class class_name_c: public symbol_c { \ |
153 class class_name_c: public symbol_c { \ |
152 public: \ |
154 public: \ |
153 class_name_c( \ |
155 class_name_c( \ |
154 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
156 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
155 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
157 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
156 virtual void *accept(visitor_c &visitor); \ |
158 virtual void *accept(visitor_c &visitor); \ |
157 }; |
159 }; |
158 |
160 |
159 |
161 |
160 #define SYM_REF1(class_name_c, ref1) \ |
162 #define SYM_REF1(class_name_c, ref1) \ |
161 class class_name_c: public symbol_c { \ |
163 class class_name_c: public symbol_c { \ |
162 public: \ |
164 public: \ |
163 symbol_c *ref1; \ |
165 symbol_c *ref1; \ |
164 public: \ |
166 public: \ |
165 class_name_c(symbol_c *ref1, \ |
167 class_name_c(symbol_c *ref1, \ |
166 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
168 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
167 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
169 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
168 virtual void *accept(visitor_c &visitor); \ |
170 virtual void *accept(visitor_c &visitor); \ |
169 }; |
171 }; |
170 |
172 |
171 |
173 |
172 #define SYM_REF2(class_name_c, ref1, ref2) \ |
174 #define SYM_REF2(class_name_c, ref1, ref2) \ |
175 symbol_c *ref1; \ |
177 symbol_c *ref1; \ |
176 symbol_c *ref2; \ |
178 symbol_c *ref2; \ |
177 public: \ |
179 public: \ |
178 class_name_c(symbol_c *ref1, \ |
180 class_name_c(symbol_c *ref1, \ |
179 symbol_c *ref2 = NULL, \ |
181 symbol_c *ref2 = NULL, \ |
180 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
182 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
181 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
183 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
182 virtual void *accept(visitor_c &visitor); \ |
184 virtual void *accept(visitor_c &visitor); \ |
183 }; |
185 }; |
184 |
186 |
185 |
187 |
186 #define SYM_REF3(class_name_c, ref1, ref2, ref3) \ |
188 #define SYM_REF3(class_name_c, ref1, ref2, ref3) \ |
191 symbol_c *ref3; \ |
193 symbol_c *ref3; \ |
192 public: \ |
194 public: \ |
193 class_name_c(symbol_c *ref1, \ |
195 class_name_c(symbol_c *ref1, \ |
194 symbol_c *ref2, \ |
196 symbol_c *ref2, \ |
195 symbol_c *ref3, \ |
197 symbol_c *ref3, \ |
196 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
198 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
197 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
199 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
198 virtual void *accept(visitor_c &visitor); \ |
200 virtual void *accept(visitor_c &visitor); \ |
199 }; |
201 }; |
200 |
202 |
201 |
203 |
202 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4) \ |
204 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4) \ |
209 public: \ |
211 public: \ |
210 class_name_c(symbol_c *ref1, \ |
212 class_name_c(symbol_c *ref1, \ |
211 symbol_c *ref2, \ |
213 symbol_c *ref2, \ |
212 symbol_c *ref3, \ |
214 symbol_c *ref3, \ |
213 symbol_c *ref4 = NULL, \ |
215 symbol_c *ref4 = NULL, \ |
214 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
216 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
215 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
217 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
216 virtual void *accept(visitor_c &visitor); \ |
218 virtual void *accept(visitor_c &visitor); \ |
217 }; |
219 }; |
218 |
220 |
219 |
221 |
220 #define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5) \ |
222 #define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5) \ |
229 class_name_c(symbol_c *ref1, \ |
231 class_name_c(symbol_c *ref1, \ |
230 symbol_c *ref2, \ |
232 symbol_c *ref2, \ |
231 symbol_c *ref3, \ |
233 symbol_c *ref3, \ |
232 symbol_c *ref4, \ |
234 symbol_c *ref4, \ |
233 symbol_c *ref5, \ |
235 symbol_c *ref5, \ |
234 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, \ |
236 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
235 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */); \ |
237 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
236 virtual void *accept(visitor_c &visitor); \ |
238 virtual void *accept(visitor_c &visitor); \ |
237 }; |
239 }; |
238 |
240 |
239 |
241 |
240 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6) \ |
242 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6) \ |