home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
MAWK113.ZIP
/
mawk113
/
parse.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-02-06
|
91KB
|
2,629 lines
#ifndef lint
static char yyid[] = "@(#)modification of yaccpar 1.8 (Berkeley) 01/20/90";
#endif
#define YYXBYACC 1 /* XBYACC -- modified Berkeley yacc */
/*
Berkeley yacc modified so only tables and
yydebug and yylval are global
#define YYGLOBAL -- gives standard byacc
#define YYPURE -- gives a reentrant parser
Mike Brennan 11/05/91
*/
#line 31 "parse.y"
#include <stdio.h>
#include "mawk.h"
#include "code.h"
#include "symtype.h"
#include "memory.h"
#include "bi_funct.h"
#include "bi_vars.h"
#include "jmp.h"
#include "field.h"
#include "files.h"
#ifdef YYXBYACC
#define YYBYACC 1
#endif
#define YYMAXDEPTH 200
/* Bison's use of MSDOS and ours clashes */
#undef MSDOS
extern void PROTO( eat_nl, (void) ) ;
static void PROTO( resize_fblock, (FBLOCK *, INST *) ) ;
static void PROTO( code_array, (SYMTAB *) ) ;
static void PROTO( code_call_id, (CA_REC *, SYMTAB *) ) ;
static void PROTO( field_A2I, (void)) ;
static int PROTO( current_offset, (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) )\
{ code1(L_PUSHA) ; code1((x)->offset) ; }\
else code2(_PUSHA, (x)->stval.cp)
/* this nonsense caters to MSDOS large model */
#define CODE_FE_PUSHA() code_ptr->ptr = (PTR) 0 ; code1(FE_PUSHA)
#line 74 "parse.y"
typedef union{
CELL *cp ;
SYMTAB *stp ;
INST *start ; /* code starting address */
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 69 "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, 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, 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,
162, 0, 144, 0, 0, 0, 0, 0, 116, 0,
56, 57, 60, 0, 82, 82, 81, 0, 0, 150,
151, 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,
119, 0, 0, 0, 71, 0, 0, 0, 0, 0,
0, 0, 156, 157, 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, 131, 129, 0, 154, 0, 5, 147,
145, 146, 0, 17, 25, 0, 0, 26, 27, 0,
82, 0, 135, 29, 0, 137, 0, 16, 21, 23,
100, 0, 104, 0, 0, 115, 0, 0, 0, 0,
0, 0, 0, 0, 0, 120, 0, 59, 0, 0,
163, 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, 160, 0, 0, 148,
0, 102, 0, 0, 0, 0, 136, 138, 95, 0,
105, 106, 0, 0, 0, 0, 0, 86, 0, 0,
0, 0, 0, 0, 0, 0, 0, 164, 0, 0,
165, 0, 0, 0, 0, 0, 0, 0, 143, 132,
0, 155, 0, 99, 0, 103, 93, 0, 96, 107,
101, 88, 0, 0, 0, 0, 0, 0, 0, 0,
109, 0, 168, 170, 167, 169, 80, 130, 0, 0,
52, 0, 161, 0, 0, 0, 0, 83, 0, 0,
0, 110, 118, 112, 133, 15, 0, 0, 152, 149,
114, 0, 0, 0, 0, 113, 98, 153,
};
short yydgoto[] = { 25,
58, 215, 59, 60, 86, 246, 82, 27, 28, 29,
30, 143, 61, 32, 33, 62, 63, 64, 165, 65,
66, 34, 226, 320, 248, 249, 67, 35, 36, 37,
181, 182, 261, 228, 229, 38, 39, 40, 41, 91,
92, 124, 202, 300, 68, 204, 205, 203, 317, 285,
240, 69, 244, 135, 42,
};
short yysindex[] = { 35,
0, 278, 0, 2243, 2243, 2243, -26, 2153, 0, 2273,
0, 0, 0, -286, 0, 0, 0, -269, -228, 0,
0, 0, 0, -255, 35, 0, 0, 2243, 284, 2166,
2547, 2243, 116, -257, -161, -246, -159, 0, 0, 0,
-246, -63, -124, 0, 0, 0, 0, 0, -157, -151,
-196, -196, -148, -141, 1729, -196, 1729, 0, 130, 0,
2499, 352, 352, 69, 352, 0, 0, 0, 352, 2273,
-286, -220, -211, -211, -211, -282, 0, 0, 0, 0,
0, -232, 2146, 2093, 0, -96, -132, -122, 2273, 2273,
-246, -246, 0, 0, 0, -120, 2273, 2273, 2273, 2273,
2273, 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2273,
0, 0, 0, 0, 0, -110, 2273, 2273, 2273, 2273,
2273, 2273, 2273, -167, 116, 2243, 2243, 2243, 2243, 2243,
-65, 2243, 2273, 0, 0, 2273, 0, -78, 0, 0,
0, 0, -50, 0, 0, 2273, 1820, 0, 0, 2273,
0, 2499, 0, 0, 2499, 0, -196, 0, 0, 0,
0, -72, 0, 2511, 2183, 0, 2303, -61, 2406, -4,
-41, 3, 23, 2273, 6, 0, 2273, 0, 2273, -13,
0, 2333, 2273, 2568, 2589, 0, 0, 2613, 2613, 2613,
2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613,
2613, 2273, 2273, 2273, 2273, 0, -95, 0, 0, 0,
0, 0, 0, 0, 0, 0, -28, -28, -211, -211,
-211, -26, -120, 2418, 2613, 25, 0, -9, 29, 0,
2433, 0, -276, 2526, 2445, 32, 0, 0, 0, 352,
0, 0, 2460, 352, 2213, 31, 2613, 0, 33, 2,
2273, 2273, 2273, 2613, 4, 2613, -108, 0, -221, 2120,
0, 5, 7, 2273, 2613, 2601, 2622, 198, 0, 0,
2273, 0, 8, 0, 10, 0, 0, 2273, 0, 0,
0, 0, -218, 2273, -196, 2273, 2273, -83, -48, -31,
0, 14, 0, 0, 0, 0, 0, 0, 18, -167,
0, 2147, 0, 24, -17, 6, 2613, 0, 2613, 2472,
14, 0, 0, 0, 0, 0, 2273, -26, 0, 0,
0, -196, -196, 2613, 28, 0, 0, 0,
};
short yyrindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 597, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1583,
-98, 1978, 1641, 0, 0, 0, 0, 0, 0, 0,
0, 1409, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
539, 655, 887, 945, 1003, 0, 423, 0, 0, 481,
0, 0, 1920, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1061, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1699, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 30, 0, 0,
0, 0, 713, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 204, 0, 0, 0, 0, -192, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 2363,
0, 0, 45, 0, 0, 0, 0, 17, 40, 135,
209, 283, 357, 2006, 2018, 2026, 2038, 2046, 2058, 2066,
2078, 0, 0, 0, 0, 0, -67, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1467, 1525, 1119, 1177,
1235, 1351, 771, 0, -185, 0, 0, 0, 50, 0,
0, 0, 1786, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, -10, -205, 0, -223, 0,
0, 0, 0, -170, 0, -169, 0, 0, 1874, 0,
0, 0, 0, 0, -59, 0, -236, -35, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1293, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, -177, 11, 0, -46, 0,
829, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 2086, 0, 0, 0, 0,
};
short yygindex[] = { 0,
21, 9, 0, -49, 72, 0, 57, 0, 0, -7,
-1, -188, 1, 0, 44, 0, 0, 0, 0, 0,
0, 0, 61, 0, 125, -137, 0, 0, 0, 0,
0, 0, 0, 0, 0, 302, 0, 0, 0, 0,
0, 0, 0, 0, 103, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
};
#define YYTABLESIZE 2907
short yytable[] = { 78,
31, 275, 72, 72, 72, 79, 72, 133, 83, 159,
84, 85, 161, 162, 2, 166, 8, 9, 76, 168,
26, 85, 48, 48, 48, 31, 72, 48, 48, 48,
72, 89, 174, 269, 141, 77, 77, 48, 48, 48,
142, 257, 77, 293, 134, 26, 174, 73, 74, 75,
93, 81, 94, 78, 78, 152, 137, 155, 78, 78,
78, 139, 44, 45, 164, 48, 76, 76, 83, 175,
169, 96, 90, 76, 171, 125, 85, 111, 77, 134,
294, 87, 87, 306, 131, 132, 87, 88, 87, 184,
185, 44, 45, 2, 90, 89, 78, 188, 189, 190,
191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
201, 186, 187, 288, 289, 290, 134, 207, 208, 209,
210, 211, 212, 213, 72, 72, 72, 72, 72, 325,
72, 90, 89, 224, 44, 45, 225, 144, 167, 136,
305, 138, 170, 146, 214, 145, 231, 234, 172, 147,
235, 173, 150, 148, 149, 292, 286, 153, 154, 156,
11, 11, 11, 160, 151, 243, 179, 247, 180, 217,
218, 219, 220, 221, 254, 223, 132, 256, 183, 247,
311, 286, 260, 247, 118, 119, 120, 121, 122, 123,
279, 46, 46, 46, 281, 206, 46, 46, 46, 14,
14, 14, 265, 266, 267, 268, 46, 46, 46, 46,
46, 46, 79, 79, 141, 312, 286, 79, 79, 79,
142, 222, 236, 50, 50, 50, 216, 227, 50, 50,
50, 140, 313, 286, 46, 8, 9, 76, 50, 50,
50, 50, 77, 83, 230, 84, 322, 286, 91, 91,
239, 247, 247, 247, 237, 79, 250, 238, 251, 145,
176, 128, 129, 130, 225, 252, 50, 131, 132, 92,
92, 302, 8, 9, 76, 33, 33, 33, 247, 77,
33, 33, 33, 255, 307, 253, 309, 310, 258, 271,
1, 33, 272, 273, 278, 2, 284, 286, 34, 34,
34, 283, 287, 34, 34, 34, 297, 262, 316, 291,
141, 314, 298, 303, 34, 304, 142, 324, 33, 315,
214, 3, 4, 5, 299, 321, 95, 6, 163, 328,
0, 158, 7, 8, 9, 10, 0, 11, 12, 13,
14, 34, 15, 16, 17, 0, 76, 18, 19, 20,
21, 159, 0, 0, 0, 3, 4, 5, 0, 22,
23, 6, 0, 0, 24, 0, 7, 8, 9, 10,
0, 11, 12, 13, 14, 0, 15, 16, 17, 0,
0, 18, 19, 20, 21, 157, 0, 308, 44, 45,
2, 158, 0, 35, 35, 35, 0, 0, 35, 35,
35, 0, 216, 126, 127, 128, 129, 130, 0, 35,
0, 131, 132, 0, 0, 0, 3, 4, 5, 0,
0, 0, 6, 0, 326, 327, 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, 94,
0, 0, 94, 94, 94, 94, 0, 36, 36, 36,
0, 0, 36, 36, 36, 116, 117, 118, 119, 120,
121, 122, 123, 36, 0, 0, 0, 0, 0, 0,
94, 94, 94, 0, 0, 0, 94, 0, 0, 0,
0, 94, 94, 94, 94, 0, 94, 94, 94, 94,
36, 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, 37, 37, 37, 0, 0, 37, 37, 37, 0,
97, 98, 99, 100, 101, 102, 103, 37, 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, 37, 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, 38, 38, 38, 0, 0,
38, 38, 38, 0, 0, 0, 0, 0, 0, 0,
0, 38, 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, 38, 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, 117,
117, 117, 0, 82, 117, 117, 117, 117, 117, 117,
117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
117, 117, 117, 117, 117, 117, 0, 117, 117, 117,
117, 117, 117, 117, 0, 117, 117, 117, 117, 117,
117, 117, 117, 117, 117, 117, 117, 0, 117, 117,
117, 0, 0, 117, 117, 117, 117, 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, 121, 121, 121, 0, 0, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
0, 121, 121, 121, 121, 121, 121, 121, 0, 121,
121, 121, 0, 121, 121, 121, 121, 121, 121, 121,
121, 0, 121, 121, 121, 0, 0, 121, 121, 121,
121, 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, 140, 140, 140, 140, 140, 140, 140, 140, 0,
140, 140, 140, 0, 0, 140, 140, 140, 140, 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, 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, 141, 0, 0, 141, 141,
141, 141, 141, 141, 141, 141, 141, 0, 141, 141,
141, 0, 0, 141, 141, 141, 141, 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, 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, 142, 142, 142, 0,
0, 0, 142, 142, 142, 142, 0, 0, 142, 142,
142, 0, 0, 142, 142, 142, 142, 139, 139, 139,
0, 0, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 0, 139, 139, 139, 139, 139,
139, 139, 0, 0, 139, 139, 139, 0, 0, 0,
139, 139, 139, 139, 0, 0, 139, 139, 139, 0,
0, 139, 139, 139, 139, 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, 121, 121, 121, 0, 0, 121, 121, 121, 0,
0, 0, 0, 0, 0, 0, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 0, 121,
121, 121, 121, 121, 121, 121, 0, 0, 121, 121,
0, 121, 121, 121, 121, 121, 121, 121, 121, 0,
121, 121, 121, 0, 0, 121, 121, 121, 121, 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, 44, 45, 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, 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, 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, 232,
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, 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, 121, 0, 58, 58, 58, 58,
0, 0, 0, 121, 0, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 0, 121, 121, 121, 121,
121, 121, 121, 0, 0, 121, 121, 0, 121, 121,
121, 0, 121, 121, 121, 121, 0, 121, 121, 121,
0, 0, 121, 121, 121, 121, 32, 32, 32, 0,
0, 32, 32, 32, 0, 0, 0, 0, 0, 0,
0, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 0, 39, 39, 39, 0, 0, 39,
39, 39, 0, 0, 0, 0, 122, 122, 122, 32,
39, 122, 122, 122, 123, 123, 123, 0, 0, 123,
123, 123, 122, 0, 0, 0, 124, 124, 124, 0,
123, 124, 124, 124, 125, 125, 125, 39, 0, 125,
125, 125, 124, 0, 0, 0, 126, 126, 126, 122,
125, 126, 126, 126, 127, 127, 127, 123, 0, 127,
127, 127, 126, 0, 0, 0, 128, 128, 128, 124,
127, 128, 128, 128, 53, 53, 53, 125, 0, 53,
53, 53, 128, 0, 0, 0, 0, 177, 0, 126,
53, 0, 0, 0, 0, 0, 113, 127, 114, 115,
116, 117, 118, 119, 120, 121, 122, 123, 0, 128,
0, 0, 0, 0, 295, 0, 0, 53, 0, 0,
0, 0, 0, 113, 178, 114, 115, 116, 117, 118,
119, 120, 121, 122, 123, 0, 0, 0, 0, 0,
0, 318, 104, 105, 106, 107, 108, 109, 110, 0,
113, 296, 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, 319, 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, 242, 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, 282, 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, 245, 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, 259, 0,
15, 16, 17, 0, 0, 18, 19, 20, 21, 166,
166, 166, 0, 0, 0, 166, 0, 0, 0, 0,
166, 166, 166, 166, 0, 166, 166, 166, 166, 0,
166, 166, 166, 0, 0, 166, 166, 166, 166, 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, 270,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
0, 0, 0, 113, 274, 114, 115, 116, 117, 118,
119, 120, 121, 122, 123, 113, 277, 114, 115, 116,
117, 118, 119, 120, 121, 122, 123, 44, 45, 0,
0, 280, 0, 0, 0, 0, 0, 0, 0, 0,
241, 0, 113, 323, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 113, 276, 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, 263, 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, 113, 301, 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, 278, 4, 5, 6, 7, 8, 265, 10, 59,
10, 298, 62, 63, 261, 65, 299, 300, 301, 69,
0, 298, 259, 260, 261, 25, 28, 264, 265, 266,
32, 301, 265, 222, 42, 259, 260, 274, 275, 276,
42, 179, 266, 265, 302, 25, 265, 4, 5, 6,
306, 8, 308, 259, 260, 55, 36, 57, 264, 265,
266, 41, 259, 260, 64, 302, 259, 260, 70, 302,
70, 28, 301, 266, 76, 32, 298, 298, 302, 265,
302, 259, 260, 302, 296, 297, 15, 16, 266, 89,
90, 259, 260, 261, 265, 265, 302, 97, 98, 99,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 91, 92, 251, 252, 253, 302, 117, 118, 119,
120, 121, 122, 123, 126, 127, 128, 129, 130, 318,
132, 302, 302, 133, 259, 260, 136, 262, 67, 301,
278, 301, 71, 301, 124, 43, 146, 147, 77, 301,
150, 80, 301, 51, 52, 264, 265, 55, 56, 57,
259, 260, 261, 61, 306, 165, 263, 167, 301, 126,
127, 128, 129, 130, 174, 132, 297, 177, 301, 179,
264, 265, 182, 183, 280, 281, 282, 283, 284, 285,
240, 259, 260, 261, 244, 306, 264, 265, 266, 259,
260, 261, 202, 203, 204, 205, 274, 275, 276, 277,
278, 279, 259, 260, 222, 264, 265, 264, 265, 266,
222, 287, 151, 259, 260, 261, 124, 306, 264, 265,
266, 295, 264, 265, 302, 299, 300, 301, 274, 275,
276, 277, 306, 245, 295, 245, 264, 265, 259, 260,
323, 251, 252, 253, 152, 302, 318, 155, 263, 157,
302, 290, 291, 292, 264, 263, 302, 296, 297, 259,
260, 271, 299, 300, 301, 259, 260, 261, 278, 306,
264, 265, 266, 278, 284, 263, 286, 287, 302, 265,
256, 275, 302, 265, 263, 261, 266, 265, 259, 260,
261, 245, 301, 264, 265, 266, 302, 183, 300, 306,
318, 298, 306, 306, 275, 306, 318, 317, 302, 302,
300, 287, 288, 289, 264, 302, 25, 293, 260, 302,
-1, 302, 298, 299, 300, 301, -1, 303, 304, 305,
306, 302, 308, 309, 310, -1, 302, 313, 314, 315,
316, 302, -1, -1, -1, 287, 288, 289, -1, 325,
326, 293, -1, -1, 330, -1, 298, 299, 300, 301,
-1, 303, 304, 305, 306, -1, 308, 309, 310, -1,
-1, 313, 314, 315, 316, 256, -1, 285, 259, 260,
261, 262, -1, 259, 260, 261, -1, -1, 264, 265,
266, -1, 300, 288, 289, 290, 291, 292, -1, 275,
-1, 296, 297, -1, -1, -1, 287, 288, 289, -1,
-1, -1, 293, -1, 322, 323, -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, 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, 256, -1, -1, 259, 260, 261, -1,
-1, 259, 260, 261, -1, -1, 264, 265, 266, -1,
267, 268, 269, 270, 271, 272, 273, 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, 256, -1, -1,
259, 260, 261, -1, -1, 259, 260, 261, -1, -1,
264, 265, 266, -1, -1, -1, -1, -1, -1, -1,
-1, 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, 259, 260, -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, 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, -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, -1, -1, -1, -1, -1, -1,
-1, 274, 275, 276, 277, 278, 279, 280, 281, 282,
283, 284, 285, -1, 259, 260, 261, -1, -1, 264,
265, 266, -1, -1, -1, -1, 259, 260, 261, 302,
275, 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, 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, -1, 265, -1, 302,
275, -1, -1, -1, -1, -1, 274, 302, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, -1, 302,
-1, -1, -1, -1, 265, -1, -1, 302, -1, -1,
-1, -1, -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",
"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
#define yyclearin (yychar=(-1))
#define yyerrok (yyerrflag=0)
#ifdef YYSTACKSIZE
#ifndef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#endif
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 500
#define YYMAXDEPTH 500
#endif
#endif
int yydebug;
#ifndef YYPURE
YYSTYPE yylval;
#endif
#ifdef YYGLOBAL
int yynerrs;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
short yyss[YYSTACKSIZE];
YYSTYPE yyvs[YYSTACKSIZE];
#endif
#define yystacksize YYSTACKSIZE
#line 1066 "parse.y"
/* resize the code for a user function */
static void resize_fblock( fbp, code_ptr )
FBLOCK *fbp ;
INST *code_ptr ;
{ int size ;
code1(_RET0) ; /* make sure there is always a return statement */
#if !SM_DOS
if ( dump_code )
{ code1(_HALT) ; /*stops da() */
add_to_fdump_list(fbp) ;
}
#endif
if ( (size = code_ptr - fbp->code) > PAGE_SZ-1 )
overflow("function code size", PAGE_SZ ) ;
/* resize the code */
fbp->code = (INST*) zrealloc(fbp->code, PAGE_SZ*sizeof(INST),
size * sizeof(INST) ) ;
}
/* 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 ||
#if LM_DOS
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 = new_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) )
{ code1(LA_PUSHA) ; code1(p->offset) ; }
else code2(A_PUSHA, p->stval.array) ;
}
static int current_offset()
{
switch( scope )
{
case SCOPE_MAIN : return code_ptr - main_start ;
case SCOPE_BEGIN : return code_ptr - begin_code.start ;
case SCOPE_END : return code_ptr - end_code.start ;
case SCOPE_FUNCT : return code_ptr - active_funct->code ;
}
/* can't get here */
return 0 ;
}
/* 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 ;
switch( ip->type )
{
case ST_VAR :
p->type = CA_EXPR ;
code2(_PUSHI, ip->stval.cp) ;
break ;
case ST_LOCAL_VAR :
p->type = CA_EXPR ;
code1(L_PUSHI) ;
code1(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 ;
code1(LA_PUSHA) ;
code1(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->call_offset = current_offset() ;
p->sym_p = ip ;
code2(_PUSHI, &dummy) ;
break ;
case ST_LOCAL_NONE :
p->type = ST_LOCAL_NONE ;
p->call_offset = current_offset() ;
p->type_p = & active_funct->typev[ip->offset] ;
code1(L_PUSHI) ;
code1(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) ;
}
int parse()
{ int yy = yyparse() ;
#if YYBYACC
extern struct yacc_mem *yacc_memp ;
yacc_memp++ ; /* puts parser tables in mem pool */
#endif
if ( resolve_list ) resolve_fcalls() ;
return yy ;
}
#line 1349 "y.tab.c"
#define YYABORT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
int
yyparse()
{
register int yyn, yystate;
int yym ;
#ifdef YYPURE
YYSTYPE yylval ;
#endif
#ifndef YYGLOBAL
int yynerrs;
int yyerrflag;
int yychar;
register short *yyssp;
register 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("yydebug: state %d, reading %d (%s)\n", yystate,
yychar, yys);
}
#endif
}
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, shifting to state %d\n",
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("yydebug: state %d, error recovery shifting\
to state %d\n", *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("yydebug: error recovery discarding state %d\n",
*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("yydebug: state %d, error recovery discards token %d (%s)\n",
yystate, yychar, yys);
}
#endif
yychar = (-1);
goto yyloop;
}
yyreduce:
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, reducing by rule %d (%s)\n",
yystate, yyn, yyrule[yyn]);
#endif
yym = yylen[yyn];
yyval = yyvsp[1-yym];
switch (yyn)
{
case 6:
#line 160 "parse.y"
{ /* this do nothing action removes a vacuous warning
from Bison */
}
break;
case 7:
#line 165 "parse.y"
{
be_expand(&begin_code) ;
scope = SCOPE_BEGIN ;
}
break;
case 8:
#line 171 "parse.y"
{ be_shrink(&begin_code) ;
scope = SCOPE_MAIN ;
}
break;
case 9:
#line 176 "parse.y"
{
be_expand(&end_code) ;
scope = SCOPE_END ;
}
break;
case 10:
#line 182 "parse.y"
{ be_shrink(&end_code) ;
scope = SCOPE_MAIN ;
}
break;
case 11:
#line 187 "parse.y"
{ code_jmp(_JZ, (INST*)0) ; }
break;
case 12:
#line 190 "parse.y"
{ patch_jmp( code_ptr ) ; }
break;
case 13:
#line 194 "parse.y"
{ code_push(yyvsp[-1].start, code_ptr - yyvsp[-1].start) ;
code_ptr = yyvsp[-1].start ;
code1(_RANGE) ; code1(1) ;
code_ptr += 3 ;
code_ptr += code_pop(code_ptr) ;
code1(_STOP) ;
yyvsp[-1].start[2].op = code_ptr - (yyvsp[-1].start+1) ;
}
break;
case 14:
#line 203 "parse.y"
{ code1(_STOP) ; }
break;
case 15:
#line 206 "parse.y"
{ yyvsp[-5].start[3].op = yyvsp[0].start - (yyvsp[-5].start+1) ;
yyvsp[-5].start[4].op = code_ptr - (yyvsp[-5].start+1) ;
}
break;
case 16:
#line 214 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 17:
#line 216 "parse.y"
{ yyval.start = code_ptr ; /* does nothing won't be executed */
print_flag = getline_flag = paren_cnt = 0 ;
yyerrok ; }
break;
case 19:
#line 223 "parse.y"
{ yyval.start = code_ptr ;
code1(_PUSHINT) ; code1(0) ;
code2(_PRINT, bi_print) ;
}
break;
case 23:
#line 235 "parse.y"
{ code1(_POP) ; }
break;
case 24:
#line 237 "parse.y"
{ yyval.start = code_ptr ; }
break;
case 25:
#line 239 "parse.y"
{ yyval.start = code_ptr ;
print_flag = getline_flag = 0 ;
paren_cnt = 0 ;
yyerrok ;
}
break;
case 26:
#line 245 "parse.y"
{ yyval.start = code_ptr ; BC_insert('B', code_ptr+1) ;
code2(_JMP, 0) /* don't use code_jmp ! */ ; }
break;
case 27:
#line 248 "parse.y"
{ yyval.start = code_ptr ; BC_insert('C', code_ptr+1) ;
code2(_JMP, 0) ; }
break;
case 28:
#line 251 "parse.y"
{ if ( scope != SCOPE_FUNCT )
compile_error("return outside function body") ;
}
break;
case 29:
#line 255 "parse.y"
{ if ( scope != SCOPE_MAIN )
compile_error( "improper use of next" ) ;
yyval.start = code_ptr ;
code1(_NEXT) ;
}
break;
case 33:
#line 266 "parse.y"
{ code1(_ASSIGN) ; }
break;
case 34:
#line 267 "parse.y"
{ code1(_ADD_ASG) ; }
break;
case 35:
#line 268 "parse.y"
{ code1(_SUB_ASG) ; }
break;
case 36:
#line 269 "parse.y"
{ code1(_MUL_ASG) ; }
break;
case 37:
#line 270 "parse.y"
{ code1(_DIV_ASG) ; }
break;
case 38:
#line 271 "parse.y"
{ code1(_MOD_ASG) ; }
break;
case 39:
#line 272 "parse.y"
{ code1(_POW_ASG) ; }
break;
case 40:
#line 273 "parse.y"
{ code1(_EQ) ; }
break;
case 41:
#line 274 "parse.y"
{ code1(_NEQ) ; }
break;
case 42:
#line 275 "parse.y"
{ code1(_LT) ; }
break;
case 43:
#line 276 "parse.y"
{ code1(_LTE) ; }
break;
case 44:
#line 277 "parse.y"
{ code1(_GT) ; }
break;
case 45:
#line 278 "parse.y"
{ code1(_GTE) ; }
break;
case 46:
#line 281 "parse.y"
{
if ( yyvsp[0].start == code_ptr - 2 )
{
if ( yyvsp[0].start->op == _MATCH0 ) yyvsp[0].start->op = _MATCH1 ;
else /* check for string */
if ( yyvsp[0].start->op == _PUSHS )
{ CELL *cp = ZMALLOC(CELL) ;
cp->type = C_STRING ;
cp->ptr = yyvsp[0].start[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 306 "parse.y"
{ code1(_DUP) ;
code_jmp(_JNZ, (INST*)0) ;
code1(_POP) ;
}
break;
case 48:
#line 311 "parse.y"
{ patch_jmp(code_ptr) ; code1(_TEST) ; }
break;
case 49:
#line 314 "parse.y"
{ code1(_DUP) ; code_jmp(_JZ, (INST*)0) ;
code1(_POP) ; }
break;
case 50:
#line 317 "parse.y"
{ patch_jmp(code_ptr) ; code1(_TEST) ; }
break;
case 51:
#line 319 "parse.y"
{ code_jmp(_JZ, (INST*)0) ; }
break;
case 52:
#line 320 "parse.y"
{ code_jmp(_JMP, (INST*)0) ; }
break;
case 53:
#line 322 "parse.y"
{ patch_jmp(code_ptr) ; patch_jmp(yyvsp[0].start) ; }
break;
case 55:
#line 327 "parse.y"
{ code1(_CAT) ; }
break;
case 56:
#line 331 "parse.y"
{ yyval.start = code_ptr ; code2(_PUSHD, yyvsp[0].ptr) ; }
break;
case 57:
#line 333 "parse.y"
{ yyval.start = code_ptr ; code2(_PUSHS, yyvsp[0].ptr) ; }
break;
case 58:
#line 335 "parse.y"
{ check_var(yyvsp[0].stp) ;
yyval.start = code_ptr ;
if ( is_local(yyvsp[0].stp) )
{ code1(L_PUSHI) ; code1(yyvsp[0].stp->offset) ; }
else code2(_PUSHI, yyvsp[0].stp->stval.cp) ;
}
break;
case 59:
#line 343 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 60:
#line 347 "parse.y"
{ yyval.start = code_ptr ; code2(_MATCH0, yyvsp[0].ptr) ; }
break;
case 61:
#line 350 "parse.y"
{ code1(_ADD) ; }
break;
case 62:
#line 351 "parse.y"
{ code1(_SUB) ; }
break;
case 63:
#line 352 "parse.y"
{ code1(_MUL) ; }
break;
case 64:
#line 353 "parse.y"
{ code1(_DIV) ; }
break;
case 65:
#line 354 "parse.y"
{ code1(_MOD) ; }
break;
case 66:
#line 355 "parse.y"
{ code1(_POW) ; }
break;
case 67:
#line 357 "parse.y"
{ yyval.start = yyvsp[0].start ; code1(_NOT) ; }
break;
case 68:
#line 359 "parse.y"
{ yyval.start = yyvsp[0].start ; code1(_UPLUS) ; }
break;
case 69:
#line 361 "parse.y"
{ yyval.start = yyvsp[0].start ; code1(_UMINUS) ; }
break;
case 71:
#line 366 "parse.y"
{ check_var(yyvsp[-1].stp) ;
yyval.start = code_ptr ;
code_address(yyvsp[-1].stp) ;
if ( yyvsp[0].ival == '+' ) code1(_POST_INC) ;
else code1(_POST_DEC) ;
}
break;
case 72:
#line 374 "parse.y"
{ yyval.start = yyvsp[0].start ;
if ( yyvsp[-1].ival == '+' ) code1(_PRE_INC) ;
else code1(_PRE_DEC) ;
}
break;
case 73:
#line 381 "parse.y"
{ if (yyvsp[0].ival == '+' ) code1(F_POST_INC ) ;
else code1(F_POST_DEC) ;
}
break;
case 74:
#line 385 "parse.y"
{ yyval.start = yyvsp[0].start ;
if ( yyvsp[-1].ival == '+' ) code1(F_PRE_INC) ;
else code1( F_PRE_DEC) ;
}
break;
case 75:
#line 392 "parse.y"
{ yyval.start = code_ptr ;
check_var(yyvsp[0].stp) ;
code_address(yyvsp[0].stp) ;
}
break;
case 76:
#line 400 "parse.y"
{ yyval.ival = 0 ; }
break;
case 78:
#line 405 "parse.y"
{ yyval.ival = 1 ; }
break;
case 79:
#line 407 "parse.y"
{ yyval.ival = yyvsp[-2].ival + 1 ; }
break;
case 80:
#line 412 "parse.y"
{ BI_REC *p = yyvsp[-4].bip ;
yyval.start = yyvsp[-3].start ;
if ( p-> min_args > yyvsp[-1].ival || 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 423 "parse.y"
{
code1(_PUSHINT) ; code1(0) ;
code2(_BUILTIN, yyvsp[0].bip->fp) ;
}
break;
case 82:
#line 431 "parse.y"
{ yyval.start = code_ptr ; }
break;
case 83:
#line 435 "parse.y"
{ code2(_PRINT, yyvsp[-4].fp) ; yyval.start = yyvsp[-3].start ;
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 443 "parse.y"
{ yyval.fp = bi_print ; print_flag = 1 ;}
break;
case 85:
#line 444 "parse.y"
{ yyval.fp = bi_printf ; print_flag = 1 ; }
break;
case 86:
#line 447 "parse.y"
{ code1(_PUSHINT) ; code1(yyvsp[0].ival) ; }
break;
case 87:
#line 449 "parse.y"
{ yyval.ival = yyvsp[-1].arg2p->cnt ; zfree(yyvsp[-1].arg2p,sizeof(ARG2_REC)) ;
code1(_PUSHINT) ; code1(yyval.ival) ;
}
break;
case 88:
#line 453 "parse.y"
{ yyval.ival=0 ; code1(_PUSHINT) ; code1(0) ; }
break;
case 89:
#line 457 "parse.y"
{ yyval.arg2p = (ARG2_REC*) zmalloc(sizeof(ARG2_REC)) ;
yyval.arg2p->start = yyvsp[-2].start ;
yyval.arg2p->cnt = 2 ;
}
break;
case 90:
#line 462 "parse.y"
{ yyval.arg2p = yyvsp[-2].arg2p ; yyval.arg2p->cnt++ ; }
break;
case 92:
#line 467 "parse.y"
{ code1(_PUSHINT) ; code1(yyvsp[-1].ival) ; }
break;
case 93:
#line 474 "parse.y"
{ yyval.start = yyvsp[-1].start ; eat_nl() ; code_jmp(_JZ, (INST*)0) ; }
break;
case 94:
#line 479 "parse.y"
{ patch_jmp( code_ptr ) ; }
break;
case 95:
#line 482 "parse.y"
{ eat_nl() ; code_jmp(_JMP, (INST*)0) ; }
break;
case 96:
#line 487 "parse.y"
{ patch_jmp(code_ptr) ; patch_jmp(yyvsp[0].start) ; }
break;
case 97:
#line 493 "parse.y"
{ eat_nl() ; BC_new() ; }
break;
case 98:
#line 498 "parse.y"
{ yyval.start = yyvsp[-5].start ;
code_jmp(_JNZ, yyvsp[-5].start) ;
BC_clear(code_ptr, yyvsp[-2].start) ; }
break;
case 99:
#line 504 "parse.y"
{ eat_nl() ; BC_new() ;
yyval.start = yyvsp[-1].start ;
/* check if const expression */
if ( code_ptr - 2 == yyvsp[-1].start &&
code_ptr[-2].op == _PUSHD &&
*(double*)code_ptr[-1].ptr != 0.0
)
code_ptr -= 2 ;
else
{
code_push(yyvsp[-1].start, code_ptr-yyvsp[-1].start) ;
code_ptr = yyvsp[-1].start ;
code2(_JMP, (INST*)0) ; /* code2() not code_jmp() */
}
}
break;
case 100:
#line 524 "parse.y"
{
INST *c_addr ; int len ;
if ( yyvsp[-1].start != yyvsp[0].start ) /* real test in loop */
{
yyvsp[-1].start[1].op = code_ptr-(yyvsp[-1].start+1) ;
c_addr = code_ptr ;
len = code_pop(code_ptr) ;
code_ptr += len ;
code_jmp(_JNZ, yyvsp[0].start) ;
BC_clear(code_ptr, c_addr) ;
}
else /* while(1) */
{
code_jmp(_JMP, yyvsp[-1].start) ;
BC_clear(code_ptr, yyvsp[0].start) ;
}
}
break;
case 101:
#line 547 "parse.y"
{
INST *cont_address = code_ptr ;
unsigned len = code_pop(code_ptr) ;
code_ptr += len ;
if ( yyvsp[-2].start != yyvsp[0].start ) /* real test in for2 */
{
yyvsp[0].start[-1].op = code_ptr - yyvsp[0].start + 1 ;
len = code_pop(code_ptr) ;
code_ptr += len ;
code_jmp(_JNZ, yyvsp[0].start) ;
}
else /* for(;;) */
code_jmp(_JMP, yyvsp[0].start) ;
BC_clear(code_ptr, cont_address) ;
}
break;
case 102:
#line 568 "parse.y"
{ yyval.start = code_ptr ; }
break;
case 103:
#line 570 "parse.y"
{ yyval.start = yyvsp[-1].start ; code1(_POP) ; }
break;
case 104:
#line 573 "parse.y"
{ yyval.start = code_ptr ; }
break;
case 105:
#line 575 "parse.y"
{
if ( code_ptr - 2 == yyvsp[-1].start &&
code_ptr[-2].op == _PUSHD &&
* (double*) code_ptr[-1].ptr != 0.0
)
code_ptr -= 2 ;
else
{
code_push(yyvsp[-1].start, code_ptr-yyvsp[-1].start) ;
code_ptr = yyvsp[-1].start ;
code2(_JMP, (INST*)0) ;
}
}
break;
case 106:
#line 591 "parse.y"
{ eat_nl() ; BC_new() ; code_push((INST*)0,0) ; }
break;
case 107:
#line 593 "parse.y"
{ eat_nl() ; BC_new() ;
code1(_POP) ;
code_push(yyvsp[-1].start, code_ptr - yyvsp[-1].start) ;
code_ptr -= code_ptr - yyvsp[-1].start ;
}
break;
case 108:
#line 604 "parse.y"
{ check_array(yyvsp[0].stp) ;
code_array(yyvsp[0].stp) ;
code1(A_TEST) ;
}
break;
case 109:
#line 609 "parse.y"
{ yyval.start = yyvsp[-3].arg2p->start ;
code1(A_CAT) ; code1(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 620 "parse.y"
{
if ( yyvsp[-1].ival > 1 )
{ code1(A_CAT) ; code1(yyvsp[-1].ival) ; }
check_array(yyvsp[-4].stp) ;
if( is_local(yyvsp[-4].stp) )
{ code1(LAE_PUSHA) ; code1(yyvsp[-4].stp->offset) ; }
else code2(AE_PUSHA, yyvsp[-4].stp->stval.array) ;
yyval.start = yyvsp[-3].start ;
}
break;
case 111:
#line 633 "parse.y"
{
if ( yyvsp[-1].ival > 1 )
{ code1(A_CAT) ; code1(yyvsp[-1].ival) ; }
check_array(yyvsp[-4].stp) ;
if( is_local(yyvsp[-4].stp) )
{ code1(LAE_PUSHI) ; code1(yyvsp[-4].stp->offset) ; }
else code2(AE_PUSHI, yyvsp[-4].stp->stval.array) ;
yyval.start = yyvsp[-3].start ;
}
break;
case 112:
#line 645 "parse.y"
{
if ( yyvsp[-2].ival > 1 )
{ code1(A_CAT) ; code1(yyvsp[-2].ival) ; }
check_array(yyvsp[-5].stp) ;
if( is_local(yyvsp[-5].stp) )
{ code1(LAE_PUSHA) ; code1(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 662 "parse.y"
{
yyval.start = yyvsp[-4].start ;
if ( yyvsp[-2].ival > 1 ) { code1(A_CAT) ; code1(yyvsp[-2].ival) ; }
check_array(yyvsp[-5].stp) ;
code_array(yyvsp[-5].stp) ;
code1(A_DEL) ;
}
break;
case 114:
#line 675 "parse.y"
{ eat_nl() ; BC_new() ;
yyval.start = code_ptr ;
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 115:
#line 689 "parse.y"
{
yyvsp[0].start[-1].op = code_ptr - yyvsp[0].start + 1 ;
BC_clear( code_ptr+3 , code_ptr) ;
code_jmp(ALOOP, yyvsp[0].start) ;
code_ptr++->ptr = (PTR) ZMALLOC(ALOOP_STATE) ;
}
break;
case 116:
#line 704 "parse.y"
{ yyval.start = code_ptr ; code2(F_PUSHA, yyvsp[0].cp) ; }
break;
case 117:
#line 706 "parse.y"
{ check_var(yyvsp[0].stp) ;
yyval.start = code_ptr ;
if ( is_local(yyvsp[0].stp) )
{ code1(L_PUSHI) ; code1(yyvsp[0].stp->offset) ; }
else code2(_PUSHI, yyvsp[0].stp->stval.cp) ;
CODE_FE_PUSHA() ;
}
break;
case 118:
#line 715 "parse.y"
{
if ( yyvsp[-1].ival > 1 )
{ code1(A_CAT) ; code1(yyvsp[-1].ival) ; }
check_array(yyvsp[-4].stp) ;
if( is_local(yyvsp[-4].stp) )
{ code1(LAE_PUSHI) ; code1(yyvsp[-4].stp->offset) ; }
else code2(AE_PUSHI, yyvsp[-4].stp->stval.array) ;
CODE_FE_PUSHA() ;
yyval.start = yyvsp[-3].start ;
}
break;
case 119:
#line 729 "parse.y"
{ yyval.start = yyvsp[0].start ; CODE_FE_PUSHA() ; }
break;
case 120:
#line 731 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 121:
#line 735 "parse.y"
{ field_A2I() ; }
break;
case 122:
#line 738 "parse.y"
{ code1(F_ASSIGN) ; }
break;
case 123:
#line 739 "parse.y"
{ code1(F_ADD_ASG) ; }
break;
case 124:
#line 740 "parse.y"
{ code1(F_SUB_ASG) ; }
break;
case 125:
#line 741 "parse.y"
{ code1(F_MUL_ASG) ; }
break;
case 126:
#line 742 "parse.y"
{ code1(F_DIV_ASG) ; }
break;
case 127:
#line 743 "parse.y"
{ code1(F_MOD_ASG) ; }
break;
case 128:
#line 744 "parse.y"
{ code1(F_POW_ASG) ; }
break;
case 129:
#line 751 "parse.y"
{ code2(_BUILTIN, bi_split) ; }
break;
case 130:
#line 755 "parse.y"
{ yyval.start = yyvsp[-2].start ;
check_array(yyvsp[0].stp) ;
code_array(yyvsp[0].stp) ;
}
break;
case 131:
#line 762 "parse.y"
{ code2(_PUSHI, &fs_shadow) ; }
break;
case 132:
#line 764 "parse.y"
{
if ( 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 133:
#line 788 "parse.y"
{ yyval.start = yyvsp[-3].start ;
code2(_BUILTIN, bi_match) ;
}
break;
case 134:
#line 795 "parse.y"
{
if ( yyvsp[0].start == code_ptr - 2 )
{
if ( yyvsp[0].start->op == _MATCH0 ) RE_as_arg() ;
else
if ( yyvsp[0].start->op == _PUSHS )
{ CELL *cp = ZMALLOC(CELL) ;
cp->type = C_STRING ;
cp->ptr = yyvsp[0].start[1].ptr ;
cast_to_RE(cp) ;
yyvsp[0].start->op = _PUSHC ;
yyvsp[0].start[1].ptr = (PTR) cp ;
}
}
}
break;
case 135:
#line 816 "parse.y"
{ yyval.start = code_ptr ;
code1(_EXIT0) ; }
break;
case 136:
#line 819 "parse.y"
{ yyval.start = yyvsp[-1].start ; code1(_EXIT) ; }
break;
case 137:
#line 822 "parse.y"
{ yyval.start = code_ptr ;
code1(_RET0) ; }
break;
case 138:
#line 825 "parse.y"
{ yyval.start = yyvsp[-1].start ; code1(_RET) ; }
break;
case 139:
#line 830 "parse.y"
{ yyval.start = code_ptr ;
code2(F_PUSHA, &field[0]) ;
code1(_PUSHINT) ; code1(0) ;
code2(_BUILTIN, bi_getline) ;
getline_flag = 0 ;
}
break;
case 140:
#line 837 "parse.y"
{ yyval.start = yyvsp[0].start ;
code1(_PUSHINT) ; code1(0) ;
code2(_BUILTIN, bi_getline) ;
getline_flag = 0 ;
}
break;
case 141:
#line 843 "parse.y"
{ code1(_PUSHINT) ; code1(F_IN) ;
code2(_BUILTIN, bi_getline) ;
/* getline_flag already off in yylex() */
}
break;
case 142:
#line 848 "parse.y"
{ code2(F_PUSHA, &field[0]) ;
code1(_PUSHINT) ; code1(PIPE_IN) ;
code2(_BUILTIN, bi_getline) ;
}
break;
case 143:
#line 853 "parse.y"
{
code1(_PUSHINT) ; code1(PIPE_IN) ;
code2(_BUILTIN, bi_getline) ;
}
break;
case 144:
#line 859 "parse.y"
{ getline_flag = 1 ; }
break;
case 147:
#line 864 "parse.y"
{ yyval.start = code_ptr ;
code2(F_PUSHA, field+0) ;
}
break;
case 148:
#line 868 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 149:
#line 876 "parse.y"
{
if ( yyvsp[0].start - yyvsp[-1].start == 2 && yyvsp[-1].start->op == _PUSHS )
{ /* cast from STRING to REPL at compile time */
CELL *cp = ZMALLOC(CELL) ;
cp->type = C_STRING ;
cp->ptr = yyvsp[-1].start[1].ptr ;
cast_to_REPL(cp) ;
yyvsp[-1].start->op = _PUSHC ;
yyvsp[-1].start[1].ptr = (PTR) cp ;
}
code2(_BUILTIN, yyvsp[-5].fp) ;
yyval.start = yyvsp[-3].start ;
}
break;
case 150:
#line 891 "parse.y"
{ yyval.fp = bi_sub ; }
break;
case 151:
#line 892 "parse.y"
{ yyval.fp = bi_gsub ; }
break;
case 152:
#line 897 "parse.y"
{ yyval.start = code_ptr ;
code2(F_PUSHA, &field[0]) ;
}
break;
case 153:
#line 902 "parse.y"
{ yyval.start = yyvsp[-1].start ; }
break;
case 154:
#line 910 "parse.y"
{ resize_fblock(yyvsp[-1].fbp, code_ptr) ;
code_ptr = main_code_ptr ;
scope = SCOPE_MAIN ;
active_funct = (FBLOCK *) 0 ;
restore_ids() ;
}
break;
case 155:
#line 920 "parse.y"
{ eat_nl() ;
scope = SCOPE_FUNCT ;
active_funct = yyvsp[-3].fbp ;
main_code_ptr = code_ptr ;
if ( yyvsp[-3].fbp->nargs = yyvsp[-1].ival )
yyvsp[-3].fbp->typev = (char *)
memset( zmalloc(yyvsp[-1].ival), ST_LOCAL_NONE, SIZE_T(yyvsp[-1].ival)) ;
else yyvsp[-3].fbp->typev = (char *) 0 ;
code_ptr = yyvsp[-3].fbp->code =
(INST *) zmalloc(PAGE_SZ*sizeof(INST)) ;
}
break;
case 156:
#line 935 "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 ;
}
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 157:
#line 957 "parse.y"
{ yyval.fbp = yyvsp[0].fbp ;
if ( yyvsp[0].fbp->code )
compile_error("redefinition of %s" , yyvsp[0].fbp->name) ;
}
break;
case 158:
#line 963 "parse.y"
{ yyval.ival = 0 ; }
break;
case 160:
#line 968 "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 161:
#line 974 "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 162:
#line 987 "parse.y"
{ /* we may have to recover from a bungled function
definition */
/* can have local ids, before code scope
changes */
restore_ids() ;
if (scope == SCOPE_FUNCT)
{ scope = SCOPE_MAIN ;
active_funct = (FBLOCK*) 0 ;
}
code_ptr = main_code_ptr ;
}
break;
case 163:
#line 1006 "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, active_funct,
yyvsp[0].ca_p, token_lineno) ;
}
break;
case 164:
#line 1018 "parse.y"
{ yyval.ca_p = (CA_REC *) 0 ; }
break;
case 165:
#line 1020 "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 166:
#line 1035 "parse.y"
{ yyval.ca_p = (CA_REC *) 0 ; }
break;
case 167:
#line 1037 "parse.y"
{ yyval.ca_p = (CA_REC *) zmalloc(sizeof(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 ;
}
break;
case 168:
#line 1043 "parse.y"
{ yyval.ca_p = (CA_REC *) zmalloc(sizeof(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 169:
#line 1052 "parse.y"
{ yyval.ca_p = (CA_REC *) zmalloc(sizeof(CA_REC)) ;
yyval.ca_p->type = CA_EXPR ;
}
break;
case 170:
#line 1057 "parse.y"
{ yyval.ca_p = (CA_REC *) zmalloc(sizeof(CA_REC)) ;
code_call_id(yyval.ca_p, yyvsp[-1].stp) ;
}
break;
#line 2522 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
yyvsp -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#if YYDEBUG
if (yydebug)
printf("yydebug: after reduction, shifting from state 0 to\
state %d\n", 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("yydebug: state %d, reading %d (%s)\n",
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("yydebug: after reduction, shifting from state %d \
to state %d\n", *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);
}
/********************************************
parse2.xc
copyright 1991, Michael D. Brennan
This is a source file for mawk, an implementation of
the AWK programming language.
Mawk is distributed without warranty under the terms of
the GNU General Public License, version 2, 1991.
********************************************/
/* $Log: parse2.xc,v $
Revision 5.1 1991/12/05 07:52:38 brennan
1.1 pre-release
*/
/* If using Berkeley yacc, we can put the parser table
memory to the zmalloc pool. This is kind of ugly and
with paged vm probably a nop, but for DOS and MINIX and ??
it frees a considerably amount of memory.
This file is part of parse.c via
cat y.tab.c parse2.xc > parse.c
*/
static struct yacc_mem yacc_mem[] =
{
0 , 0 , /* don't remove this */
#ifdef YYBYACC
(PTR) yycheck, sizeof(yycheck)/ZBLOCKSZ,
(PTR) yytable, sizeof(yytable)/ZBLOCKSZ,
#ifndef YYXBYACC /* with xbyacc these are storage auto */
(PTR) yyvs , sizeof(yyvs)/ZBLOCKSZ,
(PTR) yyss, sizeof(yyss)/ZBLOCKSZ,
#endif
(PTR) yydefred, sizeof(yydefred)/ZBLOCKSZ,
(PTR) yydgoto, sizeof(yydgoto)/ZBLOCKSZ,
(PTR) yygindex, sizeof(yygindex)/ZBLOCKSZ,
(PTR) yylen, sizeof(yylen)/ZBLOCKSZ,
(PTR) yylhs, sizeof(yylhs)/ZBLOCKSZ,
(PTR) yyrindex, sizeof(yyrindex)/ZBLOCKSZ,
(PTR) yysindex, sizeof(yysindex)/ZBLOCKSZ,
#endif
0,0 } ;
struct yacc_mem *yacc_memp = yacc_mem ;