117 |
117 |
118 list_c(symbol_c *elem, |
118 list_c(symbol_c *elem, |
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 */ |
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 */ |
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 */ |
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 */ |
121 ); |
121 ); |
122 /* insert a new element */ |
122 /* append a new element to the end of the list */ |
123 virtual void add_element(symbol_c *elem); |
123 virtual void add_element(symbol_c *elem); |
124 }; |
124 /* insert a new element before position pos. */ |
125 |
125 /* To insert into the begining of list, call with pos=0 */ |
126 |
126 /* To insert into the end of list, call with pos=list->n */ |
127 |
127 virtual void insert_element(symbol_c *elem, int pos = 0); |
128 |
128 }; |
129 #define SYM_LIST(class_name_c) \ |
129 |
|
130 |
|
131 |
|
132 |
|
133 #define SYM_LIST(class_name_c, ...) \ |
130 class class_name_c: public list_c { \ |
134 class class_name_c: public list_c { \ |
131 public: \ |
135 public: \ |
|
136 __VA_ARGS__ \ |
|
137 public: \ |
132 class_name_c( \ |
138 class_name_c( \ |
133 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
139 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
134 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
140 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
135 class_name_c(symbol_c *elem, \ |
141 class_name_c(symbol_c *elem, \ |
136 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
142 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
137 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
143 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
138 virtual void *accept(visitor_c &visitor); \ |
144 virtual void *accept(visitor_c &visitor); \ |
139 }; |
145 }; |
140 |
146 |
141 |
147 |
142 #define SYM_TOKEN(class_name_c) \ |
148 #define SYM_TOKEN(class_name_c, ...) \ |
143 class class_name_c: public token_c { \ |
149 class class_name_c: public token_c { \ |
144 public: \ |
150 public: \ |
|
151 __VA_ARGS__ \ |
|
152 public: \ |
145 class_name_c(const char *value, \ |
153 class_name_c(const char *value, \ |
146 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
154 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
147 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
155 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
148 virtual void *accept(visitor_c &visitor); \ |
156 virtual void *accept(visitor_c &visitor); \ |
149 }; |
157 }; |
150 |
158 |
151 |
159 |
152 #define SYM_REF0(class_name_c) \ |
160 #define SYM_REF0(class_name_c, ...) \ |
153 class class_name_c: public symbol_c { \ |
161 class class_name_c: public symbol_c { \ |
|
162 public: \ |
|
163 __VA_ARGS__ \ |
154 public: \ |
164 public: \ |
155 class_name_c( \ |
165 class_name_c( \ |
156 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
166 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
157 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
167 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
158 virtual void *accept(visitor_c &visitor); \ |
168 virtual void *accept(visitor_c &visitor); \ |
159 }; |
169 }; |
160 |
170 |
161 |
171 |
162 #define SYM_REF1(class_name_c, ref1) \ |
172 #define SYM_REF1(class_name_c, ref1, ...) \ |
163 class class_name_c: public symbol_c { \ |
173 class class_name_c: public symbol_c { \ |
164 public: \ |
174 public: \ |
165 symbol_c *ref1; \ |
175 symbol_c *ref1; \ |
166 public: \ |
176 __VA_ARGS__ \ |
167 class_name_c(symbol_c *ref1, \ |
177 public: \ |
168 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
178 class_name_c(symbol_c *ref1, \ |
169 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
179 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
170 virtual void *accept(visitor_c &visitor); \ |
180 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
171 }; |
181 virtual void *accept(visitor_c &visitor); \ |
172 |
182 }; |
173 |
183 |
174 #define SYM_REF2(class_name_c, ref1, ref2) \ |
184 |
175 class class_name_c: public symbol_c { \ |
185 #define SYM_REF2(class_name_c, ref1, ref2, ...) \ |
176 public: \ |
186 class class_name_c: public symbol_c { \ |
177 symbol_c *ref1; \ |
187 public: \ |
178 symbol_c *ref2; \ |
188 symbol_c *ref1; \ |
|
189 symbol_c *ref2; \ |
|
190 __VA_ARGS__ \ |
179 public: \ |
191 public: \ |
180 class_name_c(symbol_c *ref1, \ |
192 class_name_c(symbol_c *ref1, \ |
181 symbol_c *ref2 = NULL, \ |
193 symbol_c *ref2 = NULL, \ |
182 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
194 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
183 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
195 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
184 virtual void *accept(visitor_c &visitor); \ |
196 virtual void *accept(visitor_c &visitor); \ |
185 }; |
197 }; |
186 |
198 |
187 |
199 |
188 #define SYM_REF3(class_name_c, ref1, ref2, ref3) \ |
200 #define SYM_REF3(class_name_c, ref1, ref2, ref3, ...) \ |
189 class class_name_c: public symbol_c { \ |
201 class class_name_c: public symbol_c { \ |
190 public: \ |
202 public: \ |
191 symbol_c *ref1; \ |
203 symbol_c *ref1; \ |
192 symbol_c *ref2; \ |
204 symbol_c *ref2; \ |
193 symbol_c *ref3; \ |
205 symbol_c *ref3; \ |
194 public: \ |
206 __VA_ARGS__ \ |
195 class_name_c(symbol_c *ref1, \ |
207 public: \ |
196 symbol_c *ref2, \ |
208 class_name_c(symbol_c *ref1, \ |
197 symbol_c *ref3, \ |
209 symbol_c *ref2, \ |
198 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
210 symbol_c *ref3, \ |
199 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
211 int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, \ |
200 virtual void *accept(visitor_c &visitor); \ |
212 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
201 }; |
213 virtual void *accept(visitor_c &visitor); \ |
202 |
214 }; |
203 |
215 |
204 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4) \ |
216 |
|
217 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4, ...) \ |
205 class class_name_c: public symbol_c { \ |
218 class class_name_c: public symbol_c { \ |
206 public: \ |
219 public: \ |
207 symbol_c *ref1; \ |
220 symbol_c *ref1; \ |
208 symbol_c *ref2; \ |
221 symbol_c *ref2; \ |
209 symbol_c *ref3; \ |
222 symbol_c *ref3; \ |
210 symbol_c *ref4; \ |
223 symbol_c *ref4; \ |
|
224 __VA_ARGS__ \ |
211 public: \ |
225 public: \ |
212 class_name_c(symbol_c *ref1, \ |
226 class_name_c(symbol_c *ref1, \ |
213 symbol_c *ref2, \ |
227 symbol_c *ref2, \ |
214 symbol_c *ref3, \ |
228 symbol_c *ref3, \ |
215 symbol_c *ref4 = NULL, \ |
229 symbol_c *ref4 = NULL, \ |