mawk/parse.c
2008-09-09 19:42:29 -04:00

2622 lines
88 KiB
C

#ifndef lint
static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) modified 12/17/94";
#endif
#define YYBYACC_M 1
#define YYMAJOR 1
#define YYMINOR 9
#define yyclearin (yychar=(-1))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING (yyerrflag!=0)
#define YYPREFIX "yy"
#line 80 "parse.y"
#include <stdio.h>
#include "mawk.h"
#include "symtype.h"
#include "code.h"
#include "memory.h"
#include "bi_funct.h"
#include "bi_vars.h"
#include "jmp.h"
#include "field.h"
#include "files.h"
#define YYMAXDEPTH 200
extern void PROTO( eat_nl, (void) ) ;
static void PROTO( resize_fblock, (FBLOCK *) ) ;
static void PROTO( switch_code_to_main, (void)) ;
static void PROTO( code_array, (SYMTAB *) ) ;
static void PROTO( code_call_id, (CA_REC *, SYMTAB *) ) ;
static void PROTO( field_A2I, (void)) ;
static void PROTO( check_var, (SYMTAB *) ) ;
static void PROTO( check_array, (SYMTAB *) ) ;
static void PROTO( RE_as_arg, (void)) ;
static int scope ;
static FBLOCK *active_funct ;
/* when scope is SCOPE_FUNCT */
#define code_address(x) if( is_local(x) ) \
code2op(L_PUSHA, (x)->offset) ;\
else code2(_PUSHA, (x)->stval.cp)
#define CDP(x) (code_base+(x))
/* WARNING: These CDP() calculations become invalid after calls
that might change code_base. Which are: code2(), code2op(),
code_jmp() and code_pop().
*/
/* this nonsense caters to MSDOS large model */
#define CODE_FE_PUSHA() code_ptr->ptr = (PTR) 0 ; code1(FE_PUSHA)
#line 124 "parse.y"
typedef union{
CELL *cp ;
SYMTAB *stp ;
int start ; /* code starting address as offset from code_base */
PF_CP fp ; /* ptr to a (print/printf) or (sub/gsub) function */
BI_REC *bip ; /* ptr to info about a builtin */
FBLOCK *fbp ; /* ptr to a function block */
ARG2_REC *arg2p ;
CA_REC *ca_p ;
int ival ;
PTR ptr ;
} YYSTYPE;
#line 68 "y.tab.c"
#define UNEXPECTED 257
#define BAD_DECIMAL 258
#define NL 259
#define SEMI_COLON 260
#define LBRACE 261
#define RBRACE 262
#define LBOX 263
#define RBOX 264
#define COMMA 265
#define IO_OUT 266
#define ASSIGN 267
#define ADD_ASG 268
#define SUB_ASG 269
#define MUL_ASG 270
#define DIV_ASG 271
#define MOD_ASG 272
#define POW_ASG 273
#define QMARK 274
#define COLON 275
#define OR 276
#define AND 277
#define IN 278
#define MATCH 279
#define EQ 280
#define NEQ 281
#define LT 282
#define LTE 283
#define GT 284
#define GTE 285
#define CAT 286
#define GETLINE 287
#define PLUS 288
#define MINUS 289
#define MUL 290
#define DIV 291
#define MOD 292
#define NOT 293
#define UMINUS 294
#define IO_IN 295
#define PIPE 296
#define POW 297
#define INC_or_DEC 298
#define DOLLAR 299
#define FIELD 300
#define LPAREN 301
#define RPAREN 302
#define DOUBLE 303
#define STRING_ 304
#define RE 305
#define ID 306
#define D_ID 307
#define FUNCT_ID 308
#define BUILTIN 309
#define LENGTH 310
#define PRINT 311
#define PRINTF 312
#define SPLIT 313
#define MATCH_FUNC 314
#define SUB 315
#define GSUB 316
#define DO 317
#define WHILE 318
#define FOR 319
#define BREAK 320
#define CONTINUE 321
#define IF 322
#define ELSE 323
#define DELETE 324
#define BEGIN 325
#define END 326
#define EXIT 327
#define NEXT 328
#define RETURN 329
#define FUNCTION 330
#define YYERRCODE 256
short yylhs[] = { -1,
0, 0, 36, 36, 36, 37, 40, 37, 41, 37,
42, 37, 43, 44, 37, 1, 1, 2, 2, 3,
3, 4, 4, 4, 4, 4, 4, 4, 4, 45,
45, 13, 13, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 46, 13, 47, 13,
48, 49, 13, 14, 14, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 10, 25, 25, 26, 26, 8,
8, 5, 4, 27, 27, 6, 6, 6, 7, 7,
50, 50, 17, 4, 51, 4, 52, 4, 16, 4,
4, 18, 18, 19, 19, 53, 53, 13, 13, 10,
15, 15, 4, 4, 20, 4, 11, 11, 11, 11,
11, 15, 13, 13, 13, 13, 13, 13, 13, 15,
22, 54, 54, 15, 23, 4, 4, 21, 21, 15,
15, 15, 15, 15, 55, 12, 12, 9, 9, 15,
28, 28, 24, 24, 38, 29, 30, 30, 34, 34,
35, 35, 39, 15, 31, 31, 32, 32, 32, 33,
33,
};
short yylen[] = { 2,
1, 2, 1, 1, 2, 1, 0, 3, 0, 3,
0, 3, 0, 0, 6, 3, 3, 1, 1, 1,
2, 1, 2, 1, 2, 2, 2, 1, 2, 1,
1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 0, 4, 0, 4,
0, 0, 7, 1, 2, 1, 1, 1, 3, 1,
3, 3, 3, 3, 3, 3, 2, 2, 2, 1,
2, 2, 2, 2, 1, 0, 1, 1, 3, 5,
1, 0, 5, 1, 1, 1, 3, 2, 3, 3,
0, 2, 4, 2, 1, 4, 1, 7, 4, 2,
4, 3, 4, 1, 2, 1, 2, 3, 5, 5,
5, 6, 7, 3, 6, 2, 1, 2, 6, 2,
3, 1, 3, 3, 3, 3, 3, 3, 3, 2,
5, 1, 3, 6, 1, 2, 3, 2, 3, 1,
2, 2, 3, 4, 1, 1, 1, 2, 3, 6,
1, 1, 1, 3, 2, 4, 2, 2, 0, 1,
1, 3, 1, 3, 2, 2, 1, 3, 3, 2,
2,
};
short yydefred[] = { 0,
163, 0, 145, 0, 0, 0, 0, 0, 117, 0,
56, 57, 60, 0, 82, 82, 81, 0, 0, 151,
152, 7, 9, 0, 0, 6, 70, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 3, 4,
0, 0, 0, 30, 31, 84, 85, 97, 0, 0,
0, 0, 0, 0, 0, 0, 0, 22, 0, 20,
0, 0, 0, 0, 0, 28, 82, 24, 0, 0,
0, 0, 0, 0, 0, 0, 0, 72, 74, 0,
120, 0, 0, 0, 71, 0, 0, 0, 0, 0,
0, 0, 157, 158, 2, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
73, 13, 51, 47, 49, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 132, 130, 0, 155, 0, 5, 148,
146, 147, 0, 17, 25, 0, 0, 26, 27, 0,
0, 0, 136, 29, 0, 138, 0, 16, 21, 23,
100, 0, 104, 0, 0, 116, 0, 0, 0, 0,
0, 0, 0, 0, 0, 121, 0, 59, 0, 0,
164, 0, 0, 0, 0, 8, 10, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 108, 0, 40, 41, 42,
43, 44, 45, 18, 12, 19, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 161, 0, 0, 149,
0, 102, 0, 0, 0, 0, 114, 137, 139, 95,
0, 105, 106, 0, 0, 0, 0, 0, 86, 0,
0, 0, 0, 0, 0, 0, 0, 0, 165, 0,
0, 166, 0, 0, 0, 0, 0, 0, 0, 144,
133, 0, 156, 0, 99, 0, 103, 93, 0, 96,
107, 101, 88, 0, 0, 0, 0, 0, 0, 0,
0, 109, 0, 169, 171, 168, 170, 80, 131, 0,
0, 52, 0, 162, 0, 0, 0, 0, 83, 0,
0, 0, 110, 119, 112, 134, 15, 0, 0, 153,
150, 115, 0, 0, 0, 0, 113, 98, 154,
};
short yydgoto[] = { 25,
58, 215, 59, 60, 86, 247, 82, 27, 28, 29,
30, 143, 61, 32, 33, 62, 63, 64, 165, 65,
66, 34, 226, 321, 249, 250, 67, 35, 36, 37,
181, 182, 262, 228, 229, 38, 39, 40, 41, 91,
92, 124, 202, 301, 68, 204, 205, 203, 318, 286,
241, 69, 245, 135, 42,
};
short yysindex[] = { 36,
0, 282, 0, 2247, 2247, 2247, -50, 2157, 0, 2277,
0, 0, 0, -296, 0, 0, 0, -286, -250, 0,
0, 0, 0, -245, 36, 0, 0, 2247, 2123, 2170,
2551, 2247, 267, -257, -237, -188, -219, 0, 0, 0,
-188, -31, -124, 0, 0, 0, 0, 0, -212, -204,
-226, -226, -162, -165, 71, -226, 71, 0, 134, 0,
2503, 356, 356, 1794, 356, 0, 0, 0, 356, 2277,
-296, -152, -229, -229, -229, -114, 0, 0, 0, 0,
0, -221, 2150, 2097, 0, -94, -122, -111, 2277, 2277,
-188, -188, 0, 0, 0, -106, 2277, 2277, 2277, 2277,
2277, 2277, 2277, 2277, 2277, 2277, 2277, 2277, 2277, 2277,
0, 0, 0, 0, 0, -96, 2277, 2277, 2277, 2277,
2277, 2277, 2277, -62, 267, 2247, 2247, 2247, 2247, 2247,
-76, 2247, 2277, 0, 0, 2277, 0, -90, 0, 0,
0, 0, -75, 0, 0, 2277, 1824, 0, 0, 2277,
-226, 2503, 0, 0, 2503, 0, -226, 0, 0, 0,
0, -79, 0, 2515, 2187, 0, 2307, -89, 2410, -51,
-74, -17, -15, 2277, -26, 0, 2277, 0, 2277, -43,
0, 2337, 2277, 2572, 2593, 0, 0, 2617, 2617, 2617,
2617, 2617, 2617, 2617, 2617, 2617, 2617, 2617, 2617, 2617,
2617, 2277, 2277, 2277, 2277, 0, 200, 0, 0, 0,
0, 0, 0, 0, 0, 0, -83, -83, -229, -229,
-229, -50, -106, 2422, 2617, -3, 0, -37, 2, 0,
2437, 0, -266, 2530, 2449, 8, 0, 0, 0, 0,
356, 0, 0, 2464, 356, 2217, 6, 2617, 0, 9,
-25, 2277, 2277, 2277, 2617, -21, 2617, -187, 0, -243,
2124, 0, -12, -19, 2277, 2617, 2605, 2626, 350, 0,
0, 2277, 0, -11, 0, -10, 0, 0, 2277, 0,
0, 0, 0, -218, 2277, -226, 2277, 2277, -179, -112,
-109, 0, -4, 0, 0, 0, 0, 0, 0, 7,
-62, 0, 2151, 0, 11, -105, -26, 2617, 0, 2617,
2476, -4, 0, 0, 0, 0, 0, 2277, -50, 0,
0, 0, -226, -226, 2617, 12, 0, 0, 0,
};
short yyrindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 601, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1587,
-59, -42, 1645, 0, 0, 0, 0, 0, 0, 0,
0, 1413, 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,
543, 659, 891, 949, 1007, 0, 427, 0, 0, 485,
0, 0, 1924, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1065, 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, 1703, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 13, 0, 0,
0, 0, 717, 0, 0, 0, 0, 0, 0, 0,
28, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 208, 0, 0, 0, 0, -206, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 2367,
0, 0, 15, 0, 0, 0, 0, 18, 41, 287,
361, 1982, 1990, 2002, 2010, 2022, 2030, 2042, 2050, 2062,
2070, 0, 0, 0, 0, 0, 139, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1471, 1529, 1123, 1181,
1239, 1355, 775, 0, -170, 0, 0, 0, 19, 0,
0, 0, 1760, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, -95, -172, 0, -223,
0, 0, 0, 0, -169, 0, -125, 0, 0, 1878,
0, 0, 0, 0, 0, -34, 0, -236, 213, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1297, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, -116, -78, 0, -71,
0, 833, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2082, 0, 0, 0, 0,
};
short yygindex[] = { 0,
21, -20, 0, -49, 3, 0, 52, 0, 0, -7,
-1, -205, 1, 0, 44, 0, 0, 0, 0, 0,
0, 0, 34, 0, 120, -137, 0, 0, 0, 0,
0, 0, 0, 0, 0, 279, 0, 0, 0, 0,
0, 0, 0, 0, 106, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
};
#define YYTABLESIZE 2911
short yytable[] = { 78,
31, 85, 72, 72, 72, 79, 72, 133, 83, 159,
84, 276, 161, 162, 89, 166, 270, 87, 88, 168,
26, 294, 48, 48, 48, 31, 72, 48, 48, 48,
72, 85, 44, 45, 141, 77, 77, 48, 48, 48,
142, 258, 77, 174, 134, 26, 174, 73, 74, 75,
90, 81, 76, 76, 85, 152, 137, 155, 295, 76,
93, 139, 94, 136, 164, 48, 131, 132, 83, 167,
169, 96, 2, 170, 171, 125, 293, 287, 77, 172,
175, 138, 173, 307, 312, 287, 78, 78, 146, 184,
185, 78, 78, 78, 135, 90, 147, 188, 189, 190,
191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
201, 186, 187, 326, 289, 290, 291, 207, 208, 209,
210, 211, 212, 213, 72, 72, 72, 72, 72, 78,
72, 135, 90, 224, 44, 45, 225, 144, 150, 89,
151, 306, 87, 87, 214, 111, 231, 234, 145, 87,
235, 313, 287, 236, 314, 287, 148, 149, 323, 287,
153, 154, 156, 91, 91, 244, 160, 248, 179, 217,
218, 219, 220, 221, 255, 223, 89, 257, 180, 248,
92, 92, 261, 248, 8, 9, 76, 79, 79, 183,
132, 280, 79, 79, 79, 282, 44, 45, 2, 11,
11, 11, 266, 267, 268, 269, 128, 129, 130, 206,
222, 252, 131, 132, 141, 227, 32, 32, 32, 230,
142, 32, 32, 32, 14, 14, 14, 176, 251, 216,
79, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 240, 83, 253, 84, 254, 8, 9,
76, 256, 248, 248, 248, 77, 237, 238, 259, 32,
239, 272, 145, 140, 273, 225, 274, 8, 9, 76,
279, 285, 303, 287, 77, 288, 33, 33, 33, 248,
317, 33, 33, 33, 292, 308, 299, 310, 311, 298,
82, 1, 33, 315, 304, 305, 2, 284, 300, 34,
34, 34, 263, 95, 34, 34, 34, 0, 316, 0,
0, 141, 322, 329, 159, 34, 76, 142, 325, 33,
160, 214, 3, 4, 5, 0, 0, 0, 6, 44,
45, 0, 0, 7, 8, 9, 10, 0, 11, 12,
13, 14, 34, 15, 16, 17, 0, 0, 18, 19,
20, 21, 0, 0, 0, 0, 0, 3, 4, 5,
22, 23, 0, 6, 0, 24, 0, 0, 7, 8,
9, 10, 0, 11, 12, 13, 14, 0, 15, 16,
17, 0, 0, 18, 19, 20, 21, 0, 0, 157,
0, 309, 44, 45, 2, 158, 0, 46, 46, 46,
0, 0, 46, 46, 46, 0, 216, 0, 0, 0,
0, 0, 46, 46, 46, 46, 46, 46, 0, 0,
3, 4, 5, 0, 0, 0, 6, 0, 327, 328,
0, 7, 8, 9, 10, 0, 11, 12, 13, 14,
46, 15, 16, 17, 46, 47, 18, 19, 20, 21,
48, 49, 50, 51, 52, 53, 0, 54, 0, 0,
55, 56, 57, 94, 0, 0, 94, 94, 94, 94,
0, 50, 50, 50, 0, 0, 50, 50, 50, 118,
119, 120, 121, 122, 123, 0, 50, 50, 50, 50,
0, 0, 0, 0, 94, 94, 94, 0, 0, 0,
94, 0, 0, 0, 0, 94, 94, 94, 94, 0,
94, 94, 94, 94, 50, 94, 94, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
0, 94, 0, 0, 94, 94, 94, 43, 0, 0,
44, 45, 2, 0, 0, 35, 35, 35, 0, 0,
35, 35, 35, 0, 126, 127, 128, 129, 130, 0,
0, 35, 131, 132, 0, 0, 0, 0, 3, 4,
5, 0, 0, 0, 6, 0, 0, 0, 0, 7,
8, 9, 10, 0, 11, 12, 13, 14, 35, 15,
16, 17, 46, 47, 18, 19, 20, 21, 48, 49,
50, 51, 52, 53, 0, 54, 0, 0, 55, 56,
57, 157, 0, 0, 44, 45, 2, 0, 0, 36,
36, 36, 0, 0, 36, 36, 36, 116, 117, 118,
119, 120, 121, 122, 123, 36, 0, 0, 0, 0,
0, 0, 3, 4, 5, 0, 0, 0, 6, 0,
0, 0, 0, 7, 8, 9, 10, 0, 11, 12,
13, 14, 36, 15, 16, 17, 46, 47, 18, 19,
20, 21, 48, 49, 50, 51, 52, 53, 0, 54,
0, 0, 55, 56, 57, 75, 75, 75, 0, 82,
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
0, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 75, 75, 0, 75, 75, 75, 0, 0, 75,
75, 75, 75, 118, 118, 118, 0, 82, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
0, 118, 118, 118, 118, 118, 118, 118, 0, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 0, 118, 118, 118, 0, 0, 118, 118, 118,
118, 58, 58, 58, 0, 82, 58, 58, 58, 58,
58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
58, 58, 58, 58, 58, 58, 58, 58, 0, 58,
58, 58, 58, 58, 58, 58, 0, 58, 58, 58,
0, 58, 58, 58, 58, 58, 58, 58, 58, 0,
58, 58, 58, 0, 0, 58, 58, 58, 58, 58,
58, 58, 0, 82, 58, 58, 58, 75, 75, 75,
75, 75, 75, 75, 58, 58, 58, 58, 58, 58,
58, 58, 58, 58, 58, 58, 0, 58, 58, 58,
58, 58, 58, 58, 0, 0, 58, 58, 0, 58,
58, 58, 58, 58, 58, 58, 58, 0, 58, 58,
58, 0, 0, 58, 58, 58, 58, 122, 122, 122,
0, 0, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 0, 122, 122, 122, 122, 122,
122, 122, 0, 122, 122, 122, 0, 122, 122, 122,
122, 122, 122, 122, 122, 0, 122, 122, 122, 0,
0, 122, 122, 122, 122, 141, 141, 141, 0, 0,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 0, 141, 141, 141, 141, 141, 141, 141,
0, 0, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 0, 141, 141, 141, 0, 0, 141,
141, 141, 141, 66, 66, 66, 0, 0, 66, 66,
66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
0, 66, 66, 66, 66, 66, 66, 66, 0, 66,
66, 0, 66, 66, 66, 66, 66, 66, 66, 66,
66, 0, 66, 66, 66, 0, 0, 66, 66, 66,
66, 111, 111, 111, 0, 0, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 0, 111,
111, 111, 111, 111, 111, 111, 0, 111, 111, 111,
0, 111, 111, 111, 111, 111, 111, 111, 111, 0,
111, 111, 111, 0, 0, 111, 111, 111, 111, 68,
68, 68, 0, 0, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 0, 68, 68, 68,
68, 68, 68, 68, 0, 68, 0, 0, 68, 68,
68, 68, 68, 68, 68, 68, 68, 0, 68, 68,
68, 0, 0, 68, 68, 68, 68, 69, 69, 69,
0, 0, 69, 69, 69, 69, 69, 69, 69, 69,
69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
69, 69, 69, 69, 0, 69, 69, 69, 69, 69,
69, 69, 0, 69, 0, 0, 69, 69, 69, 69,
69, 69, 69, 69, 69, 0, 69, 69, 69, 0,
0, 69, 69, 69, 69, 67, 67, 67, 0, 0,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
67, 67, 0, 67, 67, 67, 67, 67, 67, 67,
0, 67, 0, 0, 67, 67, 67, 67, 67, 67,
67, 67, 67, 0, 67, 67, 67, 0, 0, 67,
67, 67, 67, 142, 142, 142, 0, 0, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
0, 142, 142, 142, 142, 142, 142, 142, 0, 142,
0, 0, 142, 142, 142, 142, 142, 142, 142, 142,
142, 0, 142, 142, 142, 0, 0, 142, 142, 142,
142, 63, 63, 63, 0, 0, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 0, 63,
63, 63, 63, 63, 63, 63, 0, 63, 0, 0,
63, 63, 63, 63, 63, 63, 63, 63, 63, 0,
63, 63, 63, 0, 0, 63, 63, 63, 63, 64,
64, 64, 0, 0, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 0, 64, 64, 64,
64, 64, 64, 64, 0, 64, 0, 0, 64, 64,
64, 64, 64, 64, 64, 64, 64, 0, 64, 64,
64, 0, 0, 64, 64, 64, 64, 65, 65, 65,
0, 0, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 0, 65, 65, 65, 65, 65,
65, 65, 0, 65, 0, 0, 65, 65, 65, 65,
65, 65, 65, 65, 65, 0, 65, 65, 65, 0,
0, 65, 65, 65, 65, 111, 111, 111, 0, 0,
111, 111, 111, 110, 110, 110, 110, 110, 110, 110,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 0, 111, 111, 111, 111, 111, 111, 111,
0, 0, 111, 111, 0, 111, 111, 111, 111, 111,
111, 111, 111, 0, 111, 111, 111, 0, 0, 111,
111, 111, 111, 143, 143, 143, 0, 0, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
0, 143, 143, 143, 143, 143, 143, 143, 0, 143,
143, 143, 143, 0, 0, 0, 143, 143, 143, 143,
0, 0, 143, 143, 143, 0, 0, 143, 143, 143,
143, 140, 140, 140, 0, 0, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 0, 140,
140, 140, 140, 140, 140, 140, 0, 0, 140, 140,
140, 0, 0, 0, 140, 140, 140, 140, 0, 0,
140, 140, 140, 0, 0, 140, 140, 140, 140, 61,
61, 61, 0, 0, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 0, 61, 61, 61,
0, 0, 0, 61, 0, 61, 0, 0, 61, 61,
61, 61, 61, 61, 61, 61, 61, 0, 61, 61,
61, 0, 0, 61, 61, 61, 61, 62, 62, 62,
0, 0, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 0, 62, 62, 62, 0, 0,
0, 62, 0, 62, 0, 0, 62, 62, 62, 62,
62, 62, 62, 62, 62, 0, 62, 62, 62, 0,
0, 62, 62, 62, 62, 122, 122, 122, 0, 0,
122, 122, 122, 0, 0, 0, 0, 0, 0, 0,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 0, 122, 122, 122, 122, 122, 122, 122,
0, 0, 122, 122, 0, 122, 122, 122, 122, 122,
122, 122, 122, 0, 122, 122, 122, 0, 0, 122,
122, 122, 122, 54, 54, 54, 0, 0, 54, 54,
54, 0, 0, 0, 0, 0, 0, 0, 54, 54,
54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
0, 54, 0, 0, 0, 0, 0, 54, 0, 0,
0, 0, 54, 54, 54, 54, 54, 54, 54, 54,
54, 0, 54, 54, 54, 0, 0, 54, 54, 54,
54, 55, 55, 55, 0, 0, 55, 55, 55, 0,
0, 0, 0, 0, 0, 0, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 0, 55,
0, 0, 0, 0, 0, 55, 0, 0, 0, 0,
55, 55, 55, 55, 55, 55, 55, 55, 55, 0,
55, 55, 55, 0, 0, 55, 55, 55, 55, 58,
0, 0, 82, 0, 0, 0, 75, 75, 75, 75,
75, 75, 75, 58, 0, 58, 58, 0, 58, 58,
58, 58, 58, 58, 58, 0, 58, 58, 58, 58,
58, 58, 58, 163, 0, 58, 58, 0, 58, 58,
58, 0, 58, 58, 58, 58, 0, 58, 58, 58,
0, 0, 58, 58, 58, 58, 0, 0, 0, 0,
3, 4, 5, 232, 0, 0, 6, 0, 0, 0,
0, 7, 8, 9, 10, 0, 11, 12, 13, 14,
0, 15, 16, 17, 0, 0, 18, 19, 20, 21,
3, 4, 5, 0, 0, 0, 6, 0, 0, 0,
0, 7, 8, 9, 10, 0, 11, 12, 13, 233,
0, 15, 16, 17, 0, 0, 18, 19, 20, 21,
82, 0, 0, 0, 75, 75, 75, 75, 75, 75,
75, 58, 0, 58, 58, 58, 58, 58, 58, 58,
58, 58, 58, 0, 58, 58, 58, 58, 58, 58,
58, 0, 0, 58, 58, 0, 58, 58, 58, 0,
58, 58, 58, 58, 0, 58, 58, 58, 122, 0,
58, 58, 58, 58, 0, 0, 0, 122, 0, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 0,
122, 122, 122, 122, 122, 122, 122, 0, 0, 122,
122, 0, 122, 122, 122, 0, 122, 122, 122, 122,
0, 122, 122, 122, 0, 0, 122, 122, 122, 122,
37, 37, 37, 0, 0, 37, 37, 37, 38, 38,
38, 0, 0, 38, 38, 38, 37, 0, 0, 0,
39, 39, 39, 0, 38, 39, 39, 39, 123, 123,
123, 0, 0, 123, 123, 123, 39, 0, 0, 0,
124, 124, 124, 37, 123, 124, 124, 124, 125, 125,
125, 38, 0, 125, 125, 125, 124, 0, 0, 0,
126, 126, 126, 39, 125, 126, 126, 126, 127, 127,
127, 123, 0, 127, 127, 127, 126, 0, 0, 0,
128, 128, 128, 124, 127, 128, 128, 128, 129, 129,
129, 125, 0, 129, 129, 129, 128, 0, 0, 0,
53, 53, 53, 126, 129, 53, 53, 53, 0, 0,
0, 127, 0, 0, 0, 0, 53, 0, 0, 0,
0, 177, 0, 128, 0, 0, 0, 0, 0, 0,
113, 129, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 0, 53, 0, 0, 0, 0, 296, 97,
98, 99, 100, 101, 102, 103, 0, 113, 178, 114,
115, 116, 117, 118, 119, 120, 121, 122, 123, 0,
0, 0, 0, 0, 0, 319, 104, 105, 106, 107,
108, 109, 110, 0, 113, 297, 114, 115, 116, 117,
118, 119, 120, 121, 122, 123, 104, 105, 106, 107,
108, 109, 110, 3, 4, 5, 0, 111, 0, 6,
0, 176, 320, 0, 7, 8, 9, 70, 0, 11,
12, 13, 71, 80, 15, 16, 17, 111, 0, 18,
19, 20, 21, 3, 4, 5, 0, 0, 0, 6,
0, 0, 0, 0, 7, 8, 9, 10, 243, 11,
12, 13, 14, 0, 15, 16, 17, 0, 0, 18,
19, 20, 21, 3, 4, 5, 0, 0, 0, 6,
0, 0, 0, 0, 7, 8, 9, 10, 283, 11,
12, 13, 14, 0, 15, 16, 17, 0, 0, 18,
19, 20, 21, 3, 4, 5, 0, 0, 0, 6,
0, 0, 0, 0, 7, 8, 9, 70, 0, 11,
12, 13, 71, 0, 15, 16, 17, 0, 0, 18,
19, 20, 21, 3, 4, 5, 0, 0, 0, 6,
0, 0, 0, 0, 7, 8, 9, 10, 0, 11,
12, 13, 14, 0, 15, 16, 17, 0, 0, 18,
19, 20, 21, 3, 4, 5, 0, 0, 0, 6,
0, 0, 0, 0, 7, 8, 9, 246, 0, 11,
12, 13, 14, 0, 15, 16, 17, 0, 0, 18,
19, 20, 21, 3, 4, 5, 0, 0, 0, 6,
0, 0, 0, 0, 7, 8, 9, 10, 0, 11,
12, 13, 260, 0, 15, 16, 17, 0, 0, 18,
19, 20, 21, 167, 167, 167, 0, 0, 0, 167,
0, 0, 0, 0, 167, 167, 167, 167, 0, 167,
167, 167, 167, 0, 167, 167, 167, 0, 0, 167,
167, 167, 167, 113, 0, 114, 115, 116, 117, 118,
119, 120, 121, 122, 123, 113, 0, 114, 115, 116,
117, 118, 119, 120, 121, 122, 123, 0, 0, 0,
113, 178, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 113, 271, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 0, 0, 0, 113, 275, 114,
115, 116, 117, 118, 119, 120, 121, 122, 123, 113,
278, 114, 115, 116, 117, 118, 119, 120, 121, 122,
123, 44, 45, 0, 0, 281, 0, 0, 0, 0,
0, 0, 0, 0, 242, 0, 113, 324, 114, 115,
116, 117, 118, 119, 120, 121, 122, 123, 113, 277,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
0, 0, 0, 113, 0, 114, 115, 116, 117, 118,
119, 120, 121, 122, 123, 112, 0, 0, 0, 0,
0, 0, 0, 0, 113, 0, 114, 115, 116, 117,
118, 119, 120, 121, 122, 123, 264, 0, 0, 0,
0, 0, 0, 0, 0, 113, 0, 114, 115, 116,
117, 118, 119, 120, 121, 122, 123, 265, 0, 0,
0, 0, 0, 0, 0, 0, 113, 0, 114, 115,
116, 117, 118, 119, 120, 121, 122, 123, 113, 302,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
113, 0, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 115, 116, 117, 118, 119, 120, 121, 122,
123,
};
short yycheck[] = { 7,
0, 298, 4, 5, 6, 7, 8, 265, 10, 59,
10, 278, 62, 63, 301, 65, 222, 15, 16, 69,
0, 265, 259, 260, 261, 25, 28, 264, 265, 266,
32, 298, 259, 260, 42, 259, 260, 274, 275, 276,
42, 179, 266, 265, 302, 25, 265, 4, 5, 6,
301, 8, 259, 260, 298, 55, 36, 57, 302, 266,
306, 41, 308, 301, 64, 302, 296, 297, 70, 67,
70, 28, 261, 71, 76, 32, 264, 265, 302, 77,
302, 301, 80, 302, 264, 265, 259, 260, 301, 89,
90, 264, 265, 266, 265, 265, 301, 97, 98, 99,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 91, 92, 319, 252, 253, 254, 117, 118, 119,
120, 121, 122, 123, 126, 127, 128, 129, 130, 302,
132, 302, 302, 133, 259, 260, 136, 262, 301, 265,
306, 279, 259, 260, 124, 298, 146, 147, 43, 266,
150, 264, 265, 151, 264, 265, 51, 52, 264, 265,
55, 56, 57, 259, 260, 165, 61, 167, 263, 126,
127, 128, 129, 130, 174, 132, 302, 177, 301, 179,
259, 260, 182, 183, 299, 300, 301, 259, 260, 301,
297, 241, 264, 265, 266, 245, 259, 260, 261, 259,
260, 261, 202, 203, 204, 205, 290, 291, 292, 306,
287, 263, 296, 297, 222, 306, 259, 260, 261, 295,
222, 264, 265, 266, 259, 260, 261, 302, 318, 124,
302, 274, 275, 276, 277, 278, 279, 280, 281, 282,
283, 284, 285, 323, 246, 263, 246, 263, 299, 300,
301, 278, 252, 253, 254, 306, 151, 152, 302, 302,
155, 265, 157, 295, 302, 265, 265, 299, 300, 301,
263, 266, 272, 265, 306, 301, 259, 260, 261, 279,
301, 264, 265, 266, 306, 285, 306, 287, 288, 302,
263, 256, 275, 298, 306, 306, 261, 246, 265, 259,
260, 261, 183, 25, 264, 265, 266, -1, 302, -1,
-1, 319, 302, 302, 302, 275, 302, 319, 318, 302,
302, 301, 287, 288, 289, -1, -1, -1, 293, 259,
260, -1, -1, 298, 299, 300, 301, -1, 303, 304,
305, 306, 302, 308, 309, 310, -1, -1, 313, 314,
315, 316, -1, -1, -1, -1, -1, 287, 288, 289,
325, 326, -1, 293, -1, 330, -1, -1, 298, 299,
300, 301, -1, 303, 304, 305, 306, -1, 308, 309,
310, -1, -1, 313, 314, 315, 316, -1, -1, 256,
-1, 286, 259, 260, 261, 262, -1, 259, 260, 261,
-1, -1, 264, 265, 266, -1, 301, -1, -1, -1,
-1, -1, 274, 275, 276, 277, 278, 279, -1, -1,
287, 288, 289, -1, -1, -1, 293, -1, 323, 324,
-1, 298, 299, 300, 301, -1, 303, 304, 305, 306,
302, 308, 309, 310, 311, 312, 313, 314, 315, 316,
317, 318, 319, 320, 321, 322, -1, 324, -1, -1,
327, 328, 329, 256, -1, -1, 259, 260, 261, 262,
-1, 259, 260, 261, -1, -1, 264, 265, 266, 280,
281, 282, 283, 284, 285, -1, 274, 275, 276, 277,
-1, -1, -1, -1, 287, 288, 289, -1, -1, -1,
293, -1, -1, -1, -1, 298, 299, 300, 301, -1,
303, 304, 305, 306, 302, 308, 309, 310, 311, 312,
313, 314, 315, 316, 317, 318, 319, 320, 321, 322,
-1, 324, -1, -1, 327, 328, 329, 256, -1, -1,
259, 260, 261, -1, -1, 259, 260, 261, -1, -1,
264, 265, 266, -1, 288, 289, 290, 291, 292, -1,
-1, 275, 296, 297, -1, -1, -1, -1, 287, 288,
289, -1, -1, -1, 293, -1, -1, -1, -1, 298,
299, 300, 301, -1, 303, 304, 305, 306, 302, 308,
309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
319, 320, 321, 322, -1, 324, -1, -1, 327, 328,
329, 256, -1, -1, 259, 260, 261, -1, -1, 259,
260, 261, -1, -1, 264, 265, 266, 278, 279, 280,
281, 282, 283, 284, 285, 275, -1, -1, -1, -1,
-1, -1, 287, 288, 289, -1, -1, -1, 293, -1,
-1, -1, -1, 298, 299, 300, 301, -1, 303, 304,
305, 306, 302, 308, 309, 310, 311, 312, 313, 314,
315, 316, 317, 318, 319, 320, 321, 322, -1, 324,
-1, -1, 327, 328, 329, 259, 260, 261, -1, 263,
264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, -1, 287, 288, 289, 290, 291, 292, 293,
-1, 295, 296, 297, 298, 299, 300, 301, 302, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 259, 260, 261, -1, 263, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
-1, 287, 288, 289, 290, 291, 292, 293, -1, 295,
296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
306, -1, 308, 309, 310, -1, -1, 313, 314, 315,
316, 259, 260, 261, -1, 263, 264, 265, 266, 267,
268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, -1, 287,
288, 289, 290, 291, 292, 293, -1, 295, 296, 297,
-1, 299, 300, 301, 302, 303, 304, 305, 306, -1,
308, 309, 310, -1, -1, 313, 314, 315, 316, 259,
260, 261, -1, 263, 264, 265, 266, 267, 268, 269,
270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
280, 281, 282, 283, 284, 285, -1, 287, 288, 289,
290, 291, 292, 293, -1, -1, 296, 297, -1, 299,
300, 301, 302, 303, 304, 305, 306, -1, 308, 309,
310, -1, -1, 313, 314, 315, 316, 259, 260, 261,
-1, -1, 264, 265, 266, 267, 268, 269, 270, 271,
272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
282, 283, 284, 285, -1, 287, 288, 289, 290, 291,
292, 293, -1, 295, 296, 297, -1, 299, 300, 301,
302, 303, 304, 305, 306, -1, 308, 309, 310, -1,
-1, 313, 314, 315, 316, 259, 260, 261, -1, -1,
264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, -1, 287, 288, 289, 290, 291, 292, 293,
-1, -1, 296, 297, 298, 299, 300, 301, 302, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 259, 260, 261, -1, -1, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
-1, 287, 288, 289, 290, 291, 292, 293, -1, 295,
296, -1, 298, 299, 300, 301, 302, 303, 304, 305,
306, -1, 308, 309, 310, -1, -1, 313, 314, 315,
316, 259, 260, 261, -1, -1, 264, 265, 266, 267,
268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, -1, 287,
288, 289, 290, 291, 292, 293, -1, 295, 296, 297,
-1, 299, 300, 301, 302, 303, 304, 305, 306, -1,
308, 309, 310, -1, -1, 313, 314, 315, 316, 259,
260, 261, -1, -1, 264, 265, 266, 267, 268, 269,
270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
280, 281, 282, 283, 284, 285, -1, 287, 288, 289,
290, 291, 292, 293, -1, 295, -1, -1, 298, 299,
300, 301, 302, 303, 304, 305, 306, -1, 308, 309,
310, -1, -1, 313, 314, 315, 316, 259, 260, 261,
-1, -1, 264, 265, 266, 267, 268, 269, 270, 271,
272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
282, 283, 284, 285, -1, 287, 288, 289, 290, 291,
292, 293, -1, 295, -1, -1, 298, 299, 300, 301,
302, 303, 304, 305, 306, -1, 308, 309, 310, -1,
-1, 313, 314, 315, 316, 259, 260, 261, -1, -1,
264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, -1, 287, 288, 289, 290, 291, 292, 293,
-1, 295, -1, -1, 298, 299, 300, 301, 302, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 259, 260, 261, -1, -1, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
-1, 287, 288, 289, 290, 291, 292, 293, -1, 295,
-1, -1, 298, 299, 300, 301, 302, 303, 304, 305,
306, -1, 308, 309, 310, -1, -1, 313, 314, 315,
316, 259, 260, 261, -1, -1, 264, 265, 266, 267,
268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, -1, 287,
288, 289, 290, 291, 292, 293, -1, 295, -1, -1,
298, 299, 300, 301, 302, 303, 304, 305, 306, -1,
308, 309, 310, -1, -1, 313, 314, 315, 316, 259,
260, 261, -1, -1, 264, 265, 266, 267, 268, 269,
270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
280, 281, 282, 283, 284, 285, -1, 287, 288, 289,
290, 291, 292, 293, -1, 295, -1, -1, 298, 299,
300, 301, 302, 303, 304, 305, 306, -1, 308, 309,
310, -1, -1, 313, 314, 315, 316, 259, 260, 261,
-1, -1, 264, 265, 266, 267, 268, 269, 270, 271,
272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
282, 283, 284, 285, -1, 287, 288, 289, 290, 291,
292, 293, -1, 295, -1, -1, 298, 299, 300, 301,
302, 303, 304, 305, 306, -1, 308, 309, 310, -1,
-1, 313, 314, 315, 316, 259, 260, 261, -1, -1,
264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, -1, 287, 288, 289, 290, 291, 292, 293,
-1, -1, 296, 297, -1, 299, 300, 301, 302, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 259, 260, 261, -1, -1, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
-1, 287, 288, 289, 290, 291, 292, 293, -1, 295,
296, 297, 298, -1, -1, -1, 302, 303, 304, 305,
-1, -1, 308, 309, 310, -1, -1, 313, 314, 315,
316, 259, 260, 261, -1, -1, 264, 265, 266, 267,
268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, -1, 287,
288, 289, 290, 291, 292, 293, -1, -1, 296, 297,
298, -1, -1, -1, 302, 303, 304, 305, -1, -1,
308, 309, 310, -1, -1, 313, 314, 315, 316, 259,
260, 261, -1, -1, 264, 265, 266, 267, 268, 269,
270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
280, 281, 282, 283, 284, 285, -1, 287, 288, 289,
-1, -1, -1, 293, -1, 295, -1, -1, 298, 299,
300, 301, 302, 303, 304, 305, 306, -1, 308, 309,
310, -1, -1, 313, 314, 315, 316, 259, 260, 261,
-1, -1, 264, 265, 266, 267, 268, 269, 270, 271,
272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
282, 283, 284, 285, -1, 287, 288, 289, -1, -1,
-1, 293, -1, 295, -1, -1, 298, 299, 300, 301,
302, 303, 304, 305, 306, -1, 308, 309, 310, -1,
-1, 313, 314, 315, 316, 259, 260, 261, -1, -1,
264, 265, 266, -1, -1, -1, -1, -1, -1, -1,
274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, -1, 287, 288, 289, 290, 291, 292, 293,
-1, -1, 296, 297, -1, 299, 300, 301, 302, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 259, 260, 261, -1, -1, 264, 265,
266, -1, -1, -1, -1, -1, -1, -1, 274, 275,
276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
-1, 287, -1, -1, -1, -1, -1, 293, -1, -1,
-1, -1, 298, 299, 300, 301, 302, 303, 304, 305,
306, -1, 308, 309, 310, -1, -1, 313, 314, 315,
316, 259, 260, 261, -1, -1, 264, 265, 266, -1,
-1, -1, -1, -1, -1, -1, 274, 275, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, -1, 287,
-1, -1, -1, -1, -1, 293, -1, -1, -1, -1,
298, 299, 300, 301, 302, 303, 304, 305, 306, -1,
308, 309, 310, -1, -1, 313, 314, 315, 316, 260,
-1, -1, 263, -1, -1, -1, 267, 268, 269, 270,
271, 272, 273, 274, -1, 276, 277, -1, 279, 280,
281, 282, 283, 284, 285, -1, 287, 288, 289, 290,
291, 292, 293, 260, -1, 296, 297, -1, 299, 300,
301, -1, 303, 304, 305, 306, -1, 308, 309, 310,
-1, -1, 313, 314, 315, 316, -1, -1, -1, -1,
287, 288, 289, 260, -1, -1, 293, -1, -1, -1,
-1, 298, 299, 300, 301, -1, 303, 304, 305, 306,
-1, 308, 309, 310, -1, -1, 313, 314, 315, 316,
287, 288, 289, -1, -1, -1, 293, -1, -1, -1,
-1, 298, 299, 300, 301, -1, 303, 304, 305, 306,
-1, 308, 309, 310, -1, -1, 313, 314, 315, 316,
263, -1, -1, -1, 267, 268, 269, 270, 271, 272,
273, 274, -1, 276, 277, 278, 279, 280, 281, 282,
283, 284, 285, -1, 287, 288, 289, 290, 291, 292,
293, -1, -1, 296, 297, -1, 299, 300, 301, -1,
303, 304, 305, 306, -1, 308, 309, 310, 265, -1,
313, 314, 315, 316, -1, -1, -1, 274, -1, 276,
277, 278, 279, 280, 281, 282, 283, 284, 285, -1,
287, 288, 289, 290, 291, 292, 293, -1, -1, 296,
297, -1, 299, 300, 301, -1, 303, 304, 305, 306,
-1, 308, 309, 310, -1, -1, 313, 314, 315, 316,
259, 260, 261, -1, -1, 264, 265, 266, 259, 260,
261, -1, -1, 264, 265, 266, 275, -1, -1, -1,
259, 260, 261, -1, 275, 264, 265, 266, 259, 260,
261, -1, -1, 264, 265, 266, 275, -1, -1, -1,
259, 260, 261, 302, 275, 264, 265, 266, 259, 260,
261, 302, -1, 264, 265, 266, 275, -1, -1, -1,
259, 260, 261, 302, 275, 264, 265, 266, 259, 260,
261, 302, -1, 264, 265, 266, 275, -1, -1, -1,
259, 260, 261, 302, 275, 264, 265, 266, 259, 260,
261, 302, -1, 264, 265, 266, 275, -1, -1, -1,
259, 260, 261, 302, 275, 264, 265, 266, -1, -1,
-1, 302, -1, -1, -1, -1, 275, -1, -1, -1,
-1, 265, -1, 302, -1, -1, -1, -1, -1, -1,
274, 302, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, -1, 302, -1, -1, -1, -1, 265, 267,
268, 269, 270, 271, 272, 273, -1, 274, 302, 276,
277, 278, 279, 280, 281, 282, 283, 284, 285, -1,
-1, -1, -1, -1, -1, 265, 267, 268, 269, 270,
271, 272, 273, -1, 274, 302, 276, 277, 278, 279,
280, 281, 282, 283, 284, 285, 267, 268, 269, 270,
271, 272, 273, 287, 288, 289, -1, 298, -1, 293,
-1, 302, 302, -1, 298, 299, 300, 301, -1, 303,
304, 305, 306, 307, 308, 309, 310, 298, -1, 313,
314, 315, 316, 287, 288, 289, -1, -1, -1, 293,
-1, -1, -1, -1, 298, 299, 300, 301, 302, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 287, 288, 289, -1, -1, -1, 293,
-1, -1, -1, -1, 298, 299, 300, 301, 302, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 287, 288, 289, -1, -1, -1, 293,
-1, -1, -1, -1, 298, 299, 300, 301, -1, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 287, 288, 289, -1, -1, -1, 293,
-1, -1, -1, -1, 298, 299, 300, 301, -1, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 287, 288, 289, -1, -1, -1, 293,
-1, -1, -1, -1, 298, 299, 300, 301, -1, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 287, 288, 289, -1, -1, -1, 293,
-1, -1, -1, -1, 298, 299, 300, 301, -1, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 287, 288, 289, -1, -1, -1, 293,
-1, -1, -1, -1, 298, 299, 300, 301, -1, 303,
304, 305, 306, -1, 308, 309, 310, -1, -1, 313,
314, 315, 316, 274, -1, 276, 277, 278, 279, 280,
281, 282, 283, 284, 285, 274, -1, 276, 277, 278,
279, 280, 281, 282, 283, 284, 285, -1, -1, -1,
274, 302, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, 274, 302, 276, 277, 278, 279, 280, 281,
282, 283, 284, 285, -1, -1, -1, 274, 302, 276,
277, 278, 279, 280, 281, 282, 283, 284, 285, 274,
302, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 259, 260, -1, -1, 302, -1, -1, -1, -1,
-1, -1, -1, -1, 260, -1, 274, 302, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, 274, 260,
276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
-1, -1, -1, 274, -1, 276, 277, 278, 279, 280,
281, 282, 283, 284, 285, 265, -1, -1, -1, -1,
-1, -1, -1, -1, 274, -1, 276, 277, 278, 279,
280, 281, 282, 283, 284, 285, 265, -1, -1, -1,
-1, -1, -1, -1, -1, 274, -1, 276, 277, 278,
279, 280, 281, 282, 283, 284, 285, 265, -1, -1,
-1, -1, -1, -1, -1, -1, 274, -1, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, 274, 275,
276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
274, -1, 276, 277, 278, 279, 280, 281, 282, 283,
284, 285, 277, 278, 279, 280, 281, 282, 283, 284,
285,
};
#define YYFINAL 25
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 330
#if YYDEBUG
char *yyname[] = {
"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,
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,
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,
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,
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,
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,
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",
"SEMI_COLON","LBRACE","RBRACE","LBOX","RBOX","COMMA","IO_OUT","ASSIGN",
"ADD_ASG","SUB_ASG","MUL_ASG","DIV_ASG","MOD_ASG","POW_ASG","QMARK","COLON",
"OR","AND","IN","MATCH","EQ","NEQ","LT","LTE","GT","GTE","CAT","GETLINE","PLUS",
"MINUS","MUL","DIV","MOD","NOT","UMINUS","IO_IN","PIPE","POW","INC_or_DEC",
"DOLLAR","FIELD","LPAREN","RPAREN","DOUBLE","STRING_","RE","ID","D_ID",
"FUNCT_ID","BUILTIN","LENGTH","PRINT","PRINTF","SPLIT","MATCH_FUNC","SUB",
"GSUB","DO","WHILE","FOR","BREAK","CONTINUE","IF","ELSE","DELETE","BEGIN","END",
"EXIT","NEXT","RETURN","FUNCTION",
};
char *yyrule[] = {
"$accept : program",
"program : program_block",
"program : program program_block",
"program_block : PA_block",
"program_block : function_def",
"program_block : outside_error block",
"PA_block : block",
"$$1 :",
"PA_block : BEGIN $$1 block",
"$$2 :",
"PA_block : END $$2 block",
"$$3 :",
"PA_block : expr $$3 block_or_separator",
"$$4 :",
"$$5 :",
"PA_block : expr COMMA $$4 expr $$5 block_or_separator",
"block : LBRACE statement_list RBRACE",
"block : LBRACE error RBRACE",
"block_or_separator : block",
"block_or_separator : separator",
"statement_list : statement",
"statement_list : statement_list statement",
"statement : block",
"statement : expr separator",
"statement : separator",
"statement : error separator",
"statement : BREAK separator",
"statement : CONTINUE separator",
"statement : return_statement",
"statement : NEXT separator",
"separator : NL",
"separator : SEMI_COLON",
"expr : cat_expr",
"expr : lvalue ASSIGN expr",
"expr : lvalue ADD_ASG expr",
"expr : lvalue SUB_ASG expr",
"expr : lvalue MUL_ASG expr",
"expr : lvalue DIV_ASG expr",
"expr : lvalue MOD_ASG expr",
"expr : lvalue POW_ASG expr",
"expr : expr EQ expr",
"expr : expr NEQ expr",
"expr : expr LT expr",
"expr : expr LTE expr",
"expr : expr GT expr",
"expr : expr GTE expr",
"expr : expr MATCH expr",
"$$6 :",
"expr : expr OR $$6 expr",
"$$7 :",
"expr : expr AND $$7 expr",
"$$8 :",
"$$9 :",
"expr : expr QMARK $$8 expr COLON $$9 expr",
"cat_expr : p_expr",
"cat_expr : cat_expr p_expr",
"p_expr : DOUBLE",
"p_expr : STRING_",
"p_expr : ID",
"p_expr : LPAREN expr RPAREN",
"p_expr : RE",
"p_expr : p_expr PLUS p_expr",
"p_expr : p_expr MINUS p_expr",
"p_expr : p_expr MUL p_expr",
"p_expr : p_expr DIV p_expr",
"p_expr : p_expr MOD p_expr",
"p_expr : p_expr POW p_expr",
"p_expr : NOT p_expr",
"p_expr : PLUS p_expr",
"p_expr : MINUS p_expr",
"p_expr : builtin",
"p_expr : ID INC_or_DEC",
"p_expr : INC_or_DEC lvalue",
"p_expr : field INC_or_DEC",
"p_expr : INC_or_DEC field",
"lvalue : ID",
"arglist :",
"arglist : args",
"args : expr",
"args : args COMMA expr",
"builtin : BUILTIN mark LPAREN arglist RPAREN",
"builtin : LENGTH",
"mark :",
"statement : print mark pr_args pr_direction separator",
"print : PRINT",
"print : PRINTF",
"pr_args : arglist",
"pr_args : LPAREN arg2 RPAREN",
"pr_args : LPAREN RPAREN",
"arg2 : expr COMMA expr",
"arg2 : arg2 COMMA expr",
"pr_direction :",
"pr_direction : IO_OUT expr",
"if_front : IF LPAREN expr RPAREN",
"statement : if_front statement",
"else : ELSE",
"statement : if_front statement else statement",
"do : DO",
"statement : do statement WHILE LPAREN expr RPAREN separator",
"while_front : WHILE LPAREN expr RPAREN",
"statement : while_front statement",
"statement : for1 for2 for3 statement",
"for1 : FOR LPAREN SEMI_COLON",
"for1 : FOR LPAREN expr SEMI_COLON",
"for2 : SEMI_COLON",
"for2 : expr SEMI_COLON",
"for3 : RPAREN",
"for3 : expr RPAREN",
"expr : expr IN ID",
"expr : LPAREN arg2 RPAREN IN ID",
"lvalue : ID mark LBOX args RBOX",
"p_expr : ID mark LBOX args RBOX",
"p_expr : ID mark LBOX args RBOX INC_or_DEC",
"statement : DELETE ID mark LBOX args RBOX separator",
"statement : DELETE ID separator",
"array_loop_front : FOR LPAREN ID IN ID RPAREN",
"statement : array_loop_front statement",
"field : FIELD",
"field : DOLLAR D_ID",
"field : DOLLAR D_ID mark LBOX args RBOX",
"field : DOLLAR p_expr",
"field : LPAREN field RPAREN",
"p_expr : field",
"expr : field ASSIGN expr",
"expr : field ADD_ASG expr",
"expr : field SUB_ASG expr",
"expr : field MUL_ASG expr",
"expr : field DIV_ASG expr",
"expr : field MOD_ASG expr",
"expr : field POW_ASG expr",
"p_expr : split_front split_back",
"split_front : SPLIT LPAREN expr COMMA ID",
"split_back : RPAREN",
"split_back : COMMA expr RPAREN",
"p_expr : MATCH_FUNC LPAREN expr COMMA re_arg RPAREN",
"re_arg : expr",
"statement : EXIT separator",
"statement : EXIT expr separator",
"return_statement : RETURN separator",
"return_statement : RETURN expr separator",
"p_expr : getline",
"p_expr : getline fvalue",
"p_expr : getline_file p_expr",
"p_expr : p_expr PIPE GETLINE",
"p_expr : p_expr PIPE GETLINE fvalue",
"getline : GETLINE",
"fvalue : lvalue",
"fvalue : field",
"getline_file : getline IO_IN",
"getline_file : getline fvalue IO_IN",
"p_expr : sub_or_gsub LPAREN re_arg COMMA expr sub_back",
"sub_or_gsub : SUB",
"sub_or_gsub : GSUB",
"sub_back : RPAREN",
"sub_back : COMMA fvalue RPAREN",
"function_def : funct_start block",
"funct_start : funct_head LPAREN f_arglist RPAREN",
"funct_head : FUNCTION ID",
"funct_head : FUNCTION FUNCT_ID",
"f_arglist :",
"f_arglist : f_args",
"f_args : ID",
"f_args : f_args COMMA ID",
"outside_error : error",
"p_expr : FUNCT_ID mark call_args",
"call_args : LPAREN RPAREN",
"call_args : ca_front ca_back",
"ca_front : LPAREN",
"ca_front : ca_front expr COMMA",
"ca_front : ca_front ID COMMA",
"ca_back : expr RPAREN",
"ca_back : ID RPAREN",
};
#endif
#ifdef YYPURE
#undef YYGLOBAL
#define YYLEX() yylex(&yylval)
#else
#define YYLEX() yylex()
#endif
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 500
#define YYMAXDEPTH 500
#endif
#endif
#ifdef YYGLOBAL /* get the standard byacc */
int yydebug;
int yynerrs;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
short yyss[YYSTACKSIZE];
YYSTYPE yyvs[YYSTACKSIZE];
#else
/* move everything but yydebug and yylval local to yyparse().
YYPURE moves yylval too */
int yydebug ;
#ifndef YYPURE
YYSTYPE yylval ;
#endif
#endif
#define yystacksize YYSTACKSIZE
#line 1144 "parse.y"
/* resize the code for a user function */
static void resize_fblock( fbp )
FBLOCK *fbp ;
{
CODEBLOCK *p = ZMALLOC(CODEBLOCK) ;
unsigned dummy ;
code2op(_RET0, _HALT) ;
/* make sure there is always a return */
*p = active_code ;
fbp->code = code_shrink(p, &dummy) ;
/* code_shrink() zfrees p */
if ( dump_code_flag ) add_to_fdump_list(fbp) ;
}
/* convert FE_PUSHA to FE_PUSHI
or F_PUSH to F_PUSHI
*/
static void field_A2I()
{ CELL *cp ;
if ( code_ptr[-1].op == FE_PUSHA &&
code_ptr[-1].ptr == (PTR) 0)
/* On most architectures, the two tests are the same; a good
compiler might eliminate one. On LM_DOS, and possibly other
segmented architectures, they are not */
{ code_ptr[-1].op = FE_PUSHI ; }
else
{
cp = (CELL *) code_ptr[-1].ptr ;
if ( cp == field ||
#ifdef MSDOS
SAMESEG(cp,field) &&
#endif
cp > NF && cp <= LAST_PFIELD )
{
code_ptr[-2].op = _PUSHI ;
}
else if ( cp == NF )
{ code_ptr[-2].op = NF_PUSHI ; code_ptr-- ; }
else
{
code_ptr[-2].op = F_PUSHI ;
code_ptr -> op = field_addr_to_index( code_ptr[-1].ptr ) ;
code_ptr++ ;
}
}
}
/* we've seen an ID in a context where it should be a VAR,
check that's consistent with previous usage */
static void check_var( p )
register SYMTAB *p ;
{
switch(p->type)
{
case ST_NONE : /* new id */
p->type = ST_VAR ;
p->stval.cp = ZMALLOC(CELL) ;
p->stval.cp->type = C_NOINIT ;
break ;
case ST_LOCAL_NONE :
p->type = ST_LOCAL_VAR ;
active_funct->typev[p->offset] = ST_LOCAL_VAR ;
break ;
case ST_VAR :
case ST_LOCAL_VAR : break ;
default :
type_error(p) ;
break ;
}
}
/* we've seen an ID in a context where it should be an ARRAY,
check that's consistent with previous usage */
static void check_array(p)
register SYMTAB *p ;
{
switch(p->type)
{
case ST_NONE : /* a new array */
p->type = ST_ARRAY ;
p->stval.array = new_ARRAY() ;
break ;
case ST_ARRAY :
case ST_LOCAL_ARRAY :
break ;
case ST_LOCAL_NONE :
p->type = ST_LOCAL_ARRAY ;
active_funct->typev[p->offset] = ST_LOCAL_ARRAY ;
break ;
default : type_error(p) ; break ;
}
}
static void code_array(p)
register SYMTAB *p ;
{
if ( is_local(p) ) code2op(LA_PUSHA, p->offset) ;
else code2(A_PUSHA, p->stval.array) ;
}
/* we've seen an ID as an argument to a user defined function */
static void code_call_id( p, ip )
register CA_REC *p ;
register SYMTAB *ip ;
{ static CELL dummy ;
p->call_offset = code_offset ;
/* This always get set now. So that fcall:relocate_arglist
works. */
switch( ip->type )
{
case ST_VAR :
p->type = CA_EXPR ;
code2(_PUSHI, ip->stval.cp) ;
break ;
case ST_LOCAL_VAR :
p->type = CA_EXPR ;
code2op(L_PUSHI, ip->offset) ;
break ;
case ST_ARRAY :
p->type = CA_ARRAY ;
code2(A_PUSHA, ip->stval.array) ;
break ;
case ST_LOCAL_ARRAY :
p->type = CA_ARRAY ;
code2op(LA_PUSHA, ip->offset) ;
break ;
/* not enough info to code it now; it will have to
be patched later */
case ST_NONE :
p->type = ST_NONE ;
p->sym_p = ip ;
code2(_PUSHI, &dummy) ;
break ;
case ST_LOCAL_NONE :
p->type = ST_LOCAL_NONE ;
p->type_p = & active_funct->typev[ip->offset] ;
code2op(L_PUSHI, ip->offset) ;
break ;
#ifdef DEBUG
default :
bozo("code_call_id") ;
#endif
}
}
/* an RE by itself was coded as _MATCH0 , change to
push as an expression */
static void RE_as_arg()
{ CELL *cp = ZMALLOC(CELL) ;
code_ptr -= 2 ;
cp->type = C_RE ;
cp->ptr = code_ptr[1].ptr ;
code2(_PUSHC, cp) ;
}
/* reset the active_code back to the MAIN block */
static void
switch_code_to_main()
{
switch(scope)
{
case SCOPE_BEGIN :
*begin_code_p = active_code ;
active_code = *main_code_p ;
break ;
case SCOPE_END :
*end_code_p = active_code ;
active_code = *main_code_p ;
break ;
case SCOPE_FUNCT :
active_code = *main_code_p ;
break ;
case SCOPE_MAIN :
break ;
}
active_funct = (FBLOCK*) 0 ;
scope = SCOPE_MAIN ;
}
void
parse()
{
if ( yyparse() || compile_error_count != 0 ) mawk_exit(2) ;
scan_cleanup() ;
set_code() ;
/* code must be set before call to resolve_fcalls() */
if ( resolve_list ) resolve_fcalls() ;
if ( compile_error_count != 0 ) mawk_exit(2) ;
if ( dump_code_flag ) { dump_code() ; mawk_exit(0) ; }
}
#line 1362 "y.tab.c"
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
int
yyparse()
{
register int yym, yyn, yystate;
#ifdef YYPURE
YYSTYPE yylval ;
#endif
#ifndef YYGLOBAL
int yynerrs;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
short yyss[YYSTACKSIZE];
YYSTYPE yyvs[YYSTACKSIZE];
#endif
#if YYDEBUG
register char *yys;
extern char *getenv();
if (yys = getenv("YYDEBUG"))
{
yyn = *yys;
if (yyn >= '0' && yyn <= '9')
yydebug = yyn - '0';
}
#endif
yynerrs = 0;
yyerrflag = 0;
yychar = (-1);
yyssp = yyss;
yyvsp = yyvs;
*yyssp = yystate = 0;
yyloop:
if (yyn = yydefred[yystate]) goto yyreduce;
if (yychar < 0)
{
if ((yychar = YYLEX()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
}
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
yychar = (-1);
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
}
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
yyn = yytable[yyn];
goto yyreduce;
}
if (yyerrflag) goto yyinrecovery;
#ifdef lint
goto yynewerror;
#endif
yynewerror:
yyerror("syntax error");
#ifdef lint
goto yyerrlab;
#endif
yyerrlab:
++yynerrs;
yyinrecovery:
if (yyerrflag < 3)
{
yyerrflag = 3;
for (;;)
{
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, error recovery shifting\
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
goto yyloop;
}
else
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: error recovery discarding state %d\n",
YYPREFIX, *yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
--yyssp;
--yyvsp;
}
}
}
else
{
if (yychar == 0) goto yyabort;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
yychar = (-1);
goto yyloop;
}
yyreduce:
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
yym = yylen[yyn];
yyval = yyvsp[1-yym];
switch (yyn)
{
case 6:
#line 210 "parse.y"
{ /* this do nothing action removes a vacuous warning
from Bison */
}
break;
case 7:
#line 215 "parse.y"
{ be_setup(scope = SCOPE_BEGIN) ; }
break;
case 8:
#line 218 "parse.y"
{ switch_code_to_main() ; }
break;
case 9:
#line 221 "parse.y"
{ be_setup(scope = SCOPE_END) ; }
break;
case 10:
#line 224 "parse.y"
{ switch_code_to_main() ; }
break;
case 11:
#line 227 "parse.y"
{ code_jmp(_JZ, (INST*)0) ; }
break;
case 12:
#line 230 "parse.y"
{ patch_jmp( code_ptr ) ; }
break;
case 13:
#line 234 "parse.y"
{
INST *p1 = CDP(yyvsp[-1].start) ;
int len ;
code_push(p1, code_ptr - p1, scope, active_funct) ;
code_ptr = p1 ;
code2op(_RANGE, 1) ;
code_ptr += 3 ;
len = code_pop(code_ptr) ;
code_ptr += len ;
code1(_STOP) ;
p1 = CDP(yyvsp[-1].start) ;
p1[2].op = code_ptr - (p1+1) ;
}
break;
case 14:
#line 250 "parse.y"
{ code1(_STOP) ; }
break;
case 15:
#line 253 "parse.y"
{
INST *p1 = CDP(yyvsp[-5].start) ;
p1[3].op = CDP(yyvsp[0].start) - (p1+1) ;
p1[4].op = code_ptr - (p1+1) ;
}
break;
case 16:
#line 264 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 17:
#line 266 "parse.y"
{ yyval.start = code_offset ; /* does nothing won't be executed */
print_flag = getline_flag = paren_cnt = 0 ;
yyerrok ; }
break;
case 19:
#line 273 "parse.y"
{ yyval.start = code_offset ;
code1(_PUSHINT) ; code1(0) ;
code2(_PRINT, bi_print) ;
}
break;
case 23:
#line 285 "parse.y"
{ code1(_POP) ; }
break;
case 24:
#line 287 "parse.y"
{ yyval.start = code_offset ; }
break;
case 25:
#line 289 "parse.y"
{ yyval.start = code_offset ;
print_flag = getline_flag = 0 ;
paren_cnt = 0 ;
yyerrok ;
}
break;
case 26:
#line 295 "parse.y"
{ yyval.start = code_offset ; BC_insert('B', code_ptr+1) ;
code2(_JMP, 0) /* don't use code_jmp ! */ ; }
break;
case 27:
#line 298 "parse.y"
{ yyval.start = code_offset ; BC_insert('C', code_ptr+1) ;
code2(_JMP, 0) ; }
break;
case 28:
#line 301 "parse.y"
{ if ( scope != SCOPE_FUNCT )
compile_error("return outside function body") ;
}
break;
case 29:
#line 305 "parse.y"
{ if ( scope != SCOPE_MAIN )
compile_error( "improper use of next" ) ;
yyval.start = code_offset ;
code1(_NEXT) ;
}
break;
case 33:
#line 316 "parse.y"
{ code1(_ASSIGN) ; }
break;
case 34:
#line 317 "parse.y"
{ code1(_ADD_ASG) ; }
break;
case 35:
#line 318 "parse.y"
{ code1(_SUB_ASG) ; }
break;
case 36:
#line 319 "parse.y"
{ code1(_MUL_ASG) ; }
break;
case 37:
#line 320 "parse.y"
{ code1(_DIV_ASG) ; }
break;
case 38:
#line 321 "parse.y"
{ code1(_MOD_ASG) ; }
break;
case 39:
#line 322 "parse.y"
{ code1(_POW_ASG) ; }
break;
case 40:
#line 323 "parse.y"
{ code1(_EQ) ; }
break;
case 41:
#line 324 "parse.y"
{ code1(_NEQ) ; }
break;
case 42:
#line 325 "parse.y"
{ code1(_LT) ; }
break;
case 43:
#line 326 "parse.y"
{ code1(_LTE) ; }
break;
case 44:
#line 327 "parse.y"
{ code1(_GT) ; }
break;
case 45:
#line 328 "parse.y"
{ code1(_GTE) ; }
break;
case 46:
#line 331 "parse.y"
{
INST *p3 = CDP(yyvsp[0].start) ;
if ( p3 == code_ptr - 2 )
{
if ( p3->op == _MATCH0 ) p3->op = _MATCH1 ;
else /* check for string */
if ( p3->op == _PUSHS )
{ CELL *cp = ZMALLOC(CELL) ;
cp->type = C_STRING ;
cp->ptr = p3[1].ptr ;
cast_to_RE(cp) ;
code_ptr -= 2 ;
code2(_MATCH1, cp->ptr) ;
ZFREE(cp) ;
}
else code1(_MATCH2) ;
}
else code1(_MATCH2) ;
if ( !yyvsp[-1].ival ) code1(_NOT) ;
}
break;
case 47:
#line 358 "parse.y"
{ code1(_TEST) ;
code_jmp(_LJNZ, (INST*)0) ;
}
break;
case 48:
#line 362 "parse.y"
{ code1(_TEST) ; patch_jmp(code_ptr) ; }
break;
case 49:
#line 365 "parse.y"
{ code1(_TEST) ;
code_jmp(_LJZ, (INST*)0) ;
}
break;
case 50:
#line 369 "parse.y"
{ code1(_TEST) ; patch_jmp(code_ptr) ; }
break;
case 51:
#line 371 "parse.y"
{ code_jmp(_JZ, (INST*)0) ; }
break;
case 52:
#line 372 "parse.y"
{ code_jmp(_JMP, (INST*)0) ; }
break;
case 53:
#line 374 "parse.y"
{ patch_jmp(code_ptr) ; patch_jmp(CDP(yyvsp[0].start)) ; }
break;
case 55:
#line 379 "parse.y"
{ code1(_CAT) ; }
break;
case 56:
#line 383 "parse.y"
{ yyval.start = code_offset ; code2(_PUSHD, yyvsp[0].ptr) ; }
break;
case 57:
#line 385 "parse.y"
{ yyval.start = code_offset ; code2(_PUSHS, yyvsp[0].ptr) ; }
break;
case 58:
#line 387 "parse.y"
{ check_var(yyvsp[0].stp) ;
yyval.start = code_offset ;
if ( is_local(yyvsp[0].stp) )
{ code2op(L_PUSHI, yyvsp[0].stp->offset) ; }
else code2(_PUSHI, yyvsp[0].stp->stval.cp) ;
}
break;
case 59:
#line 395 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 60:
#line 399 "parse.y"
{ yyval.start = code_offset ; code2(_MATCH0, yyvsp[0].ptr) ; }
break;
case 61:
#line 402 "parse.y"
{ code1(_ADD) ; }
break;
case 62:
#line 403 "parse.y"
{ code1(_SUB) ; }
break;
case 63:
#line 404 "parse.y"
{ code1(_MUL) ; }
break;
case 64:
#line 405 "parse.y"
{ code1(_DIV) ; }
break;
case 65:
#line 406 "parse.y"
{ code1(_MOD) ; }
break;
case 66:
#line 407 "parse.y"
{ code1(_POW) ; }
break;
case 67:
#line 409 "parse.y"
{ yyval.start = yyvsp[0].start ; code1(_NOT) ; }
break;
case 68:
#line 411 "parse.y"
{ yyval.start = yyvsp[0].start ; code1(_UPLUS) ; }
break;
case 69:
#line 413 "parse.y"
{ yyval.start = yyvsp[0].start ; code1(_UMINUS) ; }
break;
case 71:
#line 418 "parse.y"
{ check_var(yyvsp[-1].stp) ;
yyval.start = code_offset ;
code_address(yyvsp[-1].stp) ;
if ( yyvsp[0].ival == '+' ) code1(_POST_INC) ;
else code1(_POST_DEC) ;
}
break;
case 72:
#line 426 "parse.y"
{ yyval.start = yyvsp[0].start ;
if ( yyvsp[-1].ival == '+' ) code1(_PRE_INC) ;
else code1(_PRE_DEC) ;
}
break;
case 73:
#line 433 "parse.y"
{ if (yyvsp[0].ival == '+' ) code1(F_POST_INC ) ;
else code1(F_POST_DEC) ;
}
break;
case 74:
#line 437 "parse.y"
{ yyval.start = yyvsp[0].start ;
if ( yyvsp[-1].ival == '+' ) code1(F_PRE_INC) ;
else code1( F_PRE_DEC) ;
}
break;
case 75:
#line 444 "parse.y"
{ yyval.start = code_offset ;
check_var(yyvsp[0].stp) ;
code_address(yyvsp[0].stp) ;
}
break;
case 76:
#line 452 "parse.y"
{ yyval.ival = 0 ; }
break;
case 78:
#line 457 "parse.y"
{ yyval.ival = 1 ; }
break;
case 79:
#line 459 "parse.y"
{ yyval.ival = yyvsp[-2].ival + 1 ; }
break;
case 80:
#line 464 "parse.y"
{ BI_REC *p = yyvsp[-4].bip ;
yyval.start = yyvsp[-3].start ;
if ( (int)p->min_args > yyvsp[-1].ival || (int)p->max_args < yyvsp[-1].ival )
compile_error(
"wrong number of arguments in call to %s" ,
p->name ) ;
if ( p->min_args != p->max_args ) /* variable args */
{ code1(_PUSHINT) ; code1(yyvsp[-1].ival) ; }
code2(_BUILTIN , p->fp) ;
}
break;
case 81:
#line 475 "parse.y"
{
yyval.start = code_offset ;
code1(_PUSHINT) ; code1(0) ;
code2(_BUILTIN, yyvsp[0].bip->fp) ;
}
break;
case 82:
#line 484 "parse.y"
{ yyval.start = code_offset ; }
break;
case 83:
#line 488 "parse.y"
{ code2(_PRINT, yyvsp[-4].fp) ;
if ( yyvsp[-4].fp == bi_printf && yyvsp[-2].ival == 0 )
compile_error("no arguments in call to printf") ;
print_flag = 0 ;
yyval.start = yyvsp[-3].start ;
}
break;
case 84:
#line 496 "parse.y"
{ yyval.fp = bi_print ; print_flag = 1 ;}
break;
case 85:
#line 497 "parse.y"
{ yyval.fp = bi_printf ; print_flag = 1 ; }
break;
case 86:
#line 500 "parse.y"
{ code2op(_PUSHINT, yyvsp[0].ival) ; }
break;
case 87:
#line 502 "parse.y"
{ yyval.ival = yyvsp[-1].arg2p->cnt ; zfree(yyvsp[-1].arg2p,sizeof(ARG2_REC)) ;
code2op(_PUSHINT, yyval.ival) ;
}
break;
case 88:
#line 506 "parse.y"
{ yyval.ival=0 ; code2op(_PUSHINT, 0) ; }
break;
case 89:
#line 510 "parse.y"
{ yyval.arg2p = (ARG2_REC*) zmalloc(sizeof(ARG2_REC)) ;
yyval.arg2p->start = yyvsp[-2].start ;
yyval.arg2p->cnt = 2 ;
}
break;
case 90:
#line 515 "parse.y"
{ yyval.arg2p = yyvsp[-2].arg2p ; yyval.arg2p->cnt++ ; }
break;
case 92:
#line 520 "parse.y"
{ code2op(_PUSHINT, yyvsp[-1].ival) ; }
break;
case 93:
#line 527 "parse.y"
{ yyval.start = yyvsp[-1].start ; eat_nl() ; code_jmp(_JZ, (INST*)0) ; }
break;
case 94:
#line 532 "parse.y"
{ patch_jmp( code_ptr ) ; }
break;
case 95:
#line 535 "parse.y"
{ eat_nl() ; code_jmp(_JMP, (INST*)0) ; }
break;
case 96:
#line 540 "parse.y"
{ patch_jmp(code_ptr) ;
patch_jmp(CDP(yyvsp[0].start)) ;
}
break;
case 97:
#line 548 "parse.y"
{ eat_nl() ; BC_new() ; }
break;
case 98:
#line 553 "parse.y"
{ yyval.start = yyvsp[-5].start ;
code_jmp(_JNZ, CDP(yyvsp[-5].start)) ;
BC_clear(code_ptr, CDP(yyvsp[-2].start)) ; }
break;
case 99:
#line 559 "parse.y"
{ eat_nl() ; BC_new() ;
yyval.start = yyvsp[-1].start ;
/* check if const expression */
if ( code_ptr - 2 == CDP(yyvsp[-1].start) &&
code_ptr[-2].op == _PUSHD &&
*(double*)code_ptr[-1].ptr != 0.0
)
code_ptr -= 2 ;
else
{ INST *p3 = CDP(yyvsp[-1].start) ;
code_push(p3, code_ptr-p3, scope, active_funct) ;
code_ptr = p3 ;
code2(_JMP, (INST*)0) ; /* code2() not code_jmp() */
}
}
break;
case 100:
#line 579 "parse.y"
{
int saved_offset ;
int len ;
INST *p1 = CDP(yyvsp[-1].start) ;
INST *p2 = CDP(yyvsp[0].start) ;
if ( p1 != p2 ) /* real test in loop */
{
p1[1].op = code_ptr-(p1+1) ;
saved_offset = code_offset ;
len = code_pop(code_ptr) ;
code_ptr += len ;
code_jmp(_JNZ, CDP(yyvsp[0].start)) ;
BC_clear(code_ptr, CDP(saved_offset)) ;
}
else /* while(1) */
{
code_jmp(_JMP, p1) ;
BC_clear(code_ptr, CDP(yyvsp[0].start)) ;
}
}
break;
case 101:
#line 605 "parse.y"
{
int cont_offset = code_offset ;
unsigned len = code_pop(code_ptr) ;
INST *p2 = CDP(yyvsp[-2].start) ;
INST *p4 = CDP(yyvsp[0].start) ;
code_ptr += len ;
if ( p2 != p4 ) /* real test in for2 */
{
p4[-1].op = code_ptr - p4 + 1 ;
len = code_pop(code_ptr) ;
code_ptr += len ;
code_jmp(_JNZ, CDP(yyvsp[0].start)) ;
}
else /* for(;;) */
code_jmp(_JMP, p4) ;
BC_clear(code_ptr, CDP(cont_offset)) ;
}
break;
case 102:
#line 628 "parse.y"
{ yyval.start = code_offset ; }
break;
case 103:
#line 630 "parse.y"
{ yyval.start = yyvsp[-1].start ; code1(_POP) ; }
break;
case 104:
#line 633 "parse.y"
{ yyval.start = code_offset ; }
break;
case 105:
#line 635 "parse.y"
{
if ( code_ptr - 2 == CDP(yyvsp[-1].start) &&
code_ptr[-2].op == _PUSHD &&
* (double*) code_ptr[-1].ptr != 0.0
)
code_ptr -= 2 ;
else
{
INST *p1 = CDP(yyvsp[-1].start) ;
code_push(p1, code_ptr-p1, scope, active_funct) ;
code_ptr = p1 ;
code2(_JMP, (INST*)0) ;
}
}
break;
case 106:
#line 652 "parse.y"
{ eat_nl() ; BC_new() ;
code_push((INST*)0,0, scope, active_funct) ;
}
break;
case 107:
#line 656 "parse.y"
{ INST *p1 = CDP(yyvsp[-1].start) ;
eat_nl() ; BC_new() ;
code1(_POP) ;
code_push(p1, code_ptr - p1, scope, active_funct) ;
code_ptr -= code_ptr - p1 ;
}
break;
case 108:
#line 669 "parse.y"
{ check_array(yyvsp[0].stp) ;
code_array(yyvsp[0].stp) ;
code1(A_TEST) ;
}
break;
case 109:
#line 674 "parse.y"
{ yyval.start = yyvsp[-3].arg2p->start ;
code2op(A_CAT, yyvsp[-3].arg2p->cnt) ;
zfree(yyvsp[-3].arg2p, sizeof(ARG2_REC)) ;
check_array(yyvsp[0].stp) ;
code_array(yyvsp[0].stp) ;
code1(A_TEST) ;
}
break;
case 110:
#line 685 "parse.y"
{
if ( yyvsp[-1].ival > 1 )
{ code2op(A_CAT, yyvsp[-1].ival) ; }
check_array(yyvsp[-4].stp) ;
if( is_local(yyvsp[-4].stp) )
{ code2op(LAE_PUSHA, yyvsp[-4].stp->offset) ; }
else code2(AE_PUSHA, yyvsp[-4].stp->stval.array) ;
yyval.start = yyvsp[-3].start ;
}
break;
case 111:
#line 698 "parse.y"
{
if ( yyvsp[-1].ival > 1 )
{ code2op(A_CAT, yyvsp[-1].ival) ; }
check_array(yyvsp[-4].stp) ;
if( is_local(yyvsp[-4].stp) )
{ code2op(LAE_PUSHI, yyvsp[-4].stp->offset) ; }
else code2(AE_PUSHI, yyvsp[-4].stp->stval.array) ;
yyval.start = yyvsp[-3].start ;
}
break;
case 112:
#line 710 "parse.y"
{
if ( yyvsp[-2].ival > 1 )
{ code2op(A_CAT,yyvsp[-2].ival) ; }
check_array(yyvsp[-5].stp) ;
if( is_local(yyvsp[-5].stp) )
{ code2op(LAE_PUSHA, yyvsp[-5].stp->offset) ; }
else code2(AE_PUSHA, yyvsp[-5].stp->stval.array) ;
if ( yyvsp[0].ival == '+' ) code1(_POST_INC) ;
else code1(_POST_DEC) ;
yyval.start = yyvsp[-4].start ;
}
break;
case 113:
#line 727 "parse.y"
{
yyval.start = yyvsp[-4].start ;
if ( yyvsp[-2].ival > 1 ) { code2op(A_CAT, yyvsp[-2].ival) ; }
check_array(yyvsp[-5].stp) ;
code_array(yyvsp[-5].stp) ;
code1(A_DEL) ;
}
break;
case 114:
#line 735 "parse.y"
{
yyval.start = code_offset ;
check_array(yyvsp[-1].stp) ;
code_array(yyvsp[-1].stp) ;
code1(DEL_A) ;
}
break;
case 115:
#line 746 "parse.y"
{ eat_nl() ; BC_new() ;
yyval.start = code_offset ;
check_var(yyvsp[-3].stp) ;
code_address(yyvsp[-3].stp) ;
check_array(yyvsp[-1].stp) ;
code_array(yyvsp[-1].stp) ;
code2(SET_ALOOP, (INST*)0) ;
}
break;
case 116:
#line 760 "parse.y"
{
INST *p2 = CDP(yyvsp[0].start) ;
p2[-1].op = code_ptr - p2 + 1 ;
BC_clear( code_ptr+2 , code_ptr) ;
code_jmp(ALOOP, p2) ;
code1(POP_AL) ;
}
break;
case 117:
#line 777 "parse.y"
{ yyval.start = code_offset ; code2(F_PUSHA, yyvsp[0].cp) ; }
break;
case 118:
#line 779 "parse.y"
{ check_var(yyvsp[0].stp) ;
yyval.start = code_offset ;
if ( is_local(yyvsp[0].stp) )
{ code2op(L_PUSHI, yyvsp[0].stp->offset) ; }
else code2(_PUSHI, yyvsp[0].stp->stval.cp) ;
CODE_FE_PUSHA() ;
}
break;
case 119:
#line 788 "parse.y"
{
if ( yyvsp[-1].ival > 1 )
{ code2op(A_CAT, yyvsp[-1].ival) ; }
check_array(yyvsp[-4].stp) ;
if( is_local(yyvsp[-4].stp) )
{ code2op(LAE_PUSHI, yyvsp[-4].stp->offset) ; }
else code2(AE_PUSHI, yyvsp[-4].stp->stval.array) ;
CODE_FE_PUSHA() ;
yyval.start = yyvsp[-3].start ;
}
break;
case 120:
#line 802 "parse.y"
{ yyval.start = yyvsp[0].start ; CODE_FE_PUSHA() ; }
break;
case 121:
#line 804 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 122:
#line 808 "parse.y"
{ field_A2I() ; }
break;
case 123:
#line 811 "parse.y"
{ code1(F_ASSIGN) ; }
break;
case 124:
#line 812 "parse.y"
{ code1(F_ADD_ASG) ; }
break;
case 125:
#line 813 "parse.y"
{ code1(F_SUB_ASG) ; }
break;
case 126:
#line 814 "parse.y"
{ code1(F_MUL_ASG) ; }
break;
case 127:
#line 815 "parse.y"
{ code1(F_DIV_ASG) ; }
break;
case 128:
#line 816 "parse.y"
{ code1(F_MOD_ASG) ; }
break;
case 129:
#line 817 "parse.y"
{ code1(F_POW_ASG) ; }
break;
case 130:
#line 824 "parse.y"
{ code2(_BUILTIN, bi_split) ; }
break;
case 131:
#line 828 "parse.y"
{ yyval.start = yyvsp[-2].start ;
check_array(yyvsp[0].stp) ;
code_array(yyvsp[0].stp) ;
}
break;
case 132:
#line 835 "parse.y"
{ code2(_PUSHI, &fs_shadow) ; }
break;
case 133:
#line 837 "parse.y"
{
if ( CDP(yyvsp[-1].start) == code_ptr - 2 )
{
if ( code_ptr[-2].op == _MATCH0 )
RE_as_arg() ;
else
if ( code_ptr[-2].op == _PUSHS )
{ CELL *cp = ZMALLOC(CELL) ;
cp->type = C_STRING ;
cp->ptr = code_ptr[-1].ptr ;
cast_for_split(cp) ;
code_ptr[-2].op = _PUSHC ;
code_ptr[-1].ptr = (PTR) cp ;
}
}
}
break;
case 134:
#line 861 "parse.y"
{ yyval.start = yyvsp[-3].start ;
code2(_BUILTIN, bi_match) ;
}
break;
case 135:
#line 868 "parse.y"
{
INST *p1 = CDP(yyvsp[0].start) ;
if ( p1 == code_ptr - 2 )
{
if ( p1->op == _MATCH0 ) RE_as_arg() ;
else
if ( p1->op == _PUSHS )
{ CELL *cp = ZMALLOC(CELL) ;
cp->type = C_STRING ;
cp->ptr = p1[1].ptr ;
cast_to_RE(cp) ;
p1->op = _PUSHC ;
p1[1].ptr = (PTR) cp ;
}
}
}
break;
case 136:
#line 891 "parse.y"
{ yyval.start = code_offset ;
code1(_EXIT0) ; }
break;
case 137:
#line 894 "parse.y"
{ yyval.start = yyvsp[-1].start ; code1(_EXIT) ; }
break;
case 138:
#line 897 "parse.y"
{ yyval.start = code_offset ;
code1(_RET0) ; }
break;
case 139:
#line 900 "parse.y"
{ yyval.start = yyvsp[-1].start ; code1(_RET) ; }
break;
case 140:
#line 905 "parse.y"
{ yyval.start = code_offset ;
code2(F_PUSHA, &field[0]) ;
code1(_PUSHINT) ; code1(0) ;
code2(_BUILTIN, bi_getline) ;
getline_flag = 0 ;
}
break;
case 141:
#line 912 "parse.y"
{ yyval.start = yyvsp[0].start ;
code1(_PUSHINT) ; code1(0) ;
code2(_BUILTIN, bi_getline) ;
getline_flag = 0 ;
}
break;
case 142:
#line 918 "parse.y"
{ code1(_PUSHINT) ; code1(F_IN) ;
code2(_BUILTIN, bi_getline) ;
/* getline_flag already off in yylex() */
}
break;
case 143:
#line 923 "parse.y"
{ code2(F_PUSHA, &field[0]) ;
code1(_PUSHINT) ; code1(PIPE_IN) ;
code2(_BUILTIN, bi_getline) ;
}
break;
case 144:
#line 928 "parse.y"
{
code1(_PUSHINT) ; code1(PIPE_IN) ;
code2(_BUILTIN, bi_getline) ;
}
break;
case 145:
#line 934 "parse.y"
{ getline_flag = 1 ; }
break;
case 148:
#line 939 "parse.y"
{ yyval.start = code_offset ;
code2(F_PUSHA, field+0) ;
}
break;
case 149:
#line 943 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 150:
#line 951 "parse.y"
{
INST *p5 = CDP(yyvsp[-1].start) ;
INST *p6 = CDP(yyvsp[0].start) ;
if ( p6 - p5 == 2 && p5->op == _PUSHS )
{ /* cast from STRING to REPL at compile time */
CELL *cp = ZMALLOC(CELL) ;
cp->type = C_STRING ;
cp->ptr = p5[1].ptr ;
cast_to_REPL(cp) ;
p5->op = _PUSHC ;
p5[1].ptr = (PTR) cp ;
}
code2(_BUILTIN, yyvsp[-5].fp) ;
yyval.start = yyvsp[-3].start ;
}
break;
case 151:
#line 969 "parse.y"
{ yyval.fp = bi_sub ; }
break;
case 152:
#line 970 "parse.y"
{ yyval.fp = bi_gsub ; }
break;
case 153:
#line 975 "parse.y"
{ yyval.start = code_offset ;
code2(F_PUSHA, &field[0]) ;
}
break;
case 154:
#line 980 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 155:
#line 988 "parse.y"
{
resize_fblock(yyvsp[-1].fbp) ;
restore_ids() ;
switch_code_to_main() ;
}
break;
case 156:
#line 997 "parse.y"
{ eat_nl() ;
scope = SCOPE_FUNCT ;
active_funct = yyvsp[-3].fbp ;
*main_code_p = active_code ;
yyvsp[-3].fbp->nargs = yyvsp[-1].ival ;
if ( yyvsp[-1].ival )
yyvsp[-3].fbp->typev = (char *)
memset( zmalloc(yyvsp[-1].ival), ST_LOCAL_NONE, yyvsp[-1].ival) ;
else yyvsp[-3].fbp->typev = (char *) 0 ;
code_ptr = code_base =
(INST *) zmalloc(INST_BYTES(PAGESZ));
code_limit = code_base + PAGESZ ;
code_warn = code_limit - CODEWARN ;
}
break;
case 157:
#line 1016 "parse.y"
{ FBLOCK *fbp ;
if ( yyvsp[0].stp->type == ST_NONE )
{
yyvsp[0].stp->type = ST_FUNCT ;
fbp = yyvsp[0].stp->stval.fbp =
(FBLOCK *) zmalloc(sizeof(FBLOCK)) ;
fbp->name = yyvsp[0].stp->name ;
fbp->code = (INST*) 0 ;
}
else
{
type_error( yyvsp[0].stp ) ;
/* this FBLOCK will not be put in
the symbol table */
fbp = (FBLOCK*) zmalloc(sizeof(FBLOCK)) ;
fbp->name = "" ;
}
yyval.fbp = fbp ;
}
break;
case 158:
#line 1039 "parse.y"
{ yyval.fbp = yyvsp[0].fbp ;
if ( yyvsp[0].fbp->code )
compile_error("redefinition of %s" , yyvsp[0].fbp->name) ;
}
break;
case 159:
#line 1045 "parse.y"
{ yyval.ival = 0 ; }
break;
case 161:
#line 1050 "parse.y"
{ yyvsp[0].stp = save_id(yyvsp[0].stp->name) ;
yyvsp[0].stp->type = ST_LOCAL_NONE ;
yyvsp[0].stp->offset = 0 ;
yyval.ival = 1 ;
}
break;
case 162:
#line 1056 "parse.y"
{ if ( is_local(yyvsp[0].stp) )
compile_error("%s is duplicated in argument list",
yyvsp[0].stp->name) ;
else
{ yyvsp[0].stp = save_id(yyvsp[0].stp->name) ;
yyvsp[0].stp->type = ST_LOCAL_NONE ;
yyvsp[0].stp->offset = yyvsp[-2].ival ;
yyval.ival = yyvsp[-2].ival + 1 ;
}
}
break;
case 163:
#line 1069 "parse.y"
{ /* we may have to recover from a bungled function
definition */
/* can have local ids, before code scope
changes */
restore_ids() ;
switch_code_to_main() ;
}
break;
case 164:
#line 1082 "parse.y"
{ yyval.start = yyvsp[-1].start ;
code2(_CALL, yyvsp[-2].fbp) ;
if ( yyvsp[0].ca_p ) code1(yyvsp[0].ca_p->arg_num+1) ;
else code1(0) ;
check_fcall(yyvsp[-2].fbp, scope, code_move_level, active_funct,
yyvsp[0].ca_p, token_lineno) ;
}
break;
case 165:
#line 1094 "parse.y"
{ yyval.ca_p = (CA_REC *) 0 ; }
break;
case 166:
#line 1096 "parse.y"
{ yyval.ca_p = yyvsp[0].ca_p ;
yyval.ca_p->link = yyvsp[-1].ca_p ;
yyval.ca_p->arg_num = yyvsp[-1].ca_p ? yyvsp[-1].ca_p->arg_num+1 : 0 ;
}
break;
case 167:
#line 1111 "parse.y"
{ yyval.ca_p = (CA_REC *) 0 ; }
break;
case 168:
#line 1113 "parse.y"
{ yyval.ca_p = ZMALLOC(CA_REC) ;
yyval.ca_p->link = yyvsp[-2].ca_p ;
yyval.ca_p->type = CA_EXPR ;
yyval.ca_p->arg_num = yyvsp[-2].ca_p ? yyvsp[-2].ca_p->arg_num+1 : 0 ;
yyval.ca_p->call_offset = code_offset ;
}
break;
case 169:
#line 1120 "parse.y"
{ yyval.ca_p = ZMALLOC(CA_REC) ;
yyval.ca_p->link = yyvsp[-2].ca_p ;
yyval.ca_p->arg_num = yyvsp[-2].ca_p ? yyvsp[-2].ca_p->arg_num+1 : 0 ;
code_call_id(yyval.ca_p, yyvsp[-1].stp) ;
}
break;
case 170:
#line 1129 "parse.y"
{ yyval.ca_p = ZMALLOC(CA_REC) ;
yyval.ca_p->type = CA_EXPR ;
yyval.ca_p->call_offset = code_offset ;
}
break;
case 171:
#line 1135 "parse.y"
{ yyval.ca_p = ZMALLOC(CA_REC) ;
code_call_id(yyval.ca_p, yyvsp[-1].stp) ;
}
break;
#line 2566 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
yyvsp -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state 0 to\
state %d\n", YYPREFIX, YYFINAL);
#endif
yystate = YYFINAL;
*++yyssp = YYFINAL;
*++yyvsp = yyval;
if (yychar < 0)
{
if ((yychar = YYLEX()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}
#endif
}
if (yychar == 0) goto yyaccept;
goto yyloop;
}
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
yystate = yytable[yyn];
else
yystate = yydgoto[yym];
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yyssp, yystate);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate;
*++yyvsp = yyval;
goto yyloop;
yyoverflow:
yyerror("yacc stack overflow");
yyabort:
return (1);
yyaccept:
return (0);
}