Expand PMF_FN_* macros.
[netbsd-mini2440.git] / gnu / usr.bin / awk / parse.c
blob423eabe25cabd43dbe4f0d77426defa82be9f98d
1 #ifndef lint
2 static char yyid[] = "@(#)modification of yaccpar 1.8 (Berkeley) 01/20/90";
3 #endif
4 #define YYXBYACC 1 /* XBYACC -- modified Berkeley yacc */
5 /*
6 Berkeley yacc modified so only tables and
7 yydebug and yylval are global
8 #define YYGLOBAL -- gives standard byacc
9 #define YYPURE -- gives a reentrant parser
11 Mike Brennan 11/05/91
13 #line 24 "parse.y"
14 #include <stdio.h>
15 #include "mawk.h"
16 #include "code.h"
17 #include "symtype.h"
18 #include "memory.h"
19 #include "bi_funct.h"
20 #include "bi_vars.h"
21 #include "jmp.h"
22 #include "field.h"
23 #include "files.h"
25 #ifdef YYXBYACC
26 #define YYBYACC 1
27 #endif
29 #define YYMAXDEPTH 200
31 /* Bison's use of MSDOS and ours clashes */
32 #undef MSDOS
34 extern void PROTO( eat_nl, (void) ) ;
35 static void PROTO( resize_fblock, (FBLOCK *, INST *) ) ;
36 static void PROTO( code_array, (SYMTAB *) ) ;
37 static void PROTO( code_call_id, (CA_REC *, SYMTAB *) ) ;
38 static void PROTO( field_A2I, (void)) ;
39 static int PROTO( current_offset, (void) ) ;
40 static void PROTO( check_var, (SYMTAB *) ) ;
41 static void PROTO( check_array, (SYMTAB *) ) ;
42 static void PROTO( RE_as_arg, (void)) ;
44 static int scope ;
45 static FBLOCK *active_funct ;
46 /* when scope is SCOPE_FUNCT */
48 #define code_address(x) if( is_local(x) )\
49 { code1(L_PUSHA) ; code1((x)->offset) ; }\
50 else code2(_PUSHA, (x)->stval.cp)
52 /* this nonsense caters to MSDOS large model */
53 #define CODE_FE_PUSHA() code_ptr->ptr = (PTR) 0 ; code1(FE_PUSHA)
55 #line 67 "parse.y"
56 typedef union{
57 CELL *cp ;
58 SYMTAB *stp ;
59 INST *start ; /* code starting address */
60 PF_CP fp ; /* ptr to a (print/printf) or (sub/gsub) function */
61 BI_REC *bip ; /* ptr to info about a builtin */
62 FBLOCK *fbp ; /* ptr to a function block */
63 ARG2_REC *arg2p ;
64 CA_REC *ca_p ;
65 int ival ;
66 PTR ptr ;
67 } YYSTYPE;
68 #line 69 "y.tab.c"
69 #define UNEXPECTED 257
70 #define BAD_DECIMAL 258
71 #define NL 259
72 #define SEMI_COLON 260
73 #define LBRACE 261
74 #define RBRACE 262
75 #define LBOX 263
76 #define RBOX 264
77 #define COMMA 265
78 #define IO_OUT 266
79 #define ASSIGN 267
80 #define ADD_ASG 268
81 #define SUB_ASG 269
82 #define MUL_ASG 270
83 #define DIV_ASG 271
84 #define MOD_ASG 272
85 #define POW_ASG 273
86 #define QMARK 274
87 #define COLON 275
88 #define OR 276
89 #define AND 277
90 #define IN 278
91 #define MATCH 279
92 #define EQ 280
93 #define NEQ 281
94 #define LT 282
95 #define LTE 283
96 #define GT 284
97 #define GTE 285
98 #define CAT 286
99 #define GETLINE 287
100 #define PLUS 288
101 #define MINUS 289
102 #define MUL 290
103 #define DIV 291
104 #define MOD 292
105 #define NOT 293
106 #define UMINUS 294
107 #define IO_IN 295
108 #define PIPE 296
109 #define POW 297
110 #define INC_or_DEC 298
111 #define DOLLAR 299
112 #define FIELD 300
113 #define LPAREN 301
114 #define RPAREN 302
115 #define DOUBLE 303
116 #define STRING_ 304
117 #define RE 305
118 #define ID 306
119 #define D_ID 307
120 #define FUNCT_ID 308
121 #define BUILTIN 309
122 #define PRINT 310
123 #define PRINTF 311
124 #define SPLIT 312
125 #define MATCH_FUNC 313
126 #define SUB 314
127 #define GSUB 315
128 #define DO 316
129 #define WHILE 317
130 #define FOR 318
131 #define BREAK 319
132 #define CONTINUE 320
133 #define IF 321
134 #define ELSE 322
135 #define DELETE 323
136 #define BEGIN 324
137 #define END 325
138 #define EXIT 326
139 #define NEXT 327
140 #define RETURN 328
141 #define FUNCTION 329
142 #define YYERRCODE 256
143 short yylhs[] = { -1,
144 0, 0, 36, 36, 36, 37, 39, 37, 40, 37,
145 41, 37, 42, 43, 37, 1, 1, 2, 2, 3,
146 3, 4, 4, 4, 4, 4, 4, 4, 4, 44,
147 44, 13, 13, 13, 13, 13, 13, 13, 13, 13,
148 13, 13, 13, 13, 13, 13, 45, 13, 46, 13,
149 47, 48, 13, 14, 14, 15, 15, 15, 15, 15,
150 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
151 15, 15, 15, 15, 10, 25, 25, 26, 26, 8,
152 5, 4, 27, 27, 6, 6, 6, 7, 7, 49,
153 49, 17, 4, 50, 4, 51, 4, 16, 4, 4,
154 18, 18, 19, 19, 52, 52, 13, 13, 10, 15,
155 15, 4, 20, 4, 11, 11, 11, 11, 11, 15,
156 13, 13, 13, 13, 13, 13, 13, 15, 22, 53,
157 53, 15, 23, 4, 4, 21, 21, 15, 15, 15,
158 15, 15, 54, 12, 12, 9, 9, 15, 28, 28,
159 24, 24, 38, 29, 30, 30, 34, 34, 35, 35,
160 15, 31, 31, 32, 32, 32, 33, 33,
162 short yylen[] = { 2,
163 1, 2, 1, 1, 2, 1, 0, 3, 0, 3,
164 0, 3, 0, 0, 6, 3, 3, 1, 1, 1,
165 2, 1, 2, 1, 2, 2, 2, 1, 2, 1,
166 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
167 3, 3, 3, 3, 3, 3, 0, 4, 0, 4,
168 0, 0, 7, 1, 2, 1, 1, 1, 3, 1,
169 3, 3, 3, 3, 3, 3, 2, 2, 2, 1,
170 2, 2, 2, 2, 1, 0, 1, 1, 3, 5,
171 0, 5, 1, 1, 1, 3, 2, 3, 3, 0,
172 2, 4, 2, 1, 4, 1, 7, 4, 2, 4,
173 3, 4, 1, 2, 1, 2, 3, 5, 5, 5,
174 6, 7, 6, 2, 1, 2, 6, 2, 3, 1,
175 3, 3, 3, 3, 3, 3, 3, 2, 5, 1,
176 3, 6, 1, 2, 3, 2, 3, 1, 2, 2,
177 3, 4, 1, 1, 1, 2, 3, 6, 1, 1,
178 1, 3, 2, 4, 2, 2, 0, 1, 1, 3,
179 3, 2, 2, 1, 3, 3, 2, 2,
181 short yydefred[] = { 0,
182 0, 0, 143, 0, 0, 0, 0, 0, 115, 0,
183 56, 57, 60, 0, 81, 81, 0, 0, 149, 150,
184 7, 9, 0, 0, 6, 70, 0, 0, 0, 0,
185 0, 0, 0, 0, 0, 0, 1, 3, 4, 0,
186 5, 0, 30, 31, 83, 84, 96, 0, 0, 0,
187 0, 0, 0, 0, 0, 0, 22, 0, 20, 0,
188 0, 0, 0, 0, 28, 81, 24, 0, 0, 0,
189 0, 0, 0, 0, 0, 0, 72, 74, 0, 118,
190 0, 0, 0, 71, 0, 0, 0, 0, 0, 0,
191 0, 155, 156, 2, 0, 0, 0, 0, 0, 0,
192 0, 0, 0, 0, 0, 0, 0, 0, 0, 73,
193 13, 51, 47, 49, 0, 0, 0, 0, 0, 0,
194 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
195 0, 0, 130, 128, 0, 153, 0, 146, 144, 145,
196 0, 17, 25, 0, 0, 26, 27, 0, 81, 0,
197 134, 29, 0, 136, 0, 16, 21, 23, 99, 0,
198 103, 0, 0, 114, 0, 0, 0, 0, 0, 0,
199 0, 0, 0, 119, 0, 59, 0, 0, 161, 0,
200 0, 0, 0, 8, 10, 0, 0, 0, 0, 0,
201 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
202 0, 0, 0, 107, 0, 40, 41, 42, 43, 44,
203 45, 18, 12, 19, 0, 0, 0, 0, 0, 0,
204 0, 0, 0, 0, 159, 0, 0, 147, 0, 101,
205 0, 0, 0, 0, 135, 137, 94, 0, 104, 105,
206 0, 0, 0, 0, 0, 85, 0, 0, 0, 0,
207 0, 0, 0, 0, 0, 162, 0, 0, 163, 0,
208 0, 0, 0, 0, 0, 0, 142, 131, 0, 154,
209 0, 98, 0, 102, 92, 0, 95, 106, 100, 87,
210 0, 0, 0, 0, 0, 0, 0, 0, 108, 0,
211 166, 168, 165, 167, 80, 129, 0, 0, 52, 0,
212 160, 0, 0, 0, 0, 82, 0, 0, 0, 109,
213 117, 111, 132, 15, 0, 0, 151, 148, 113, 0,
214 0, 0, 0, 112, 97, 152,
216 short yydgoto[] = { 24,
217 57, 213, 58, 59, 85, 244, 81, 26, 27, 28,
218 29, 141, 60, 31, 32, 61, 62, 63, 163, 64,
219 65, 33, 224, 318, 246, 247, 66, 34, 35, 36,
220 179, 180, 259, 226, 227, 37, 38, 39, 90, 91,
221 123, 200, 298, 67, 202, 203, 201, 315, 283, 238,
222 68, 242, 134, 40,
224 short yysindex[] = { 38,
225 -259, 276, 0, 2215, 2215, 2215, -158, 2128, 0, 2244,
226 0, 0, 0, -290, 0, 0, -286, -274, 0, 0,
227 0, 0, -212, 38, 0, 0, 2215, 282, 2122, 2514,
228 2215, 116, -242, -270, -259, -261, 0, 0, 0, -223,
229 0, -125, 0, 0, 0, 0, 0, -255, -250, -197,
230 -197, -234, -222, 1702, -197, 1702, 0, 130, 0, 2466,
231 349, 349, 1792, 349, 0, 0, 0, 349, 2244, -290,
232 -210, -260, -260, -260, -103, 0, 0, 0, 0, 0,
233 -241, -84, 2069, 0, -147, -169, -143, 2244, 2244, -259,
234 -259, 0, 0, 0, -130, 2244, 2244, 2244, 2244, 2244,
235 2244, 2244, 2244, 2244, 2244, 2244, 2244, 2244, 2244, 0,
236 0, 0, 0, 0, -135, 2244, 2244, 2244, 2244, 2244,
237 2244, 2244, -44, 116, 2215, 2215, 2215, 2215, 2215, -110,
238 2215, 2244, 0, 0, 2244, 0, -106, 0, 0, 0,
239 -69, 0, 0, 2244, 1822, 0, 0, 2244, 0, 2466,
240 0, 0, 2466, 0, -197, 0, 0, 0, 0, -95,
241 0, 2478, 2157, 0, 2273, -88, 2373, -22, -59, -14,
242 -10, 2244, -24, 0, 2244, 0, 2244, -46, 0, 2302,
243 2244, 2535, 2556, 0, 0, 2580, 2580, 2580, 2580, 2580,
244 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2244,
245 2244, 2244, 2244, 0, 204, 0, 0, 0, 0, 0,
246 0, 0, 0, 0, -25, -25, -260, -260, -260, -158,
247 -130, 2385, 2580, -8, 0, -43, -4, 0, 2400, 0,
248 -266, 2493, 2412, 5, 0, 0, 0, 349, 0, 0,
249 2427, 349, 2186, -2, 2580, 0, -3, -32, 2244, 2244,
250 2244, 2580, -31, 2580, -184, 0, -248, 2096, 0, -28,
251 -19, 2244, 2580, 2568, 2589, 197, 0, 0, 2244, 0,
252 -18, 0, -6, 0, 0, 2244, 0, 0, 0, 0,
253 -237, 2244, -197, 2244, 2244, -126, -111, -102, 0, -17,
254 0, 0, 0, 0, 0, 0, -20, -44, 0, 2123,
255 0, 2, -90, -24, 2580, 0, 2580, 2439, -17, 0,
256 0, 0, 0, 0, 2244, -158, 0, 0, 0, -197,
257 -197, 2580, 6, 0, 0, 0,
259 short yyrindex[] = { 0,
260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
261 0, 0, 0, 590, 0, 0, 0, 0, 0, 0,
262 0, 0, 0, 0, 0, 0, 0, 0, 1559, 19,
263 95, 1616, 0, 0, 0, 0, 0, 0, 0, 1388,
264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266 0, 0, 0, 0, 0, 0, 0, 0, 0, 533,
267 647, 875, 932, 989, 0, 419, 0, 0, 476, 0,
268 0, 1917, 0, 0, 0, 0, 0, 0, 0, 0,
269 0, 0, 0, 0, 1046, 0, 0, 0, 0, 0,
270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
271 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
272 0, 0, 0, 1673, 0, 0, 0, 0, 0, 0,
273 0, 0, 0, 0, 0, 0, 11, 0, 0, 0,
274 704, 0, 0, 0, 0, 0, 0, 0, 0, 0,
275 0, 0, 0, 0, 0, 0, 0, 0, 0, 203,
276 0, 0, 0, 0, -109, 0, 0, 0, 0, 0,
277 0, 0, 0, 0, 0, 0, 0, 2331, 0, 0,
278 12, 0, 0, 0, 0, -217, 135, 208, 281, 354,
279 1974, 1982, 1994, 2002, 2014, 2022, 2034, 2042, 2054, 0,
280 0, 0, 0, 0, -54, 0, 0, 0, 0, 0,
281 0, 0, 0, 0, 1445, 1502, 1103, 1160, 1217, 1331,
282 761, 0, -236, 0, 0, 0, 15, 0, 0, 0,
283 1758, 0, 0, 0, 0, 0, 0, 0, 0, 0,
284 0, 0, 0, -80, -173, 0, -207, 0, 0, 0,
285 0, -231, 0, -227, 0, 0, 1875, 0, 0, 0,
286 0, 0, 37, 0, -29, 46, 0, 0, 0, 0,
287 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
288 0, 0, 0, 0, 0, 0, 0, 0, 0, 1274,
289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
290 0, 0, 0, -67, -51, 0, -26, 0, 818, 0,
291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
292 0, 2062, 0, 0, 0, 0,
294 short yygindex[] = { 0,
295 21, 4, 0, -48, 3, 0, 41, 0, 0, -7,
296 -1, -185, 1, 0, 164, 0, 0, 0, 0, 0,
297 0, 0, 39, 0, 122, -136, 0, 0, 0, 0,
298 0, 0, 0, 0, 0, 294, 0, 0, 0, 0,
299 0, 0, 0, 105, 0, 0, 0, 0, 0, 0,
300 0, 0, 0, 0,
302 #define YYTABLESIZE 2874
303 short yytable[] = { 77,
304 30, 2, 71, 71, 71, 78, 71, 84, 82, 157,
305 83, 273, 159, 160, 88, 164, 291, 86, 87, 166,
306 25, 41, 132, 172, 30, 71, 89, 172, 133, 71,
307 135, 84, 139, 89, 267, 130, 131, 88, 140, 137,
308 255, 33, 33, 33, 25, 144, 33, 33, 33, 84,
309 145, 77, 77, 292, 150, 136, 153, 33, 77, 133,
310 173, 43, 44, 162, 304, 133, 148, 82, 165, 167,
311 89, 138, 168, 169, 88, 8, 9, 75, 170, 290,
312 284, 171, 76, 149, 33, 78, 78, 110, 182, 183,
313 78, 78, 78, 92, 77, 93, 186, 187, 188, 189,
314 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
315 184, 185, 286, 287, 288, 177, 205, 206, 207, 208,
316 209, 210, 211, 71, 71, 71, 71, 71, 78, 71,
317 323, 178, 222, 43, 44, 223, 142, 309, 284, 303,
318 8, 9, 75, 212, 229, 232, 143, 76, 233, 76,
319 76, 234, 310, 284, 146, 147, 76, 181, 151, 152,
320 154, 311, 284, 241, 158, 245, 131, 72, 73, 74,
321 204, 80, 252, 320, 284, 254, 220, 245, 90, 90,
322 258, 245, 103, 104, 105, 106, 107, 108, 109, 277,
323 95, 86, 86, 279, 124, 8, 9, 75, 86, 225,
324 263, 264, 265, 266, 46, 46, 46, 91, 91, 46,
325 46, 46, 139, 110, 43, 44, 2, 174, 140, 46,
326 46, 46, 46, 46, 46, 228, 237, 214, 248, 48,
327 48, 48, 79, 79, 48, 48, 48, 79, 79, 79,
328 249, 82, 174, 83, 48, 48, 48, 46, 250, 245,
329 245, 245, 251, 253, 235, 256, 269, 236, 270, 143,
330 271, 284, 223, 282, 127, 128, 129, 276, 285, 300,
331 130, 131, 48, 295, 289, 79, 245, 11, 11, 11,
332 312, 313, 305, 281, 307, 308, 296, 301, 215, 216,
333 217, 218, 219, 1, 221, 14, 14, 14, 2, 302,
334 297, 314, 260, 319, 50, 50, 50, 326, 139, 50,
335 50, 50, 157, 76, 140, 322, 158, 94, 212, 50,
336 50, 50, 50, 0, 3, 4, 5, 0, 0, 0,
337 6, 0, 0, 0, 0, 7, 8, 9, 10, 0,
338 11, 12, 13, 14, 0, 15, 16, 50, 0, 17,
339 18, 19, 20, 32, 32, 32, 0, 0, 32, 32,
340 32, 21, 22, 0, 0, 0, 23, 0, 32, 32,
341 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
342 0, 0, 0, 0, 0, 155, 0, 306, 43, 44,
343 2, 156, 0, 34, 34, 34, 32, 0, 34, 34,
344 34, 0, 214, 125, 126, 127, 128, 129, 0, 34,
345 0, 130, 131, 0, 0, 0, 3, 4, 5, 0,
346 0, 0, 6, 0, 324, 325, 0, 7, 8, 9,
347 10, 0, 11, 12, 13, 14, 34, 15, 16, 45,
348 46, 17, 18, 19, 20, 47, 48, 49, 50, 51,
349 52, 0, 53, 0, 0, 54, 55, 56, 93, 0,
350 0, 93, 93, 93, 93, 0, 35, 35, 35, 0,
351 0, 35, 35, 35, 115, 116, 117, 118, 119, 120,
352 121, 122, 35, 117, 118, 119, 120, 121, 122, 93,
353 93, 93, 0, 0, 0, 93, 0, 0, 0, 0,
354 93, 93, 93, 93, 0, 93, 93, 93, 93, 35,
355 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
356 93, 93, 93, 93, 0, 93, 0, 0, 93, 93,
357 93, 42, 0, 0, 43, 44, 2, 0, 0, 36,
358 36, 36, 0, 0, 36, 36, 36, 0, 96, 97,
359 98, 99, 100, 101, 102, 36, 0, 0, 0, 0,
360 0, 0, 3, 4, 5, 0, 0, 0, 6, 0,
361 0, 0, 0, 7, 8, 9, 10, 0, 11, 12,
362 13, 14, 36, 15, 16, 45, 46, 17, 18, 19,
363 20, 47, 48, 49, 50, 51, 52, 0, 53, 0,
364 0, 54, 55, 56, 155, 0, 0, 43, 44, 2,
365 0, 0, 37, 37, 37, 0, 0, 37, 37, 37,
366 0, 0, 0, 0, 0, 0, 0, 0, 37, 0,
367 0, 0, 0, 0, 0, 3, 4, 5, 0, 0,
368 0, 6, 0, 0, 0, 0, 7, 8, 9, 10,
369 0, 11, 12, 13, 14, 37, 15, 16, 45, 46,
370 17, 18, 19, 20, 47, 48, 49, 50, 51, 52,
371 0, 53, 0, 0, 54, 55, 56, 75, 75, 75,
372 0, 81, 75, 75, 75, 75, 75, 75, 75, 75,
373 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
374 75, 75, 75, 75, 0, 75, 75, 75, 75, 75,
375 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
376 75, 75, 75, 75, 75, 0, 75, 75, 0, 0,
377 75, 75, 75, 75, 116, 116, 116, 0, 81, 116,
378 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
379 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
380 116, 0, 116, 116, 116, 116, 116, 116, 116, 0,
381 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
382 116, 116, 0, 116, 116, 0, 0, 116, 116, 116,
383 116, 58, 58, 58, 0, 81, 58, 58, 58, 58,
384 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
385 58, 58, 58, 58, 58, 58, 58, 58, 0, 58,
386 58, 58, 58, 58, 58, 58, 0, 58, 58, 58,
387 0, 58, 58, 58, 58, 58, 58, 58, 58, 0,
388 58, 58, 0, 0, 58, 58, 58, 58, 58, 58,
389 58, 0, 81, 58, 58, 58, 75, 75, 75, 75,
390 75, 75, 75, 58, 58, 58, 58, 58, 58, 58,
391 58, 58, 58, 58, 58, 0, 58, 58, 58, 58,
392 58, 58, 58, 0, 0, 58, 58, 0, 58, 58,
393 58, 58, 58, 58, 58, 58, 0, 58, 58, 0,
394 0, 58, 58, 58, 58, 120, 120, 120, 0, 0,
395 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
396 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
397 120, 120, 0, 120, 120, 120, 120, 120, 120, 120,
398 0, 120, 120, 120, 0, 120, 120, 120, 120, 120,
399 120, 120, 120, 0, 120, 120, 0, 0, 120, 120,
400 120, 120, 139, 139, 139, 0, 0, 139, 139, 139,
401 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
402 139, 139, 139, 139, 139, 139, 139, 139, 139, 0,
403 139, 139, 139, 139, 139, 139, 139, 0, 0, 139,
404 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
405 0, 139, 139, 0, 0, 139, 139, 139, 139, 66,
406 66, 66, 0, 0, 66, 66, 66, 66, 66, 66,
407 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
408 66, 66, 66, 66, 66, 66, 0, 66, 66, 66,
409 66, 66, 66, 66, 0, 66, 66, 0, 66, 66,
410 66, 66, 66, 66, 66, 66, 66, 0, 66, 66,
411 0, 0, 66, 66, 66, 66, 110, 110, 110, 0,
412 0, 110, 110, 110, 110, 110, 110, 110, 110, 110,
413 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
414 110, 110, 110, 0, 110, 110, 110, 110, 110, 110,
415 110, 0, 110, 110, 110, 0, 110, 110, 110, 110,
416 110, 110, 110, 110, 0, 110, 110, 0, 0, 110,
417 110, 110, 110, 68, 68, 68, 0, 0, 68, 68,
418 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
419 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
420 0, 68, 68, 68, 68, 68, 68, 68, 0, 68,
421 0, 0, 68, 68, 68, 68, 68, 68, 68, 68,
422 68, 0, 68, 68, 0, 0, 68, 68, 68, 68,
423 69, 69, 69, 0, 0, 69, 69, 69, 69, 69,
424 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
425 69, 69, 69, 69, 69, 69, 69, 0, 69, 69,
426 69, 69, 69, 69, 69, 0, 69, 0, 0, 69,
427 69, 69, 69, 69, 69, 69, 69, 69, 0, 69,
428 69, 0, 0, 69, 69, 69, 69, 67, 67, 67,
429 0, 0, 67, 67, 67, 67, 67, 67, 67, 67,
430 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
431 67, 67, 67, 67, 0, 67, 67, 67, 67, 67,
432 67, 67, 0, 67, 0, 0, 67, 67, 67, 67,
433 67, 67, 67, 67, 67, 0, 67, 67, 0, 0,
434 67, 67, 67, 67, 140, 140, 140, 0, 0, 140,
435 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
436 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
437 140, 0, 140, 140, 140, 140, 140, 140, 140, 0,
438 140, 0, 0, 140, 140, 140, 140, 140, 140, 140,
439 140, 140, 0, 140, 140, 0, 0, 140, 140, 140,
440 140, 63, 63, 63, 0, 0, 63, 63, 63, 63,
441 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
442 63, 63, 63, 63, 63, 63, 63, 63, 0, 63,
443 63, 63, 63, 63, 63, 63, 0, 63, 0, 0,
444 63, 63, 63, 63, 63, 63, 63, 63, 63, 0,
445 63, 63, 0, 0, 63, 63, 63, 63, 64, 64,
446 64, 0, 0, 64, 64, 64, 64, 64, 64, 64,
447 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
448 64, 64, 64, 64, 64, 0, 64, 64, 64, 64,
449 64, 64, 64, 0, 64, 0, 0, 64, 64, 64,
450 64, 64, 64, 64, 64, 64, 0, 64, 64, 0,
451 0, 64, 64, 64, 64, 65, 65, 65, 0, 0,
452 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
453 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
454 65, 65, 0, 65, 65, 65, 65, 65, 65, 65,
455 0, 65, 0, 0, 65, 65, 65, 65, 65, 65,
456 65, 65, 65, 0, 65, 65, 0, 0, 65, 65,
457 65, 65, 110, 110, 110, 0, 0, 110, 110, 110,
458 109, 109, 109, 109, 109, 109, 109, 110, 110, 110,
459 110, 110, 110, 110, 110, 110, 110, 110, 110, 0,
460 110, 110, 110, 110, 110, 110, 110, 0, 0, 110,
461 110, 0, 110, 110, 110, 110, 110, 110, 110, 110,
462 0, 110, 110, 0, 0, 110, 110, 110, 110, 141,
463 141, 141, 0, 0, 141, 141, 141, 141, 141, 141,
464 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
465 141, 141, 141, 141, 141, 141, 0, 141, 141, 141,
466 141, 141, 141, 141, 0, 141, 141, 141, 141, 0,
467 0, 0, 141, 141, 141, 141, 0, 0, 141, 141,
468 0, 0, 141, 141, 141, 141, 138, 138, 138, 0,
469 0, 138, 138, 138, 138, 138, 138, 138, 138, 138,
470 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
471 138, 138, 138, 0, 138, 138, 138, 138, 138, 138,
472 138, 0, 0, 138, 138, 138, 0, 0, 0, 138,
473 138, 138, 138, 0, 0, 138, 138, 0, 0, 138,
474 138, 138, 138, 61, 61, 61, 0, 0, 61, 61,
475 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
476 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
477 0, 61, 61, 61, 0, 0, 0, 61, 0, 61,
478 0, 0, 61, 61, 61, 61, 61, 61, 61, 61,
479 61, 0, 61, 61, 0, 0, 61, 61, 61, 61,
480 62, 62, 62, 0, 0, 62, 62, 62, 62, 62,
481 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
482 62, 62, 62, 62, 62, 62, 62, 0, 62, 62,
483 62, 0, 0, 0, 62, 0, 62, 0, 0, 62,
484 62, 62, 62, 62, 62, 62, 62, 62, 0, 62,
485 62, 0, 0, 62, 62, 62, 62, 120, 120, 120,
486 0, 0, 120, 120, 120, 0, 0, 0, 0, 0,
487 0, 0, 120, 120, 120, 120, 120, 120, 120, 120,
488 120, 120, 120, 120, 0, 120, 120, 120, 120, 120,
489 120, 120, 0, 0, 120, 120, 0, 120, 120, 120,
490 120, 120, 120, 120, 120, 0, 120, 120, 0, 0,
491 120, 120, 120, 120, 54, 54, 54, 0, 0, 54,
492 54, 54, 0, 0, 0, 0, 0, 0, 0, 54,
493 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
494 54, 0, 54, 0, 0, 0, 0, 0, 54, 0,
495 0, 0, 0, 54, 54, 54, 54, 54, 54, 54,
496 54, 54, 0, 54, 54, 0, 0, 54, 54, 54,
497 54, 55, 55, 55, 0, 0, 55, 55, 55, 0,
498 0, 0, 0, 0, 0, 0, 55, 55, 55, 55,
499 55, 55, 55, 55, 55, 55, 55, 55, 0, 55,
500 43, 44, 0, 0, 0, 55, 0, 0, 0, 0,
501 55, 55, 55, 55, 55, 55, 55, 55, 55, 0,
502 55, 55, 0, 0, 55, 55, 55, 55, 3, 4,
503 5, 0, 0, 0, 6, 0, 0, 0, 0, 7,
504 8, 9, 10, 0, 11, 12, 13, 14, 0, 15,
505 16, 0, 0, 17, 18, 19, 20, 58, 0, 0,
506 81, 0, 0, 0, 75, 75, 75, 75, 75, 75,
507 75, 58, 0, 58, 58, 0, 58, 58, 58, 58,
508 58, 58, 58, 0, 58, 58, 58, 58, 58, 58,
509 58, 161, 0, 58, 58, 0, 58, 58, 58, 0,
510 58, 58, 58, 58, 0, 58, 58, 0, 0, 58,
511 58, 58, 58, 0, 0, 0, 0, 0, 3, 4,
512 5, 230, 0, 0, 6, 0, 0, 0, 0, 7,
513 8, 9, 10, 0, 11, 12, 13, 14, 0, 15,
514 16, 0, 0, 17, 18, 19, 20, 0, 3, 4,
515 5, 0, 0, 0, 6, 0, 0, 0, 0, 7,
516 8, 9, 10, 0, 11, 12, 13, 231, 0, 15,
517 16, 0, 0, 17, 18, 19, 20, 81, 0, 0,
518 0, 75, 75, 75, 75, 75, 75, 75, 58, 0,
519 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
520 0, 58, 58, 58, 58, 58, 58, 58, 0, 0,
521 58, 58, 0, 58, 58, 58, 0, 58, 58, 58,
522 58, 120, 58, 58, 0, 0, 58, 58, 58, 58,
523 120, 0, 120, 120, 120, 120, 120, 120, 120, 120,
524 120, 120, 0, 120, 120, 120, 120, 120, 120, 120,
525 0, 0, 120, 120, 0, 120, 120, 120, 0, 120,
526 120, 120, 120, 0, 120, 120, 0, 0, 120, 120,
527 120, 120, 38, 38, 38, 0, 0, 38, 38, 38,
528 39, 39, 39, 0, 0, 39, 39, 39, 38, 0,
529 0, 0, 121, 121, 121, 0, 39, 121, 121, 121,
530 122, 122, 122, 0, 0, 122, 122, 122, 121, 0,
531 0, 0, 123, 123, 123, 38, 122, 123, 123, 123,
532 124, 124, 124, 39, 0, 124, 124, 124, 123, 0,
533 0, 0, 125, 125, 125, 121, 124, 125, 125, 125,
534 126, 126, 126, 122, 0, 126, 126, 126, 125, 0,
535 0, 0, 127, 127, 127, 123, 126, 127, 127, 127,
536 53, 53, 53, 124, 0, 53, 53, 53, 127, 0,
537 0, 0, 0, 175, 0, 125, 53, 0, 0, 0,
538 0, 0, 112, 126, 113, 114, 115, 116, 117, 118,
539 119, 120, 121, 122, 0, 127, 0, 0, 0, 0,
540 293, 0, 0, 53, 0, 0, 0, 0, 0, 112,
541 176, 113, 114, 115, 116, 117, 118, 119, 120, 121,
542 122, 0, 0, 0, 0, 0, 0, 316, 103, 104,
543 105, 106, 107, 108, 109, 0, 112, 294, 113, 114,
544 115, 116, 117, 118, 119, 120, 121, 122, 0, 0,
545 0, 0, 0, 0, 3, 4, 5, 0, 0, 110,
546 6, 0, 0, 0, 317, 7, 8, 9, 69, 0,
547 11, 12, 13, 70, 79, 15, 16, 0, 0, 17,
548 18, 19, 20, 3, 4, 5, 0, 0, 0, 6,
549 0, 0, 0, 0, 7, 8, 9, 10, 240, 11,
550 12, 13, 14, 0, 15, 16, 0, 0, 17, 18,
551 19, 20, 3, 4, 5, 0, 0, 0, 6, 0,
552 0, 0, 0, 7, 8, 9, 10, 280, 11, 12,
553 13, 14, 0, 15, 16, 0, 0, 17, 18, 19,
554 20, 3, 4, 5, 0, 0, 0, 6, 0, 0,
555 0, 0, 7, 8, 9, 69, 0, 11, 12, 13,
556 70, 0, 15, 16, 0, 0, 17, 18, 19, 20,
557 3, 4, 5, 0, 0, 0, 6, 0, 0, 0,
558 0, 7, 8, 9, 10, 0, 11, 12, 13, 14,
559 0, 15, 16, 0, 0, 17, 18, 19, 20, 3,
560 4, 5, 0, 0, 0, 6, 0, 0, 0, 0,
561 7, 8, 9, 243, 0, 11, 12, 13, 14, 0,
562 15, 16, 0, 0, 17, 18, 19, 20, 3, 4,
563 5, 0, 0, 0, 6, 0, 0, 0, 0, 7,
564 8, 9, 10, 0, 11, 12, 13, 257, 0, 15,
565 16, 0, 0, 17, 18, 19, 20, 164, 164, 164,
566 0, 0, 0, 164, 0, 0, 0, 0, 164, 164,
567 164, 164, 0, 164, 164, 164, 164, 0, 164, 164,
568 0, 0, 164, 164, 164, 164, 112, 0, 113, 114,
569 115, 116, 117, 118, 119, 120, 121, 122, 112, 0,
570 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
571 0, 0, 0, 112, 176, 113, 114, 115, 116, 117,
572 118, 119, 120, 121, 122, 112, 268, 113, 114, 115,
573 116, 117, 118, 119, 120, 121, 122, 0, 0, 0,
574 112, 272, 113, 114, 115, 116, 117, 118, 119, 120,
575 121, 122, 112, 275, 113, 114, 115, 116, 117, 118,
576 119, 120, 121, 122, 43, 44, 0, 0, 278, 0,
577 0, 0, 0, 0, 0, 0, 0, 239, 0, 112,
578 321, 113, 114, 115, 116, 117, 118, 119, 120, 121,
579 122, 112, 274, 113, 114, 115, 116, 117, 118, 119,
580 120, 121, 122, 0, 0, 0, 112, 0, 113, 114,
581 115, 116, 117, 118, 119, 120, 121, 122, 111, 0,
582 0, 0, 0, 0, 0, 0, 0, 112, 0, 113,
583 114, 115, 116, 117, 118, 119, 120, 121, 122, 261,
584 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
585 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
586 262, 0, 0, 0, 0, 0, 0, 0, 0, 112,
587 0, 113, 114, 115, 116, 117, 118, 119, 120, 121,
588 122, 112, 299, 113, 114, 115, 116, 117, 118, 119,
589 120, 121, 122, 112, 0, 113, 114, 115, 116, 117,
590 118, 119, 120, 121, 122, 114, 115, 116, 117, 118,
591 119, 120, 121, 122,
593 short yycheck[] = { 7,
594 0, 261, 4, 5, 6, 7, 8, 298, 10, 58,
595 10, 278, 61, 62, 301, 64, 265, 15, 16, 68,
596 0, 1, 265, 265, 24, 27, 301, 265, 265, 31,
597 301, 298, 40, 265, 220, 296, 297, 265, 40, 301,
598 177, 259, 260, 261, 24, 301, 264, 265, 266, 298,
599 301, 259, 260, 302, 54, 35, 56, 275, 266, 302,
600 302, 259, 260, 63, 302, 302, 301, 69, 66, 69,
601 302, 295, 70, 75, 302, 299, 300, 301, 76, 264,
602 265, 79, 306, 306, 302, 259, 260, 298, 88, 89,
603 264, 265, 266, 306, 302, 308, 96, 97, 98, 99,
604 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
605 90, 91, 249, 250, 251, 263, 116, 117, 118, 119,
606 120, 121, 122, 125, 126, 127, 128, 129, 302, 131,
607 316, 301, 132, 259, 260, 135, 262, 264, 265, 276,
608 299, 300, 301, 123, 144, 145, 42, 306, 148, 259,
609 260, 149, 264, 265, 50, 51, 266, 301, 54, 55,
610 56, 264, 265, 163, 60, 165, 297, 4, 5, 6,
611 306, 8, 172, 264, 265, 175, 287, 177, 259, 260,
612 180, 181, 267, 268, 269, 270, 271, 272, 273, 238,
613 27, 259, 260, 242, 31, 299, 300, 301, 266, 306,
614 200, 201, 202, 203, 259, 260, 261, 259, 260, 264,
615 265, 266, 220, 298, 259, 260, 261, 302, 220, 274,
616 275, 276, 277, 278, 279, 295, 322, 123, 317, 259,
617 260, 261, 259, 260, 264, 265, 266, 264, 265, 266,
618 263, 243, 302, 243, 274, 275, 276, 302, 263, 249,
619 250, 251, 263, 278, 150, 302, 265, 153, 302, 155,
620 265, 265, 262, 266, 290, 291, 292, 263, 301, 269,
621 296, 297, 302, 302, 306, 302, 276, 259, 260, 261,
622 298, 302, 282, 243, 284, 285, 306, 306, 125, 126,
623 127, 128, 129, 256, 131, 259, 260, 261, 261, 306,
624 262, 298, 181, 302, 259, 260, 261, 302, 316, 264,
625 265, 266, 302, 302, 316, 315, 302, 24, 298, 274,
626 275, 276, 277, -1, 287, 288, 289, -1, -1, -1,
627 293, -1, -1, -1, -1, 298, 299, 300, 301, -1,
628 303, 304, 305, 306, -1, 308, 309, 302, -1, 312,
629 313, 314, 315, 259, 260, 261, -1, -1, 264, 265,
630 266, 324, 325, -1, -1, -1, 329, -1, 274, 275,
631 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
632 -1, -1, -1, -1, -1, 256, -1, 283, 259, 260,
633 261, 262, -1, 259, 260, 261, 302, -1, 264, 265,
634 266, -1, 298, 288, 289, 290, 291, 292, -1, 275,
635 -1, 296, 297, -1, -1, -1, 287, 288, 289, -1,
636 -1, -1, 293, -1, 320, 321, -1, 298, 299, 300,
637 301, -1, 303, 304, 305, 306, 302, 308, 309, 310,
638 311, 312, 313, 314, 315, 316, 317, 318, 319, 320,
639 321, -1, 323, -1, -1, 326, 327, 328, 256, -1,
640 -1, 259, 260, 261, 262, -1, 259, 260, 261, -1,
641 -1, 264, 265, 266, 278, 279, 280, 281, 282, 283,
642 284, 285, 275, 280, 281, 282, 283, 284, 285, 287,
643 288, 289, -1, -1, -1, 293, -1, -1, -1, -1,
644 298, 299, 300, 301, -1, 303, 304, 305, 306, 302,
645 308, 309, 310, 311, 312, 313, 314, 315, 316, 317,
646 318, 319, 320, 321, -1, 323, -1, -1, 326, 327,
647 328, 256, -1, -1, 259, 260, 261, -1, -1, 259,
648 260, 261, -1, -1, 264, 265, 266, -1, 267, 268,
649 269, 270, 271, 272, 273, 275, -1, -1, -1, -1,
650 -1, -1, 287, 288, 289, -1, -1, -1, 293, -1,
651 -1, -1, -1, 298, 299, 300, 301, -1, 303, 304,
652 305, 306, 302, 308, 309, 310, 311, 312, 313, 314,
653 315, 316, 317, 318, 319, 320, 321, -1, 323, -1,
654 -1, 326, 327, 328, 256, -1, -1, 259, 260, 261,
655 -1, -1, 259, 260, 261, -1, -1, 264, 265, 266,
656 -1, -1, -1, -1, -1, -1, -1, -1, 275, -1,
657 -1, -1, -1, -1, -1, 287, 288, 289, -1, -1,
658 -1, 293, -1, -1, -1, -1, 298, 299, 300, 301,
659 -1, 303, 304, 305, 306, 302, 308, 309, 310, 311,
660 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
661 -1, 323, -1, -1, 326, 327, 328, 259, 260, 261,
662 -1, 263, 264, 265, 266, 267, 268, 269, 270, 271,
663 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
664 282, 283, 284, 285, -1, 287, 288, 289, 290, 291,
665 292, 293, -1, 295, 296, 297, 298, 299, 300, 301,
666 302, 303, 304, 305, 306, -1, 308, 309, -1, -1,
667 312, 313, 314, 315, 259, 260, 261, -1, 263, 264,
668 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
669 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
670 285, -1, 287, 288, 289, 290, 291, 292, 293, -1,
671 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
672 305, 306, -1, 308, 309, -1, -1, 312, 313, 314,
673 315, 259, 260, 261, -1, 263, 264, 265, 266, 267,
674 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
675 278, 279, 280, 281, 282, 283, 284, 285, -1, 287,
676 288, 289, 290, 291, 292, 293, -1, 295, 296, 297,
677 -1, 299, 300, 301, 302, 303, 304, 305, 306, -1,
678 308, 309, -1, -1, 312, 313, 314, 315, 259, 260,
679 261, -1, 263, 264, 265, 266, 267, 268, 269, 270,
680 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
681 281, 282, 283, 284, 285, -1, 287, 288, 289, 290,
682 291, 292, 293, -1, -1, 296, 297, -1, 299, 300,
683 301, 302, 303, 304, 305, 306, -1, 308, 309, -1,
684 -1, 312, 313, 314, 315, 259, 260, 261, -1, -1,
685 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
686 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
687 284, 285, -1, 287, 288, 289, 290, 291, 292, 293,
688 -1, 295, 296, 297, -1, 299, 300, 301, 302, 303,
689 304, 305, 306, -1, 308, 309, -1, -1, 312, 313,
690 314, 315, 259, 260, 261, -1, -1, 264, 265, 266,
691 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
692 277, 278, 279, 280, 281, 282, 283, 284, 285, -1,
693 287, 288, 289, 290, 291, 292, 293, -1, -1, 296,
694 297, 298, 299, 300, 301, 302, 303, 304, 305, 306,
695 -1, 308, 309, -1, -1, 312, 313, 314, 315, 259,
696 260, 261, -1, -1, 264, 265, 266, 267, 268, 269,
697 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
698 280, 281, 282, 283, 284, 285, -1, 287, 288, 289,
699 290, 291, 292, 293, -1, 295, 296, -1, 298, 299,
700 300, 301, 302, 303, 304, 305, 306, -1, 308, 309,
701 -1, -1, 312, 313, 314, 315, 259, 260, 261, -1,
702 -1, 264, 265, 266, 267, 268, 269, 270, 271, 272,
703 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
704 283, 284, 285, -1, 287, 288, 289, 290, 291, 292,
705 293, -1, 295, 296, 297, -1, 299, 300, 301, 302,
706 303, 304, 305, 306, -1, 308, 309, -1, -1, 312,
707 313, 314, 315, 259, 260, 261, -1, -1, 264, 265,
708 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
709 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
710 -1, 287, 288, 289, 290, 291, 292, 293, -1, 295,
711 -1, -1, 298, 299, 300, 301, 302, 303, 304, 305,
712 306, -1, 308, 309, -1, -1, 312, 313, 314, 315,
713 259, 260, 261, -1, -1, 264, 265, 266, 267, 268,
714 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
715 279, 280, 281, 282, 283, 284, 285, -1, 287, 288,
716 289, 290, 291, 292, 293, -1, 295, -1, -1, 298,
717 299, 300, 301, 302, 303, 304, 305, 306, -1, 308,
718 309, -1, -1, 312, 313, 314, 315, 259, 260, 261,
719 -1, -1, 264, 265, 266, 267, 268, 269, 270, 271,
720 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
721 282, 283, 284, 285, -1, 287, 288, 289, 290, 291,
722 292, 293, -1, 295, -1, -1, 298, 299, 300, 301,
723 302, 303, 304, 305, 306, -1, 308, 309, -1, -1,
724 312, 313, 314, 315, 259, 260, 261, -1, -1, 264,
725 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
726 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
727 285, -1, 287, 288, 289, 290, 291, 292, 293, -1,
728 295, -1, -1, 298, 299, 300, 301, 302, 303, 304,
729 305, 306, -1, 308, 309, -1, -1, 312, 313, 314,
730 315, 259, 260, 261, -1, -1, 264, 265, 266, 267,
731 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
732 278, 279, 280, 281, 282, 283, 284, 285, -1, 287,
733 288, 289, 290, 291, 292, 293, -1, 295, -1, -1,
734 298, 299, 300, 301, 302, 303, 304, 305, 306, -1,
735 308, 309, -1, -1, 312, 313, 314, 315, 259, 260,
736 261, -1, -1, 264, 265, 266, 267, 268, 269, 270,
737 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
738 281, 282, 283, 284, 285, -1, 287, 288, 289, 290,
739 291, 292, 293, -1, 295, -1, -1, 298, 299, 300,
740 301, 302, 303, 304, 305, 306, -1, 308, 309, -1,
741 -1, 312, 313, 314, 315, 259, 260, 261, -1, -1,
742 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
743 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
744 284, 285, -1, 287, 288, 289, 290, 291, 292, 293,
745 -1, 295, -1, -1, 298, 299, 300, 301, 302, 303,
746 304, 305, 306, -1, 308, 309, -1, -1, 312, 313,
747 314, 315, 259, 260, 261, -1, -1, 264, 265, 266,
748 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
749 277, 278, 279, 280, 281, 282, 283, 284, 285, -1,
750 287, 288, 289, 290, 291, 292, 293, -1, -1, 296,
751 297, -1, 299, 300, 301, 302, 303, 304, 305, 306,
752 -1, 308, 309, -1, -1, 312, 313, 314, 315, 259,
753 260, 261, -1, -1, 264, 265, 266, 267, 268, 269,
754 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
755 280, 281, 282, 283, 284, 285, -1, 287, 288, 289,
756 290, 291, 292, 293, -1, 295, 296, 297, 298, -1,
757 -1, -1, 302, 303, 304, 305, -1, -1, 308, 309,
758 -1, -1, 312, 313, 314, 315, 259, 260, 261, -1,
759 -1, 264, 265, 266, 267, 268, 269, 270, 271, 272,
760 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
761 283, 284, 285, -1, 287, 288, 289, 290, 291, 292,
762 293, -1, -1, 296, 297, 298, -1, -1, -1, 302,
763 303, 304, 305, -1, -1, 308, 309, -1, -1, 312,
764 313, 314, 315, 259, 260, 261, -1, -1, 264, 265,
765 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
766 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
767 -1, 287, 288, 289, -1, -1, -1, 293, -1, 295,
768 -1, -1, 298, 299, 300, 301, 302, 303, 304, 305,
769 306, -1, 308, 309, -1, -1, 312, 313, 314, 315,
770 259, 260, 261, -1, -1, 264, 265, 266, 267, 268,
771 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
772 279, 280, 281, 282, 283, 284, 285, -1, 287, 288,
773 289, -1, -1, -1, 293, -1, 295, -1, -1, 298,
774 299, 300, 301, 302, 303, 304, 305, 306, -1, 308,
775 309, -1, -1, 312, 313, 314, 315, 259, 260, 261,
776 -1, -1, 264, 265, 266, -1, -1, -1, -1, -1,
777 -1, -1, 274, 275, 276, 277, 278, 279, 280, 281,
778 282, 283, 284, 285, -1, 287, 288, 289, 290, 291,
779 292, 293, -1, -1, 296, 297, -1, 299, 300, 301,
780 302, 303, 304, 305, 306, -1, 308, 309, -1, -1,
781 312, 313, 314, 315, 259, 260, 261, -1, -1, 264,
782 265, 266, -1, -1, -1, -1, -1, -1, -1, 274,
783 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
784 285, -1, 287, -1, -1, -1, -1, -1, 293, -1,
785 -1, -1, -1, 298, 299, 300, 301, 302, 303, 304,
786 305, 306, -1, 308, 309, -1, -1, 312, 313, 314,
787 315, 259, 260, 261, -1, -1, 264, 265, 266, -1,
788 -1, -1, -1, -1, -1, -1, 274, 275, 276, 277,
789 278, 279, 280, 281, 282, 283, 284, 285, -1, 287,
790 259, 260, -1, -1, -1, 293, -1, -1, -1, -1,
791 298, 299, 300, 301, 302, 303, 304, 305, 306, -1,
792 308, 309, -1, -1, 312, 313, 314, 315, 287, 288,
793 289, -1, -1, -1, 293, -1, -1, -1, -1, 298,
794 299, 300, 301, -1, 303, 304, 305, 306, -1, 308,
795 309, -1, -1, 312, 313, 314, 315, 260, -1, -1,
796 263, -1, -1, -1, 267, 268, 269, 270, 271, 272,
797 273, 274, -1, 276, 277, -1, 279, 280, 281, 282,
798 283, 284, 285, -1, 287, 288, 289, 290, 291, 292,
799 293, 260, -1, 296, 297, -1, 299, 300, 301, -1,
800 303, 304, 305, 306, -1, 308, 309, -1, -1, 312,
801 313, 314, 315, -1, -1, -1, -1, -1, 287, 288,
802 289, 260, -1, -1, 293, -1, -1, -1, -1, 298,
803 299, 300, 301, -1, 303, 304, 305, 306, -1, 308,
804 309, -1, -1, 312, 313, 314, 315, -1, 287, 288,
805 289, -1, -1, -1, 293, -1, -1, -1, -1, 298,
806 299, 300, 301, -1, 303, 304, 305, 306, -1, 308,
807 309, -1, -1, 312, 313, 314, 315, 263, -1, -1,
808 -1, 267, 268, 269, 270, 271, 272, 273, 274, -1,
809 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
810 -1, 287, 288, 289, 290, 291, 292, 293, -1, -1,
811 296, 297, -1, 299, 300, 301, -1, 303, 304, 305,
812 306, 265, 308, 309, -1, -1, 312, 313, 314, 315,
813 274, -1, 276, 277, 278, 279, 280, 281, 282, 283,
814 284, 285, -1, 287, 288, 289, 290, 291, 292, 293,
815 -1, -1, 296, 297, -1, 299, 300, 301, -1, 303,
816 304, 305, 306, -1, 308, 309, -1, -1, 312, 313,
817 314, 315, 259, 260, 261, -1, -1, 264, 265, 266,
818 259, 260, 261, -1, -1, 264, 265, 266, 275, -1,
819 -1, -1, 259, 260, 261, -1, 275, 264, 265, 266,
820 259, 260, 261, -1, -1, 264, 265, 266, 275, -1,
821 -1, -1, 259, 260, 261, 302, 275, 264, 265, 266,
822 259, 260, 261, 302, -1, 264, 265, 266, 275, -1,
823 -1, -1, 259, 260, 261, 302, 275, 264, 265, 266,
824 259, 260, 261, 302, -1, 264, 265, 266, 275, -1,
825 -1, -1, 259, 260, 261, 302, 275, 264, 265, 266,
826 259, 260, 261, 302, -1, 264, 265, 266, 275, -1,
827 -1, -1, -1, 265, -1, 302, 275, -1, -1, -1,
828 -1, -1, 274, 302, 276, 277, 278, 279, 280, 281,
829 282, 283, 284, 285, -1, 302, -1, -1, -1, -1,
830 265, -1, -1, 302, -1, -1, -1, -1, -1, 274,
831 302, 276, 277, 278, 279, 280, 281, 282, 283, 284,
832 285, -1, -1, -1, -1, -1, -1, 265, 267, 268,
833 269, 270, 271, 272, 273, -1, 274, 302, 276, 277,
834 278, 279, 280, 281, 282, 283, 284, 285, -1, -1,
835 -1, -1, -1, -1, 287, 288, 289, -1, -1, 298,
836 293, -1, -1, -1, 302, 298, 299, 300, 301, -1,
837 303, 304, 305, 306, 307, 308, 309, -1, -1, 312,
838 313, 314, 315, 287, 288, 289, -1, -1, -1, 293,
839 -1, -1, -1, -1, 298, 299, 300, 301, 302, 303,
840 304, 305, 306, -1, 308, 309, -1, -1, 312, 313,
841 314, 315, 287, 288, 289, -1, -1, -1, 293, -1,
842 -1, -1, -1, 298, 299, 300, 301, 302, 303, 304,
843 305, 306, -1, 308, 309, -1, -1, 312, 313, 314,
844 315, 287, 288, 289, -1, -1, -1, 293, -1, -1,
845 -1, -1, 298, 299, 300, 301, -1, 303, 304, 305,
846 306, -1, 308, 309, -1, -1, 312, 313, 314, 315,
847 287, 288, 289, -1, -1, -1, 293, -1, -1, -1,
848 -1, 298, 299, 300, 301, -1, 303, 304, 305, 306,
849 -1, 308, 309, -1, -1, 312, 313, 314, 315, 287,
850 288, 289, -1, -1, -1, 293, -1, -1, -1, -1,
851 298, 299, 300, 301, -1, 303, 304, 305, 306, -1,
852 308, 309, -1, -1, 312, 313, 314, 315, 287, 288,
853 289, -1, -1, -1, 293, -1, -1, -1, -1, 298,
854 299, 300, 301, -1, 303, 304, 305, 306, -1, 308,
855 309, -1, -1, 312, 313, 314, 315, 287, 288, 289,
856 -1, -1, -1, 293, -1, -1, -1, -1, 298, 299,
857 300, 301, -1, 303, 304, 305, 306, -1, 308, 309,
858 -1, -1, 312, 313, 314, 315, 274, -1, 276, 277,
859 278, 279, 280, 281, 282, 283, 284, 285, 274, -1,
860 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
861 -1, -1, -1, 274, 302, 276, 277, 278, 279, 280,
862 281, 282, 283, 284, 285, 274, 302, 276, 277, 278,
863 279, 280, 281, 282, 283, 284, 285, -1, -1, -1,
864 274, 302, 276, 277, 278, 279, 280, 281, 282, 283,
865 284, 285, 274, 302, 276, 277, 278, 279, 280, 281,
866 282, 283, 284, 285, 259, 260, -1, -1, 302, -1,
867 -1, -1, -1, -1, -1, -1, -1, 260, -1, 274,
868 302, 276, 277, 278, 279, 280, 281, 282, 283, 284,
869 285, 274, 260, 276, 277, 278, 279, 280, 281, 282,
870 283, 284, 285, -1, -1, -1, 274, -1, 276, 277,
871 278, 279, 280, 281, 282, 283, 284, 285, 265, -1,
872 -1, -1, -1, -1, -1, -1, -1, 274, -1, 276,
873 277, 278, 279, 280, 281, 282, 283, 284, 285, 265,
874 -1, -1, -1, -1, -1, -1, -1, -1, 274, -1,
875 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
876 265, -1, -1, -1, -1, -1, -1, -1, -1, 274,
877 -1, 276, 277, 278, 279, 280, 281, 282, 283, 284,
878 285, 274, 275, 276, 277, 278, 279, 280, 281, 282,
879 283, 284, 285, 274, -1, 276, 277, 278, 279, 280,
880 281, 282, 283, 284, 285, 277, 278, 279, 280, 281,
881 282, 283, 284, 285,
883 #define YYFINAL 24
884 #ifndef YYDEBUG
885 #define YYDEBUG 0
886 #endif
887 #define YYMAXTOKEN 329
888 #if YYDEBUG
889 char *yyname[] = {
890 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
891 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
892 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
893 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
894 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
895 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
896 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"UNEXPECTED","BAD_DECIMAL","NL",
897 "SEMI_COLON","LBRACE","RBRACE","LBOX","RBOX","COMMA","IO_OUT","ASSIGN",
898 "ADD_ASG","SUB_ASG","MUL_ASG","DIV_ASG","MOD_ASG","POW_ASG","QMARK","COLON",
899 "OR","AND","IN","MATCH","EQ","NEQ","LT","LTE","GT","GTE","CAT","GETLINE","PLUS",
900 "MINUS","MUL","DIV","MOD","NOT","UMINUS","IO_IN","PIPE","POW","INC_or_DEC",
901 "DOLLAR","FIELD","LPAREN","RPAREN","DOUBLE","STRING_","RE","ID","D_ID",
902 "FUNCT_ID","BUILTIN","PRINT","PRINTF","SPLIT","MATCH_FUNC","SUB","GSUB","DO",
903 "WHILE","FOR","BREAK","CONTINUE","IF","ELSE","DELETE","BEGIN","END","EXIT",
904 "NEXT","RETURN","FUNCTION",
906 char *yyrule[] = {
907 "$accept : program",
908 "program : program_block",
909 "program : program program_block",
910 "program_block : PA_block",
911 "program_block : function_def",
912 "program_block : error block",
913 "PA_block : block",
914 "$$1 :",
915 "PA_block : BEGIN $$1 block",
916 "$$2 :",
917 "PA_block : END $$2 block",
918 "$$3 :",
919 "PA_block : expr $$3 block_or_separator",
920 "$$4 :",
921 "$$5 :",
922 "PA_block : expr COMMA $$4 expr $$5 block_or_separator",
923 "block : LBRACE statement_list RBRACE",
924 "block : LBRACE error RBRACE",
925 "block_or_separator : block",
926 "block_or_separator : separator",
927 "statement_list : statement",
928 "statement_list : statement_list statement",
929 "statement : block",
930 "statement : expr separator",
931 "statement : separator",
932 "statement : error separator",
933 "statement : BREAK separator",
934 "statement : CONTINUE separator",
935 "statement : return_statement",
936 "statement : NEXT separator",
937 "separator : NL",
938 "separator : SEMI_COLON",
939 "expr : cat_expr",
940 "expr : lvalue ASSIGN expr",
941 "expr : lvalue ADD_ASG expr",
942 "expr : lvalue SUB_ASG expr",
943 "expr : lvalue MUL_ASG expr",
944 "expr : lvalue DIV_ASG expr",
945 "expr : lvalue MOD_ASG expr",
946 "expr : lvalue POW_ASG expr",
947 "expr : expr EQ expr",
948 "expr : expr NEQ expr",
949 "expr : expr LT expr",
950 "expr : expr LTE expr",
951 "expr : expr GT expr",
952 "expr : expr GTE expr",
953 "expr : expr MATCH expr",
954 "$$6 :",
955 "expr : expr OR $$6 expr",
956 "$$7 :",
957 "expr : expr AND $$7 expr",
958 "$$8 :",
959 "$$9 :",
960 "expr : expr QMARK $$8 expr COLON $$9 expr",
961 "cat_expr : p_expr",
962 "cat_expr : cat_expr p_expr",
963 "p_expr : DOUBLE",
964 "p_expr : STRING_",
965 "p_expr : ID",
966 "p_expr : LPAREN expr RPAREN",
967 "p_expr : RE",
968 "p_expr : p_expr PLUS p_expr",
969 "p_expr : p_expr MINUS p_expr",
970 "p_expr : p_expr MUL p_expr",
971 "p_expr : p_expr DIV p_expr",
972 "p_expr : p_expr MOD p_expr",
973 "p_expr : p_expr POW p_expr",
974 "p_expr : NOT p_expr",
975 "p_expr : PLUS p_expr",
976 "p_expr : MINUS p_expr",
977 "p_expr : builtin",
978 "p_expr : ID INC_or_DEC",
979 "p_expr : INC_or_DEC lvalue",
980 "p_expr : field INC_or_DEC",
981 "p_expr : INC_or_DEC field",
982 "lvalue : ID",
983 "arglist :",
984 "arglist : args",
985 "args : expr",
986 "args : args COMMA expr",
987 "builtin : BUILTIN mark LPAREN arglist RPAREN",
988 "mark :",
989 "statement : print mark pr_args pr_direction separator",
990 "print : PRINT",
991 "print : PRINTF",
992 "pr_args : arglist",
993 "pr_args : LPAREN arg2 RPAREN",
994 "pr_args : LPAREN RPAREN",
995 "arg2 : expr COMMA expr",
996 "arg2 : arg2 COMMA expr",
997 "pr_direction :",
998 "pr_direction : IO_OUT expr",
999 "if_front : IF LPAREN expr RPAREN",
1000 "statement : if_front statement",
1001 "else : ELSE",
1002 "statement : if_front statement else statement",
1003 "do : DO",
1004 "statement : do statement WHILE LPAREN expr RPAREN separator",
1005 "while_front : WHILE LPAREN expr RPAREN",
1006 "statement : while_front statement",
1007 "statement : for1 for2 for3 statement",
1008 "for1 : FOR LPAREN SEMI_COLON",
1009 "for1 : FOR LPAREN expr SEMI_COLON",
1010 "for2 : SEMI_COLON",
1011 "for2 : expr SEMI_COLON",
1012 "for3 : RPAREN",
1013 "for3 : expr RPAREN",
1014 "expr : expr IN ID",
1015 "expr : LPAREN arg2 RPAREN IN ID",
1016 "lvalue : ID mark LBOX args RBOX",
1017 "p_expr : ID mark LBOX args RBOX",
1018 "p_expr : ID mark LBOX args RBOX INC_or_DEC",
1019 "statement : DELETE ID mark LBOX args RBOX separator",
1020 "array_loop_front : FOR LPAREN ID IN ID RPAREN",
1021 "statement : array_loop_front statement",
1022 "field : FIELD",
1023 "field : DOLLAR D_ID",
1024 "field : DOLLAR D_ID mark LBOX args RBOX",
1025 "field : DOLLAR p_expr",
1026 "field : LPAREN field RPAREN",
1027 "p_expr : field",
1028 "expr : field ASSIGN expr",
1029 "expr : field ADD_ASG expr",
1030 "expr : field SUB_ASG expr",
1031 "expr : field MUL_ASG expr",
1032 "expr : field DIV_ASG expr",
1033 "expr : field MOD_ASG expr",
1034 "expr : field POW_ASG expr",
1035 "p_expr : split_front split_back",
1036 "split_front : SPLIT LPAREN expr COMMA ID",
1037 "split_back : RPAREN",
1038 "split_back : COMMA expr RPAREN",
1039 "p_expr : MATCH_FUNC LPAREN expr COMMA re_arg RPAREN",
1040 "re_arg : expr",
1041 "statement : EXIT separator",
1042 "statement : EXIT expr separator",
1043 "return_statement : RETURN separator",
1044 "return_statement : RETURN expr separator",
1045 "p_expr : getline",
1046 "p_expr : getline fvalue",
1047 "p_expr : getline_file p_expr",
1048 "p_expr : p_expr PIPE GETLINE",
1049 "p_expr : p_expr PIPE GETLINE fvalue",
1050 "getline : GETLINE",
1051 "fvalue : lvalue",
1052 "fvalue : field",
1053 "getline_file : getline IO_IN",
1054 "getline_file : getline fvalue IO_IN",
1055 "p_expr : sub_or_gsub LPAREN re_arg COMMA expr sub_back",
1056 "sub_or_gsub : SUB",
1057 "sub_or_gsub : GSUB",
1058 "sub_back : RPAREN",
1059 "sub_back : COMMA fvalue RPAREN",
1060 "function_def : funct_start block",
1061 "funct_start : funct_head LPAREN f_arglist RPAREN",
1062 "funct_head : FUNCTION ID",
1063 "funct_head : FUNCTION FUNCT_ID",
1064 "f_arglist :",
1065 "f_arglist : f_args",
1066 "f_args : ID",
1067 "f_args : f_args COMMA ID",
1068 "p_expr : FUNCT_ID mark call_args",
1069 "call_args : LPAREN RPAREN",
1070 "call_args : ca_front ca_back",
1071 "ca_front : LPAREN",
1072 "ca_front : ca_front expr COMMA",
1073 "ca_front : ca_front ID COMMA",
1074 "ca_back : expr RPAREN",
1075 "ca_back : ID RPAREN",
1077 #endif
1078 #ifdef YYPURE
1079 #undef YYGLOBAL
1080 #define YYLEX() yylex(&yylval)
1081 #else
1082 #define YYLEX() yylex()
1083 #endif
1085 #define yyclearin (yychar=(-1))
1086 #define yyerrok (yyerrflag=0)
1087 #ifdef YYSTACKSIZE
1088 #ifndef YYMAXDEPTH
1089 #define YYMAXDEPTH YYSTACKSIZE
1090 #endif
1091 #else
1092 #ifdef YYMAXDEPTH
1093 #define YYSTACKSIZE YYMAXDEPTH
1094 #else
1095 #define YYSTACKSIZE 500
1096 #define YYMAXDEPTH 500
1097 #endif
1098 #endif
1099 int yydebug;
1100 #ifndef YYPURE
1101 YYSTYPE yylval;
1102 #endif
1104 #ifdef YYGLOBAL
1105 int yynerrs;
1106 int yyerrflag;
1107 int yychar;
1108 short *yyssp;
1109 YYSTYPE *yyvsp;
1110 YYSTYPE yyval;
1111 short yyss[YYSTACKSIZE];
1112 YYSTYPE yyvs[YYSTACKSIZE];
1113 #endif
1114 #define yystacksize YYSTACKSIZE
1115 #line 1041 "parse.y"
1117 /* resize the code for a user function */
1119 static void resize_fblock( fbp, code_ptr )
1120 FBLOCK *fbp ;
1121 INST *code_ptr ;
1122 { int size ;
1124 code1(_RET0) ; /* make sure there is always a return statement */
1126 #if !SM_DOS
1127 if ( dump_code )
1128 { code1(_HALT) ; /*stops da() */
1129 add_to_fdump_list(fbp) ;
1131 #endif
1133 if ( (size = code_ptr - fbp->code) > PAGE_SZ-1 )
1134 overflow("function code size", PAGE_SZ ) ;
1136 /* resize the code */
1137 fbp->code = (INST*) zrealloc(fbp->code, PAGE_SZ*sizeof(INST),
1138 size * sizeof(INST) ) ;
1143 /* convert FE_PUSHA to FE_PUSHI
1144 or F_PUSH to F_PUSHI
1147 static void field_A2I()
1148 { CELL *cp ;
1150 if ( code_ptr[-1].op == FE_PUSHA &&
1151 code_ptr[-1].ptr == (PTR) 0)
1152 /* On most architectures, the two tests are the same; a good
1153 compiler might eliminate one. On LM_DOS, and possibly other
1154 segmented architectures, they are not */
1155 { code_ptr[-1].op = FE_PUSHI ; }
1156 else
1158 cp = (CELL *) code_ptr[-1].ptr ;
1160 if ( cp == field ||
1162 #if LM_DOS
1163 SAMESEG(cp,field) &&
1164 #endif
1165 cp > NF && cp <= LAST_PFIELD )
1167 code_ptr[-2].op = _PUSHI ;
1169 else if ( cp == NF )
1170 { code_ptr[-2].op = NF_PUSHI ; code_ptr-- ; }
1172 else
1174 code_ptr[-2].op = F_PUSHI ;
1175 code_ptr -> op = field_addr_to_index( code_ptr[-1].ptr ) ;
1176 code_ptr++ ;
1181 /* we've seen an ID in a context where it should be a VAR,
1182 check that's consistent with previous usage */
1184 static void check_var( p )
1185 register SYMTAB *p ;
1187 switch(p->type)
1189 case ST_NONE : /* new id */
1190 p->type = ST_VAR ;
1191 p->stval.cp = new_CELL() ;
1192 p->stval.cp->type = C_NOINIT ;
1193 break ;
1195 case ST_LOCAL_NONE :
1196 p->type = ST_LOCAL_VAR ;
1197 active_funct->typev[p->offset] = ST_LOCAL_VAR ;
1198 break ;
1200 case ST_VAR :
1201 case ST_LOCAL_VAR : break ;
1203 default :
1204 type_error(p) ;
1205 break ;
1209 /* we've seen an ID in a context where it should be an ARRAY,
1210 check that's consistent with previous usage */
1211 static void check_array(p)
1212 register SYMTAB *p ;
1214 switch(p->type)
1216 case ST_NONE : /* a new array */
1217 p->type = ST_ARRAY ;
1218 p->stval.array = new_ARRAY() ;
1219 break ;
1221 case ST_ARRAY :
1222 case ST_LOCAL_ARRAY :
1223 break ;
1225 case ST_LOCAL_NONE :
1226 p->type = ST_LOCAL_ARRAY ;
1227 active_funct->typev[p->offset] = ST_LOCAL_ARRAY ;
1228 break ;
1230 default : type_error(p) ; break ;
1234 static void code_array(p)
1235 register SYMTAB *p ;
1236 { if ( is_local(p) )
1237 { code1(LA_PUSHA) ; code1(p->offset) ; }
1238 else code2(A_PUSHA, p->stval.array) ;
1242 static int current_offset()
1244 switch( scope )
1246 case SCOPE_MAIN : return code_ptr - main_start ;
1247 case SCOPE_BEGIN : return code_ptr - begin_code.start ;
1248 case SCOPE_END : return code_ptr - end_code.start ;
1249 case SCOPE_FUNCT : return code_ptr - active_funct->code ;
1251 /* can't get here */
1252 return 0 ;
1255 /* we've seen an ID as an argument to a user defined function */
1257 static void code_call_id( p, ip )
1258 register CA_REC *p ;
1259 register SYMTAB *ip ;
1260 { static CELL dummy ;
1262 switch( ip->type )
1264 case ST_VAR :
1265 p->type = CA_EXPR ;
1266 code2(_PUSHI, ip->stval.cp) ;
1267 break ;
1269 case ST_LOCAL_VAR :
1270 p->type = CA_EXPR ;
1271 code1(L_PUSHI) ;
1272 code1(ip->offset) ;
1273 break ;
1275 case ST_ARRAY :
1276 p->type = CA_ARRAY ;
1277 code2(A_PUSHA, ip->stval.array) ;
1278 break ;
1280 case ST_LOCAL_ARRAY :
1281 p->type = CA_ARRAY ;
1282 code1(LA_PUSHA) ;
1283 code1(ip->offset) ;
1284 break ;
1286 /* not enough info to code it now; it will have to
1287 be patched later */
1289 case ST_NONE :
1290 p->type = ST_NONE ;
1291 p->call_offset = current_offset() ;
1292 p->sym_p = ip ;
1293 code2(_PUSHI, &dummy) ;
1294 break ;
1296 case ST_LOCAL_NONE :
1297 p->type = ST_LOCAL_NONE ;
1298 p->call_offset = current_offset() ;
1299 p->type_p = & active_funct->typev[ip->offset] ;
1300 code1(L_PUSHI) ;
1301 code1(ip->offset) ;
1302 break ;
1305 #ifdef DEBUG
1306 default :
1307 bozo("code_call_id") ;
1308 #endif
1313 /* an RE by itself was coded as _MATCH0 , change to
1314 push as an expression */
1316 static void RE_as_arg()
1317 { CELL *cp = ZMALLOC(CELL) ;
1319 code_ptr -= 2 ;
1320 cp->type = C_RE ;
1321 cp->ptr = code_ptr[1].ptr ;
1322 code2(_PUSHC, cp) ;
1326 int parse()
1327 { int yy = yyparse() ;
1329 #if YYBYACC
1330 extern struct yacc_mem *yacc_memp ;
1332 yacc_memp++ ; /* puts parser tables in mem pool */
1333 #endif
1335 if ( resolve_list ) resolve_fcalls() ;
1336 return yy ;
1339 #line 1340 "y.tab.c"
1340 #define YYABORT goto yyabort
1341 #define YYACCEPT goto yyaccept
1342 #define YYERROR goto yyerrlab
1344 yyparse()
1346 register int yyn, yystate;
1347 int yym ;
1348 #ifdef YYPURE
1349 YYSTYPE yylval ;
1350 #endif
1352 #ifndef YYGLOBAL
1353 int yynerrs;
1354 int yyerrflag;
1355 int yychar;
1356 register short *yyssp;
1357 register YYSTYPE *yyvsp;
1358 YYSTYPE yyval;
1359 short yyss[YYSTACKSIZE];
1360 YYSTYPE yyvs[YYSTACKSIZE];
1361 #endif
1362 #if YYDEBUG
1363 register char *yys;
1364 extern char *getenv();
1366 if (yys = getenv("YYDEBUG"))
1368 yyn = *yys;
1369 if (yyn >= '0' && yyn <= '9')
1370 yydebug = yyn - '0';
1372 #endif
1374 yynerrs = 0;
1375 yyerrflag = 0;
1376 yychar = (-1);
1378 yyssp = yyss;
1379 yyvsp = yyvs;
1380 *yyssp = yystate = 0;
1382 yyloop:
1383 if (yyn = yydefred[yystate]) goto yyreduce;
1384 if (yychar < 0)
1386 if ((yychar = YYLEX()) < 0) yychar = 0;
1387 #if YYDEBUG
1388 if (yydebug)
1390 yys = 0;
1391 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1392 if (!yys) yys = "illegal-symbol";
1393 printf("yydebug: state %d, reading %d (%s)\n", yystate,
1394 yychar, yys);
1396 #endif
1398 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
1399 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
1401 #if YYDEBUG
1402 if (yydebug)
1403 printf("yydebug: state %d, shifting to state %d\n",
1404 yystate, yytable[yyn]);
1405 #endif
1406 if (yyssp >= yyss + yystacksize - 1)
1408 goto yyoverflow;
1410 *++yyssp = yystate = yytable[yyn];
1411 *++yyvsp = yylval;
1412 yychar = (-1);
1413 if (yyerrflag > 0) --yyerrflag;
1414 goto yyloop;
1416 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
1417 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
1419 yyn = yytable[yyn];
1420 goto yyreduce;
1422 if (yyerrflag) goto yyinrecovery;
1423 #ifdef lint
1424 goto yynewerror;
1425 #endif
1426 yynewerror:
1427 yyerror("syntax error");
1428 #ifdef lint
1429 goto yyerrlab;
1430 #endif
1431 yyerrlab:
1432 ++yynerrs;
1433 yyinrecovery:
1434 if (yyerrflag < 3)
1436 yyerrflag = 3;
1437 for (;;)
1439 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
1440 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
1442 #if YYDEBUG
1443 if (yydebug)
1444 printf("yydebug: state %d, error recovery shifting\
1445 to state %d\n", *yyssp, yytable[yyn]);
1446 #endif
1447 if (yyssp >= yyss + yystacksize - 1)
1449 goto yyoverflow;
1451 *++yyssp = yystate = yytable[yyn];
1452 *++yyvsp = yylval;
1453 goto yyloop;
1455 else
1457 #if YYDEBUG
1458 if (yydebug)
1459 printf("yydebug: error recovery discarding state %d\n",
1460 *yyssp);
1461 #endif
1462 if (yyssp <= yyss) goto yyabort;
1463 --yyssp;
1464 --yyvsp;
1468 else
1470 if (yychar == 0) goto yyabort;
1471 #if YYDEBUG
1472 if (yydebug)
1474 yys = 0;
1475 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1476 if (!yys) yys = "illegal-symbol";
1477 printf("yydebug: state %d, error recovery discards token %d (%s)\n",
1478 yystate, yychar, yys);
1480 #endif
1481 yychar = (-1);
1482 goto yyloop;
1484 yyreduce:
1485 #if YYDEBUG
1486 if (yydebug)
1487 printf("yydebug: state %d, reducing by rule %d (%s)\n",
1488 yystate, yyn, yyrule[yyn]);
1489 #endif
1490 yym = yylen[yyn];
1491 yyval = yyvsp[1-yym];
1492 switch (yyn)
1494 case 5:
1495 #line 150 "parse.y"
1496 { if (scope == SCOPE_FUNCT)
1497 { restore_ids() ; scope = SCOPE_MAIN ; }
1498 code_ptr = main_code_ptr ;
1500 break;
1501 case 6:
1502 #line 157 "parse.y"
1503 { /* this do nothing action removes a vacuous warning
1504 from Bison */
1506 break;
1507 case 7:
1508 #line 162 "parse.y"
1510 be_expand(&begin_code) ;
1511 scope = SCOPE_BEGIN ;
1513 break;
1514 case 8:
1515 #line 168 "parse.y"
1516 { be_shrink(&begin_code) ;
1517 scope = SCOPE_MAIN ;
1519 break;
1520 case 9:
1521 #line 173 "parse.y"
1523 be_expand(&end_code) ;
1524 scope = SCOPE_END ;
1526 break;
1527 case 10:
1528 #line 179 "parse.y"
1529 { be_shrink(&end_code) ;
1530 scope = SCOPE_MAIN ;
1532 break;
1533 case 11:
1534 #line 184 "parse.y"
1535 { code_jmp(_JZ, (INST*)0) ; }
1536 break;
1537 case 12:
1538 #line 187 "parse.y"
1539 { patch_jmp( code_ptr ) ; }
1540 break;
1541 case 13:
1542 #line 191 "parse.y"
1543 { code_push(yyvsp[-1].start, code_ptr - yyvsp[-1].start) ;
1544 code_ptr = yyvsp[-1].start ;
1545 code1(_RANGE) ; code1(1) ;
1546 code_ptr += 3 ;
1547 code_ptr += code_pop(code_ptr) ;
1548 code1(_STOP) ;
1549 yyvsp[-1].start[2].op = code_ptr - (yyvsp[-1].start+1) ;
1551 break;
1552 case 14:
1553 #line 200 "parse.y"
1554 { code1(_STOP) ; }
1555 break;
1556 case 15:
1557 #line 203 "parse.y"
1558 { yyvsp[-5].start[3].op = yyvsp[0].start - (yyvsp[-5].start+1) ;
1559 yyvsp[-5].start[4].op = code_ptr - (yyvsp[-5].start+1) ;
1561 break;
1562 case 16:
1563 #line 211 "parse.y"
1564 { yyval.start = yyvsp[-1].start ; }
1565 break;
1566 case 17:
1567 #line 213 "parse.y"
1568 { yyval.start = code_ptr ; /* does nothing won't be executed */
1569 print_flag = getline_flag = paren_cnt = 0 ;
1570 yyerrok ; }
1571 break;
1572 case 19:
1573 #line 220 "parse.y"
1574 { yyval.start = code_ptr ;
1575 code1(_PUSHINT) ; code1(0) ;
1576 code2(_PRINT, bi_print) ;
1578 break;
1579 case 23:
1580 #line 232 "parse.y"
1581 { code1(_POP) ; }
1582 break;
1583 case 24:
1584 #line 234 "parse.y"
1585 { yyval.start = code_ptr ; }
1586 break;
1587 case 25:
1588 #line 236 "parse.y"
1589 { yyval.start = code_ptr ;
1590 print_flag = getline_flag = 0 ;
1591 paren_cnt = 0 ;
1592 yyerrok ;
1594 break;
1595 case 26:
1596 #line 242 "parse.y"
1597 { yyval.start = code_ptr ; BC_insert('B', code_ptr+1) ;
1598 code2(_JMP, 0) /* don't use code_jmp ! */ ; }
1599 break;
1600 case 27:
1601 #line 245 "parse.y"
1602 { yyval.start = code_ptr ; BC_insert('C', code_ptr+1) ;
1603 code2(_JMP, 0) ; }
1604 break;
1605 case 28:
1606 #line 248 "parse.y"
1607 { if ( scope != SCOPE_FUNCT )
1608 compile_error("return outside function body") ;
1610 break;
1611 case 29:
1612 #line 252 "parse.y"
1613 { if ( scope != SCOPE_MAIN )
1614 compile_error( "improper use of next" ) ;
1615 yyval.start = code_ptr ;
1616 code1(_NEXT) ;
1618 break;
1619 case 33:
1620 #line 263 "parse.y"
1621 { code1(_ASSIGN) ; }
1622 break;
1623 case 34:
1624 #line 264 "parse.y"
1625 { code1(_ADD_ASG) ; }
1626 break;
1627 case 35:
1628 #line 265 "parse.y"
1629 { code1(_SUB_ASG) ; }
1630 break;
1631 case 36:
1632 #line 266 "parse.y"
1633 { code1(_MUL_ASG) ; }
1634 break;
1635 case 37:
1636 #line 267 "parse.y"
1637 { code1(_DIV_ASG) ; }
1638 break;
1639 case 38:
1640 #line 268 "parse.y"
1641 { code1(_MOD_ASG) ; }
1642 break;
1643 case 39:
1644 #line 269 "parse.y"
1645 { code1(_POW_ASG) ; }
1646 break;
1647 case 40:
1648 #line 270 "parse.y"
1649 { code1(_EQ) ; }
1650 break;
1651 case 41:
1652 #line 271 "parse.y"
1653 { code1(_NEQ) ; }
1654 break;
1655 case 42:
1656 #line 272 "parse.y"
1657 { code1(_LT) ; }
1658 break;
1659 case 43:
1660 #line 273 "parse.y"
1661 { code1(_LTE) ; }
1662 break;
1663 case 44:
1664 #line 274 "parse.y"
1665 { code1(_GT) ; }
1666 break;
1667 case 45:
1668 #line 275 "parse.y"
1669 { code1(_GTE) ; }
1670 break;
1671 case 46:
1672 #line 278 "parse.y"
1674 if ( yyvsp[0].start == code_ptr - 2 )
1676 if ( yyvsp[0].start->op == _MATCH0 ) yyvsp[0].start->op = _MATCH1 ;
1678 else /* check for string */
1679 if ( yyvsp[0].start->op == _PUSHS )
1680 { CELL *cp = ZMALLOC(CELL) ;
1682 cp->type = C_STRING ;
1683 cp->ptr = yyvsp[0].start[1].ptr ;
1684 cast_to_RE(cp) ;
1685 code_ptr -= 2 ;
1686 code2(_MATCH1, cp->ptr) ;
1687 ZFREE(cp) ;
1689 else code1(_MATCH2) ;
1691 else code1(_MATCH2) ;
1693 if ( !yyvsp[-1].ival ) code1(_NOT) ;
1695 break;
1696 case 47:
1697 #line 303 "parse.y"
1698 { code1(_DUP) ;
1699 code_jmp(_JNZ, (INST*)0) ;
1700 code1(_POP) ;
1702 break;
1703 case 48:
1704 #line 308 "parse.y"
1705 { patch_jmp(code_ptr) ; code1(_TEST) ; }
1706 break;
1707 case 49:
1708 #line 311 "parse.y"
1709 { code1(_DUP) ; code_jmp(_JZ, (INST*)0) ;
1710 code1(_POP) ; }
1711 break;
1712 case 50:
1713 #line 314 "parse.y"
1714 { patch_jmp(code_ptr) ; code1(_TEST) ; }
1715 break;
1716 case 51:
1717 #line 316 "parse.y"
1718 { code_jmp(_JZ, (INST*)0) ; }
1719 break;
1720 case 52:
1721 #line 317 "parse.y"
1722 { code_jmp(_JMP, (INST*)0) ; }
1723 break;
1724 case 53:
1725 #line 319 "parse.y"
1726 { patch_jmp(code_ptr) ; patch_jmp(yyvsp[0].start) ; }
1727 break;
1728 case 55:
1729 #line 324 "parse.y"
1730 { code1(_CAT) ; }
1731 break;
1732 case 56:
1733 #line 328 "parse.y"
1734 { yyval.start = code_ptr ; code2(_PUSHD, yyvsp[0].ptr) ; }
1735 break;
1736 case 57:
1737 #line 330 "parse.y"
1738 { yyval.start = code_ptr ; code2(_PUSHS, yyvsp[0].ptr) ; }
1739 break;
1740 case 58:
1741 #line 332 "parse.y"
1742 { check_var(yyvsp[0].stp) ;
1743 yyval.start = code_ptr ;
1744 if ( is_local(yyvsp[0].stp) )
1745 { code1(L_PUSHI) ; code1(yyvsp[0].stp->offset) ; }
1746 else code2(_PUSHI, yyvsp[0].stp->stval.cp) ;
1748 break;
1749 case 59:
1750 #line 340 "parse.y"
1751 { yyval.start = yyvsp[-1].start ; }
1752 break;
1753 case 60:
1754 #line 344 "parse.y"
1755 { yyval.start = code_ptr ; code2(_MATCH0, yyvsp[0].ptr) ; }
1756 break;
1757 case 61:
1758 #line 347 "parse.y"
1759 { code1(_ADD) ; }
1760 break;
1761 case 62:
1762 #line 348 "parse.y"
1763 { code1(_SUB) ; }
1764 break;
1765 case 63:
1766 #line 349 "parse.y"
1767 { code1(_MUL) ; }
1768 break;
1769 case 64:
1770 #line 350 "parse.y"
1771 { code1(_DIV) ; }
1772 break;
1773 case 65:
1774 #line 351 "parse.y"
1775 { code1(_MOD) ; }
1776 break;
1777 case 66:
1778 #line 352 "parse.y"
1779 { code1(_POW) ; }
1780 break;
1781 case 67:
1782 #line 354 "parse.y"
1783 { yyval.start = yyvsp[0].start ; code1(_NOT) ; }
1784 break;
1785 case 68:
1786 #line 356 "parse.y"
1787 { yyval.start = yyvsp[0].start ; code1(_UPLUS) ; }
1788 break;
1789 case 69:
1790 #line 358 "parse.y"
1791 { yyval.start = yyvsp[0].start ; code1(_UMINUS) ; }
1792 break;
1793 case 71:
1794 #line 363 "parse.y"
1795 { check_var(yyvsp[-1].stp) ;
1796 yyval.start = code_ptr ;
1797 code_address(yyvsp[-1].stp) ;
1799 if ( yyvsp[0].ival == '+' ) code1(_POST_INC) ;
1800 else code1(_POST_DEC) ;
1802 break;
1803 case 72:
1804 #line 371 "parse.y"
1805 { yyval.start = yyvsp[0].start ;
1806 if ( yyvsp[-1].ival == '+' ) code1(_PRE_INC) ;
1807 else code1(_PRE_DEC) ;
1809 break;
1810 case 73:
1811 #line 378 "parse.y"
1812 { if (yyvsp[0].ival == '+' ) code1(F_POST_INC ) ;
1813 else code1(F_POST_DEC) ;
1815 break;
1816 case 74:
1817 #line 382 "parse.y"
1818 { yyval.start = yyvsp[0].start ;
1819 if ( yyvsp[-1].ival == '+' ) code1(F_PRE_INC) ;
1820 else code1( F_PRE_DEC) ;
1822 break;
1823 case 75:
1824 #line 389 "parse.y"
1825 { yyval.start = code_ptr ;
1826 check_var(yyvsp[0].stp) ;
1827 code_address(yyvsp[0].stp) ;
1829 break;
1830 case 76:
1831 #line 397 "parse.y"
1832 { yyval.ival = 0 ; }
1833 break;
1834 case 78:
1835 #line 402 "parse.y"
1836 { yyval.ival = 1 ; }
1837 break;
1838 case 79:
1839 #line 404 "parse.y"
1840 { yyval.ival = yyvsp[-2].ival + 1 ; }
1841 break;
1842 case 80:
1843 #line 409 "parse.y"
1844 { BI_REC *p = yyvsp[-4].bip ;
1845 yyval.start = yyvsp[-3].start ;
1846 if ( p-> min_args > yyvsp[-1].ival || p->max_args < yyvsp[-1].ival )
1847 compile_error(
1848 "wrong number of arguments in call to %s" ,
1849 p->name ) ;
1850 if ( p->min_args != p->max_args ) /* variable args */
1851 { code1(_PUSHINT) ; code1(yyvsp[-1].ival) ; }
1852 code2(_BUILTIN , p->fp) ;
1854 break;
1855 case 81:
1856 #line 423 "parse.y"
1857 { yyval.start = code_ptr ; }
1858 break;
1859 case 82:
1860 #line 427 "parse.y"
1861 { code2(_PRINT, yyvsp[-4].fp) ; yyval.start = yyvsp[-3].start ;
1862 if ( yyvsp[-4].fp == bi_printf && yyvsp[-2].ival == 0 )
1863 compile_error("no arguments in call to printf") ;
1864 print_flag = 0 ;
1865 yyval.start = yyvsp[-3].start ;
1867 break;
1868 case 83:
1869 #line 435 "parse.y"
1870 { yyval.fp = bi_print ; print_flag = 1 ;}
1871 break;
1872 case 84:
1873 #line 436 "parse.y"
1874 { yyval.fp = bi_printf ; print_flag = 1 ; }
1875 break;
1876 case 85:
1877 #line 439 "parse.y"
1878 { code1(_PUSHINT) ; code1(yyvsp[0].ival) ; }
1879 break;
1880 case 86:
1881 #line 441 "parse.y"
1882 { yyval.ival = yyvsp[-1].arg2p->cnt ; zfree(yyvsp[-1].arg2p,sizeof(ARG2_REC)) ;
1883 code1(_PUSHINT) ; code1(yyval.ival) ;
1885 break;
1886 case 87:
1887 #line 445 "parse.y"
1888 { yyval.ival=0 ; code1(_PUSHINT) ; code1(0) ; }
1889 break;
1890 case 88:
1891 #line 449 "parse.y"
1892 { yyval.arg2p = (ARG2_REC*) zmalloc(sizeof(ARG2_REC)) ;
1893 yyval.arg2p->start = yyvsp[-2].start ;
1894 yyval.arg2p->cnt = 2 ;
1896 break;
1897 case 89:
1898 #line 454 "parse.y"
1899 { yyval.arg2p = yyvsp[-2].arg2p ; yyval.arg2p->cnt++ ; }
1900 break;
1901 case 91:
1902 #line 459 "parse.y"
1903 { code1(_PUSHINT) ; code1(yyvsp[-1].ival) ; }
1904 break;
1905 case 92:
1906 #line 466 "parse.y"
1907 { yyval.start = yyvsp[-1].start ; eat_nl() ; code_jmp(_JZ, (INST*)0) ; }
1908 break;
1909 case 93:
1910 #line 471 "parse.y"
1911 { patch_jmp( code_ptr ) ; }
1912 break;
1913 case 94:
1914 #line 474 "parse.y"
1915 { eat_nl() ; code_jmp(_JMP, (INST*)0) ; }
1916 break;
1917 case 95:
1918 #line 479 "parse.y"
1919 { patch_jmp(code_ptr) ; patch_jmp(yyvsp[0].start) ; }
1920 break;
1921 case 96:
1922 #line 485 "parse.y"
1923 { eat_nl() ; BC_new() ; }
1924 break;
1925 case 97:
1926 #line 490 "parse.y"
1927 { yyval.start = yyvsp[-5].start ;
1928 code_jmp(_JNZ, yyvsp[-5].start) ;
1929 BC_clear(code_ptr, yyvsp[-2].start) ; }
1930 break;
1931 case 98:
1932 #line 496 "parse.y"
1933 { eat_nl() ; BC_new() ;
1934 yyval.start = yyvsp[-1].start ;
1936 /* check if const expression */
1937 if ( code_ptr - 2 == yyvsp[-1].start &&
1938 code_ptr[-2].op == _PUSHD &&
1939 *(double*)code_ptr[-1].ptr != 0.0
1941 code_ptr -= 2 ;
1942 else
1944 code_push(yyvsp[-1].start, code_ptr-yyvsp[-1].start) ;
1945 code_ptr = yyvsp[-1].start ;
1946 code2(_JMP, (INST*)0) ; /* code2() not code_jmp() */
1949 break;
1950 case 99:
1951 #line 516 "parse.y"
1953 INST *c_addr ; int len ;
1955 if ( yyvsp[-1].start != yyvsp[0].start ) /* real test in loop */
1957 yyvsp[-1].start[1].op = code_ptr-(yyvsp[-1].start+1) ;
1958 c_addr = code_ptr ;
1959 len = code_pop(code_ptr) ;
1960 code_ptr += len ;
1961 code_jmp(_JNZ, yyvsp[0].start) ;
1962 BC_clear(code_ptr, c_addr) ;
1964 else /* while(1) */
1966 code_jmp(_JMP, yyvsp[-1].start) ;
1967 BC_clear(code_ptr, yyvsp[0].start) ;
1970 break;
1971 case 100:
1972 #line 539 "parse.y"
1974 INST *cont_address = code_ptr ;
1975 unsigned len = code_pop(code_ptr) ;
1977 code_ptr += len ;
1979 if ( yyvsp[-2].start != yyvsp[0].start ) /* real test in for2 */
1981 yyvsp[0].start[-1].op = code_ptr - yyvsp[0].start + 1 ;
1982 len = code_pop(code_ptr) ;
1983 code_ptr += len ;
1984 code_jmp(_JNZ, yyvsp[0].start) ;
1986 else /* for(;;) */
1987 code_jmp(_JMP, yyvsp[0].start) ;
1989 BC_clear(code_ptr, cont_address) ;
1992 break;
1993 case 101:
1994 #line 560 "parse.y"
1995 { yyval.start = code_ptr ; }
1996 break;
1997 case 102:
1998 #line 562 "parse.y"
1999 { yyval.start = yyvsp[-1].start ; code1(_POP) ; }
2000 break;
2001 case 103:
2002 #line 565 "parse.y"
2003 { yyval.start = code_ptr ; }
2004 break;
2005 case 104:
2006 #line 567 "parse.y"
2008 if ( code_ptr - 2 == yyvsp[-1].start &&
2009 code_ptr[-2].op == _PUSHD &&
2010 * (double*) code_ptr[-1].ptr != 0.0
2012 code_ptr -= 2 ;
2013 else
2015 code_push(yyvsp[-1].start, code_ptr-yyvsp[-1].start) ;
2016 code_ptr = yyvsp[-1].start ;
2017 code2(_JMP, (INST*)0) ;
2020 break;
2021 case 105:
2022 #line 583 "parse.y"
2023 { eat_nl() ; BC_new() ; code_push((INST*)0,0) ; }
2024 break;
2025 case 106:
2026 #line 585 "parse.y"
2027 { eat_nl() ; BC_new() ;
2028 code1(_POP) ;
2029 code_push(yyvsp[-1].start, code_ptr - yyvsp[-1].start) ;
2030 code_ptr -= code_ptr - yyvsp[-1].start ;
2032 break;
2033 case 107:
2034 #line 596 "parse.y"
2035 { check_array(yyvsp[0].stp) ;
2036 code_array(yyvsp[0].stp) ;
2037 code1(A_TEST) ;
2039 break;
2040 case 108:
2041 #line 601 "parse.y"
2042 { yyval.start = yyvsp[-3].arg2p->start ;
2043 code1(A_CAT) ; code1(yyvsp[-3].arg2p->cnt) ;
2044 zfree(yyvsp[-3].arg2p, sizeof(ARG2_REC)) ;
2046 check_array(yyvsp[0].stp) ;
2047 code_array(yyvsp[0].stp) ;
2048 code1(A_TEST) ;
2050 break;
2051 case 109:
2052 #line 612 "parse.y"
2054 if ( yyvsp[-1].ival > 1 )
2055 { code1(A_CAT) ; code1(yyvsp[-1].ival) ; }
2057 check_array(yyvsp[-4].stp) ;
2058 if( is_local(yyvsp[-4].stp) )
2059 { code1(LAE_PUSHA) ; code1(yyvsp[-4].stp->offset) ; }
2060 else code2(AE_PUSHA, yyvsp[-4].stp->stval.array) ;
2061 yyval.start = yyvsp[-3].start ;
2063 break;
2064 case 110:
2065 #line 625 "parse.y"
2067 if ( yyvsp[-1].ival > 1 )
2068 { code1(A_CAT) ; code1(yyvsp[-1].ival) ; }
2070 check_array(yyvsp[-4].stp) ;
2071 if( is_local(yyvsp[-4].stp) )
2072 { code1(LAE_PUSHI) ; code1(yyvsp[-4].stp->offset) ; }
2073 else code2(AE_PUSHI, yyvsp[-4].stp->stval.array) ;
2074 yyval.start = yyvsp[-3].start ;
2076 break;
2077 case 111:
2078 #line 637 "parse.y"
2080 if ( yyvsp[-2].ival > 1 )
2081 { code1(A_CAT) ; code1(yyvsp[-2].ival) ; }
2083 check_array(yyvsp[-5].stp) ;
2084 if( is_local(yyvsp[-5].stp) )
2085 { code1(LAE_PUSHA) ; code1(yyvsp[-5].stp->offset) ; }
2086 else code2(AE_PUSHA, yyvsp[-5].stp->stval.array) ;
2087 if ( yyvsp[0].ival == '+' ) code1(_POST_INC) ;
2088 else code1(_POST_DEC) ;
2090 yyval.start = yyvsp[-4].start ;
2092 break;
2093 case 112:
2094 #line 654 "parse.y"
2096 yyval.start = yyvsp[-4].start ;
2097 if ( yyvsp[-2].ival > 1 ) { code1(A_CAT) ; code1(yyvsp[-2].ival) ; }
2098 check_array(yyvsp[-5].stp) ;
2099 code_array(yyvsp[-5].stp) ;
2100 code1(A_DEL) ;
2102 break;
2103 case 113:
2104 #line 667 "parse.y"
2105 { eat_nl() ; BC_new() ;
2106 yyval.start = code_ptr ;
2108 check_var(yyvsp[-3].stp) ;
2109 code_address(yyvsp[-3].stp) ;
2110 check_array(yyvsp[-1].stp) ;
2111 code_array(yyvsp[-1].stp) ;
2113 code2(SET_ALOOP, (INST*)0) ;
2115 break;
2116 case 114:
2117 #line 681 "parse.y"
2119 yyvsp[0].start[-1].op = code_ptr - yyvsp[0].start + 1 ;
2120 BC_clear( code_ptr+3 , code_ptr) ;
2121 code_jmp(ALOOP, yyvsp[0].start) ;
2122 code_ptr++->ptr = (PTR) ZMALLOC(ALOOP_STATE) ;
2124 break;
2125 case 115:
2126 #line 696 "parse.y"
2127 { yyval.start = code_ptr ; code2(F_PUSHA, yyvsp[0].cp) ; }
2128 break;
2129 case 116:
2130 #line 698 "parse.y"
2131 { check_var(yyvsp[0].stp) ;
2132 yyval.start = code_ptr ;
2133 if ( is_local(yyvsp[0].stp) )
2134 { code1(L_PUSHI) ; code1(yyvsp[0].stp->offset) ; }
2135 else code2(_PUSHI, yyvsp[0].stp->stval.cp) ;
2137 CODE_FE_PUSHA() ;
2139 break;
2140 case 117:
2141 #line 707 "parse.y"
2143 if ( yyvsp[-1].ival > 1 )
2144 { code1(A_CAT) ; code1(yyvsp[-1].ival) ; }
2146 check_array(yyvsp[-4].stp) ;
2147 if( is_local(yyvsp[-4].stp) )
2148 { code1(LAE_PUSHI) ; code1(yyvsp[-4].stp->offset) ; }
2149 else code2(AE_PUSHI, yyvsp[-4].stp->stval.array) ;
2151 CODE_FE_PUSHA() ;
2153 yyval.start = yyvsp[-3].start ;
2155 break;
2156 case 118:
2157 #line 721 "parse.y"
2158 { yyval.start = yyvsp[0].start ; CODE_FE_PUSHA() ; }
2159 break;
2160 case 119:
2161 #line 723 "parse.y"
2162 { yyval.start = yyvsp[-1].start ; }
2163 break;
2164 case 120:
2165 #line 727 "parse.y"
2166 { field_A2I() ; }
2167 break;
2168 case 121:
2169 #line 730 "parse.y"
2170 { code1(F_ASSIGN) ; }
2171 break;
2172 case 122:
2173 #line 731 "parse.y"
2174 { code1(F_ADD_ASG) ; }
2175 break;
2176 case 123:
2177 #line 732 "parse.y"
2178 { code1(F_SUB_ASG) ; }
2179 break;
2180 case 124:
2181 #line 733 "parse.y"
2182 { code1(F_MUL_ASG) ; }
2183 break;
2184 case 125:
2185 #line 734 "parse.y"
2186 { code1(F_DIV_ASG) ; }
2187 break;
2188 case 126:
2189 #line 735 "parse.y"
2190 { code1(F_MOD_ASG) ; }
2191 break;
2192 case 127:
2193 #line 736 "parse.y"
2194 { code1(F_POW_ASG) ; }
2195 break;
2196 case 128:
2197 #line 743 "parse.y"
2198 { code2(_BUILTIN, bi_split) ; }
2199 break;
2200 case 129:
2201 #line 747 "parse.y"
2202 { yyval.start = yyvsp[-2].start ;
2203 check_array(yyvsp[0].stp) ;
2204 code_array(yyvsp[0].stp) ;
2206 break;
2207 case 130:
2208 #line 754 "parse.y"
2209 { code2(_PUSHI, &fs_shadow) ; }
2210 break;
2211 case 131:
2212 #line 756 "parse.y"
2214 if ( yyvsp[-1].start == code_ptr - 2 )
2216 if ( code_ptr[-2].op == _MATCH0 )
2217 RE_as_arg() ;
2218 else
2219 if ( code_ptr[-2].op == _PUSHS )
2220 { CELL *cp = ZMALLOC(CELL) ;
2222 cp->type = C_STRING ;
2223 cp->ptr = code_ptr[-1].ptr ;
2224 cast_for_split(cp) ;
2225 code_ptr[-2].op = _PUSHC ;
2226 code_ptr[-1].ptr = (PTR) cp ;
2230 break;
2231 case 132:
2232 #line 780 "parse.y"
2233 { yyval.start = yyvsp[-3].start ;
2234 code2(_BUILTIN, bi_match) ;
2236 break;
2237 case 133:
2238 #line 787 "parse.y"
2240 if ( yyvsp[0].start == code_ptr - 2 )
2242 if ( yyvsp[0].start->op == _MATCH0 ) RE_as_arg() ;
2243 else
2244 if ( yyvsp[0].start->op == _PUSHS )
2245 { CELL *cp = ZMALLOC(CELL) ;
2247 cp->type = C_STRING ;
2248 cp->ptr = yyvsp[0].start[1].ptr ;
2249 cast_to_RE(cp) ;
2250 yyvsp[0].start->op = _PUSHC ;
2251 yyvsp[0].start[1].ptr = (PTR) cp ;
2255 break;
2256 case 134:
2257 #line 808 "parse.y"
2258 { yyval.start = code_ptr ;
2259 code1(_EXIT0) ; }
2260 break;
2261 case 135:
2262 #line 811 "parse.y"
2263 { yyval.start = yyvsp[-1].start ; code1(_EXIT) ; }
2264 break;
2265 case 136:
2266 #line 814 "parse.y"
2267 { yyval.start = code_ptr ;
2268 code1(_RET0) ; }
2269 break;
2270 case 137:
2271 #line 817 "parse.y"
2272 { yyval.start = yyvsp[-1].start ; code1(_RET) ; }
2273 break;
2274 case 138:
2275 #line 822 "parse.y"
2276 { yyval.start = code_ptr ;
2277 code2(F_PUSHA, &field[0]) ;
2278 code1(_PUSHINT) ; code1(0) ;
2279 code2(_BUILTIN, bi_getline) ;
2280 getline_flag = 0 ;
2282 break;
2283 case 139:
2284 #line 829 "parse.y"
2285 { yyval.start = yyvsp[0].start ;
2286 code1(_PUSHINT) ; code1(0) ;
2287 code2(_BUILTIN, bi_getline) ;
2288 getline_flag = 0 ;
2290 break;
2291 case 140:
2292 #line 835 "parse.y"
2293 { code1(_PUSHINT) ; code1(F_IN) ;
2294 code2(_BUILTIN, bi_getline) ;
2295 /* getline_flag already off in yylex() */
2297 break;
2298 case 141:
2299 #line 840 "parse.y"
2300 { code2(F_PUSHA, &field[0]) ;
2301 code1(_PUSHINT) ; code1(PIPE_IN) ;
2302 code2(_BUILTIN, bi_getline) ;
2304 break;
2305 case 142:
2306 #line 845 "parse.y"
2308 code1(_PUSHINT) ; code1(PIPE_IN) ;
2309 code2(_BUILTIN, bi_getline) ;
2311 break;
2312 case 143:
2313 #line 851 "parse.y"
2314 { getline_flag = 1 ; }
2315 break;
2316 case 146:
2317 #line 856 "parse.y"
2318 { yyval.start = code_ptr ;
2319 code2(F_PUSHA, field+0) ;
2321 break;
2322 case 147:
2323 #line 860 "parse.y"
2324 { yyval.start = yyvsp[-1].start ; }
2325 break;
2326 case 148:
2327 #line 868 "parse.y"
2329 if ( yyvsp[0].start - yyvsp[-1].start == 2 && yyvsp[-1].start->op == _PUSHS )
2330 { /* cast from STRING to REPL at compile time */
2331 CELL *cp = ZMALLOC(CELL) ;
2332 cp->type = C_STRING ;
2333 cp->ptr = yyvsp[-1].start[1].ptr ;
2334 cast_to_REPL(cp) ;
2335 yyvsp[-1].start->op = _PUSHC ;
2336 yyvsp[-1].start[1].ptr = (PTR) cp ;
2338 code2(_BUILTIN, yyvsp[-5].fp) ;
2339 yyval.start = yyvsp[-3].start ;
2341 break;
2342 case 149:
2343 #line 883 "parse.y"
2344 { yyval.fp = bi_sub ; }
2345 break;
2346 case 150:
2347 #line 884 "parse.y"
2348 { yyval.fp = bi_gsub ; }
2349 break;
2350 case 151:
2351 #line 889 "parse.y"
2352 { yyval.start = code_ptr ;
2353 code2(F_PUSHA, &field[0]) ;
2355 break;
2356 case 152:
2357 #line 894 "parse.y"
2358 { yyval.start = yyvsp[-1].start ; }
2359 break;
2360 case 153:
2361 #line 902 "parse.y"
2362 { resize_fblock(yyvsp[-1].fbp, code_ptr) ;
2363 code_ptr = main_code_ptr ;
2364 scope = SCOPE_MAIN ;
2365 active_funct = (FBLOCK *) 0 ;
2366 restore_ids() ;
2368 break;
2369 case 154:
2370 #line 912 "parse.y"
2371 { eat_nl() ;
2372 scope = SCOPE_FUNCT ;
2373 active_funct = yyvsp[-3].fbp ;
2374 main_code_ptr = code_ptr ;
2376 if ( yyvsp[-3].fbp->nargs = yyvsp[-1].ival )
2377 yyvsp[-3].fbp->typev = (char *)
2378 memset( zmalloc(yyvsp[-1].ival), ST_LOCAL_NONE, SIZE_T(yyvsp[-1].ival)) ;
2379 else yyvsp[-3].fbp->typev = (char *) 0 ;
2380 code_ptr = yyvsp[-3].fbp->code =
2381 (INST *) zmalloc(PAGE_SZ*sizeof(INST)) ;
2383 break;
2384 case 155:
2385 #line 927 "parse.y"
2386 { FBLOCK *fbp ;
2388 if ( yyvsp[0].stp->type == ST_NONE )
2390 yyvsp[0].stp->type = ST_FUNCT ;
2391 fbp = yyvsp[0].stp->stval.fbp =
2392 (FBLOCK *) zmalloc(sizeof(FBLOCK)) ;
2393 fbp->name = yyvsp[0].stp->name ;
2395 else
2397 type_error( yyvsp[0].stp ) ;
2399 /* this FBLOCK will not be put in
2400 the symbol table */
2401 fbp = (FBLOCK*) zmalloc(sizeof(FBLOCK)) ;
2402 fbp->name = "" ;
2404 yyval.fbp = fbp ;
2406 break;
2407 case 156:
2408 #line 949 "parse.y"
2409 { yyval.fbp = yyvsp[0].fbp ;
2410 if ( yyvsp[0].fbp->code )
2411 compile_error("redefinition of %s" , yyvsp[0].fbp->name) ;
2413 break;
2414 case 157:
2415 #line 955 "parse.y"
2416 { yyval.ival = 0 ; }
2417 break;
2418 case 159:
2419 #line 960 "parse.y"
2420 { yyvsp[0].stp = save_id(yyvsp[0].stp->name) ;
2421 yyvsp[0].stp->type = ST_LOCAL_NONE ;
2422 yyvsp[0].stp->offset = 0 ;
2423 yyval.ival = 1 ;
2425 break;
2426 case 160:
2427 #line 966 "parse.y"
2428 { if ( is_local(yyvsp[0].stp) )
2429 compile_error("%s is duplicated in argument list",
2430 yyvsp[0].stp->name) ;
2431 else
2432 { yyvsp[0].stp = save_id(yyvsp[0].stp->name) ;
2433 yyvsp[0].stp->type = ST_LOCAL_NONE ;
2434 yyvsp[0].stp->offset = yyvsp[-2].ival ;
2435 yyval.ival = yyvsp[-2].ival + 1 ;
2438 break;
2439 case 161:
2440 #line 981 "parse.y"
2441 { yyval.start = yyvsp[-1].start ;
2442 code2(_CALL, yyvsp[-2].fbp) ;
2444 if ( yyvsp[0].ca_p ) code1(yyvsp[0].ca_p->arg_num+1) ;
2445 else code1(0) ;
2447 check_fcall(yyvsp[-2].fbp, scope, active_funct,
2448 yyvsp[0].ca_p, token_lineno) ;
2450 break;
2451 case 162:
2452 #line 993 "parse.y"
2453 { yyval.ca_p = (CA_REC *) 0 ; }
2454 break;
2455 case 163:
2456 #line 995 "parse.y"
2457 { yyval.ca_p = yyvsp[0].ca_p ;
2458 yyval.ca_p->link = yyvsp[-1].ca_p ;
2459 yyval.ca_p->arg_num = yyvsp[-1].ca_p ? yyvsp[-1].ca_p->arg_num+1 : 0 ;
2461 break;
2462 case 164:
2463 #line 1010 "parse.y"
2464 { yyval.ca_p = (CA_REC *) 0 ; }
2465 break;
2466 case 165:
2467 #line 1012 "parse.y"
2468 { yyval.ca_p = (CA_REC *) zmalloc(sizeof(CA_REC)) ;
2469 yyval.ca_p->link = yyvsp[-2].ca_p ;
2470 yyval.ca_p->type = CA_EXPR ;
2471 yyval.ca_p->arg_num = yyvsp[-2].ca_p ? yyvsp[-2].ca_p->arg_num+1 : 0 ;
2473 break;
2474 case 166:
2475 #line 1018 "parse.y"
2476 { yyval.ca_p = (CA_REC *) zmalloc(sizeof(CA_REC)) ;
2477 yyval.ca_p->link = yyvsp[-2].ca_p ;
2478 yyval.ca_p->arg_num = yyvsp[-2].ca_p ? yyvsp[-2].ca_p->arg_num+1 : 0 ;
2480 code_call_id(yyval.ca_p, yyvsp[-1].stp) ;
2482 break;
2483 case 167:
2484 #line 1027 "parse.y"
2485 { yyval.ca_p = (CA_REC *) zmalloc(sizeof(CA_REC)) ;
2486 yyval.ca_p->type = CA_EXPR ;
2488 break;
2489 case 168:
2490 #line 1032 "parse.y"
2491 { yyval.ca_p = (CA_REC *) zmalloc(sizeof(CA_REC)) ;
2492 code_call_id(yyval.ca_p, yyvsp[-1].stp) ;
2494 break;
2495 #line 2496 "y.tab.c"
2497 yyssp -= yym;
2498 yystate = *yyssp;
2499 yyvsp -= yym;
2500 yym = yylhs[yyn];
2501 if (yystate == 0 && yym == 0)
2503 #if YYDEBUG
2504 if (yydebug)
2505 printf("yydebug: after reduction, shifting from state 0 to\
2506 state %d\n", YYFINAL);
2507 #endif
2508 yystate = YYFINAL;
2509 *++yyssp = YYFINAL;
2510 *++yyvsp = yyval;
2511 if (yychar < 0)
2513 if ((yychar = YYLEX()) < 0) yychar = 0;
2514 #if YYDEBUG
2515 if (yydebug)
2517 yys = 0;
2518 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
2519 if (!yys) yys = "illegal-symbol";
2520 printf("yydebug: state %d, reading %d (%s)\n",
2521 YYFINAL, yychar, yys);
2523 #endif
2525 if (yychar == 0) goto yyaccept;
2526 goto yyloop;
2528 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
2529 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
2530 yystate = yytable[yyn];
2531 else
2532 yystate = yydgoto[yym];
2533 #if YYDEBUG
2534 if (yydebug)
2535 printf("yydebug: after reduction, shifting from state %d \
2536 to state %d\n", *yyssp, yystate);
2537 #endif
2538 if (yyssp >= yyss + yystacksize - 1)
2540 goto yyoverflow;
2542 *++yyssp = yystate;
2543 *++yyvsp = yyval;
2544 goto yyloop;
2545 yyoverflow:
2546 yyerror("yacc stack overflow");
2547 yyabort:
2548 return (1);
2549 yyaccept:
2550 return (0);
2553 /********************************************
2554 parse2.xc
2555 copyright 1991, Michael D. Brennan
2557 This is a source file for mawk, an implementation of
2558 the AWK programming language.
2560 Mawk is distributed without warranty under the terms of
2561 the GNU General Public License, version 2, 1991.
2562 ********************************************/
2564 /* $Log: parse.c,v $
2565 * Revision 1.5 92/01/09 08:45:30 brennan
2566 * pr patch1
2568 Revision 5.1 91/12/05 07:52:38 brennan
2569 1.1 pre-release
2573 /* If using Berkeley yacc, we can put the parser table
2574 memory to the zmalloc pool. This is kind of ugly and
2575 with paged vm probably a nop, but for DOS and MINIX and ??
2576 it frees a considerably amount of memory.
2578 This file is part of parse.c via
2579 cat y.tab.c parse2.xc > parse.c
2582 static struct yacc_mem yacc_mem[] =
2584 0 , 0 , /* don't remove this */
2586 #ifdef YYBYACC
2587 (PTR) yycheck, sizeof(yycheck)/ZBLOCKSZ,
2588 (PTR) yytable, sizeof(yytable)/ZBLOCKSZ,
2589 #ifndef YYXBYACC /* with xbyacc these are storage auto */
2590 (PTR) yyvs , sizeof(yyvs)/ZBLOCKSZ,
2591 (PTR) yyss, sizeof(yyss)/ZBLOCKSZ,
2592 #endif
2593 (PTR) yydefred, sizeof(yydefred)/ZBLOCKSZ,
2594 (PTR) yydgoto, sizeof(yydgoto)/ZBLOCKSZ,
2595 (PTR) yygindex, sizeof(yygindex)/ZBLOCKSZ,
2596 (PTR) yylen, sizeof(yylen)/ZBLOCKSZ,
2597 (PTR) yylhs, sizeof(yylhs)/ZBLOCKSZ,
2598 (PTR) yyrindex, sizeof(yyrindex)/ZBLOCKSZ,
2599 (PTR) yysindex, sizeof(yysindex)/ZBLOCKSZ,
2600 #endif
2602 0,0 } ;
2604 struct yacc_mem *yacc_memp = yacc_mem ;