1 2 # line 2 "awk.g.y" 3 /* 4 * CDDL HEADER START 5 * 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License, Version 1.0 only 8 * (the "License"). You may not use this file except in compliance 9 * with the License. 10 * 11 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 12 * or http://www.opensolaris.org/os/licensing. 13 * See the License for the specific language governing permissions 14 * and limitations under the License. 15 * 16 * When distributing Covered Code, include this CDDL HEADER in each 17 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 18 * If applicable, add the following below this CDDL HEADER, with the 19 * fields enclosed by brackets "[]" replaced with your own identifying 20 * information: Portions Copyright [yyyy] [name of copyright owner] 21 * 22 * CDDL HEADER END 23 */ 24 25 # line 30 "awk.g.y" 26 #ident "%Z%%M% %I% %E% SMI" 27 # define FIRSTTOKEN 257 28 # define FINAL 258 29 # define FATAL 259 30 # define LT 260 31 # define LE 261 32 # define GT 262 33 # define GE 263 34 # define EQ 264 35 # define NE 265 36 # define MATCH 266 37 # define NOTMATCH 267 38 # define APPEND 268 39 # define ADD 269 40 # define MINUS 270 41 # define MULT 271 42 # define DIVIDE 272 43 # define MOD 273 44 # define UMINUS 274 45 # define ASSIGN 275 46 # define ADDEQ 276 47 # define SUBEQ 277 48 # define MULTEQ 278 49 # define DIVEQ 279 50 # define MODEQ 280 51 # define JUMP 281 52 # define XBEGIN 282 53 # define XEND 283 54 # define NL 284 55 # define PRINT 285 56 # define PRINTF 286 57 # define SPRINTF 287 58 # define SPLIT 288 59 # define IF 289 60 # define ELSE 290 61 # define WHILE 291 62 # define FOR 292 63 # define IN 293 64 # define NEXT 294 65 # define EXIT 295 66 # define BREAK 296 67 # define CONTINUE 297 68 # define PROGRAM 298 69 # define PASTAT 299 70 # define PASTAT2 300 71 # define ASGNOP 301 72 # define BOR 302 73 # define AND 303 74 # define NOT 304 75 # define NUMBER 305 76 # define VAR 306 77 # define ARRAY 307 78 # define FNCN 308 79 # define SUBSTR 309 80 # define LSUBSTR 310 81 # define INDEX 311 82 # define GETLINE 312 83 # define RELOP 313 84 # define MATCHOP 314 85 # define OR 315 86 # define STRING 316 87 # define DOT 317 88 # define CCL 318 89 # define NCCL 319 90 # define CHAR 320 91 # define CAT 321 92 # define STAR 322 93 # define PLUS 323 94 # define QUEST 324 95 # define POSTINCR 325 96 # define PREINCR 326 97 # define POSTDECR 327 98 # define PREDECR 328 99 # define INCR 329 100 # define DECR 330 101 # define FIELD 331 102 # define INDIRECT 332 103 # define JUMPTRUE 333 104 # define JUMPFALSE 334 105 # define PUSH 335 106 # define GETREC 336 107 # define NEWSTAT 337 108 # define IN_INIT 338 109 # define IN_EXIT 339 110 # define LASTTOKEN 340 111 112 # line 70 "awk.g.y" 113 #include "awk.def" 114 #ifndef DEBUG 115 # define PUTS(x) 116 #endif 117 static wchar_t L_record[] = L"$record"; 118 static wchar_t L_zeronull[] = L"$zero&null"; 119 120 #include <inttypes.h> 121 122 #ifdef __STDC__ 123 #include <stdlib.h> 124 #include <string.h> 125 #define YYCONST const 126 #else 127 #include <malloc.h> 128 #include <memory.h> 129 #define YYCONST 130 #endif 131 132 #include <values.h> 133 134 #if defined(__cplusplus) || defined(__STDC__) 135 136 #if defined(__cplusplus) && defined(__EXTERN_C__) 137 extern "C" { 138 #endif 139 #ifndef yyerror 140 #if defined(__cplusplus) 141 void yyerror(YYCONST char *); 142 #endif 143 #endif 144 #ifndef yylex 145 int yylex(void); 146 #endif 147 int yyparse(void); 148 #if defined(__cplusplus) && defined(__EXTERN_C__) 149 } 150 #endif 151 152 #endif 153 154 #define yyclearin yychar = -1 155 #define yyerrok yyerrflag = 0 156 extern int yychar; 157 extern int yyerrflag; 158 #ifndef YYSTYPE 159 #define YYSTYPE int 160 #endif 161 YYSTYPE yylval; 162 YYSTYPE yyval; 163 typedef int yytabelem; 164 #ifndef YYMAXDEPTH 165 #define YYMAXDEPTH 150 166 #endif 167 #if YYMAXDEPTH > 0 168 int yy_yys[YYMAXDEPTH], *yys = yy_yys; 169 YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; 170 #else /* user does initial allocation */ 171 int *yys; 172 YYSTYPE *yyv; 173 #endif 174 static int yymaxdepth = YYMAXDEPTH; 175 # define YYERRCODE 256 176 177 # line 350 "awk.g.y" 178 179 static YYCONST yytabelem yyexca[] ={ 180 -1, 0, 181 0, 5, 182 283, 5, 183 284, 5, 184 287, 5, 185 288, 5, 186 304, 5, 187 305, 5, 188 306, 5, 189 308, 5, 190 309, 5, 191 311, 5, 192 312, 5, 193 316, 5, 194 40, 5, 195 43, 5, 196 45, 5, 197 47, 5, 198 329, 5, 199 330, 5, 200 331, 5, 201 332, 5, 202 123, 5, 203 -2, 0, 204 -1, 1, 205 0, -1, 206 -2, 0, 207 -1, 39, 208 284, 103, 209 59, 103, 210 -2, 0, 211 -1, 49, 212 284, 103, 213 59, 103, 214 -2, 0, 215 -1, 87, 216 284, 103, 217 59, 103, 218 -2, 0, 219 -1, 88, 220 284, 103, 221 59, 103, 222 -2, 0, 223 -1, 102, 224 284, 103, 225 59, 103, 226 -2, 0, 227 -1, 105, 228 284, 103, 229 59, 103, 230 -2, 0, 231 -1, 147, 232 284, 103, 233 59, 103, 234 -2, 0, 235 -1, 152, 236 59, 103, 237 -2, 0, 238 -1, 171, 239 284, 103, 240 59, 103, 241 -2, 0, 242 -1, 189, 243 284, 103, 244 59, 103, 245 -2, 0, 246 -1, 224, 247 41, 103, 248 -2, 0, 249 -1, 228, 250 41, 103, 251 -2, 0, 252 -1, 235, 253 284, 103, 254 59, 103, 255 -2, 0, 256 -1, 237, 257 284, 103, 258 59, 103, 259 -2, 0, 260 -1, 239, 261 284, 103, 262 59, 103, 263 -2, 0, 264 }; 265 # define YYNPROD 122 266 # define YYLAST 1727 267 static YYCONST yytabelem yyact[]={ 268 269 55, 33, 35, 30, 69, 29, 67, 68, 159, 160, 270 161, 177, 34, 225, 193, 201, 228, 200, 201, 155, 271 45, 46, 209, 48, 46, 172, 114, 37, 38, 82, 272 115, 197, 67, 68, 40, 6, 3, 43, 175, 55, 273 182, 44, 30, 7, 29, 41, 15, 183, 55, 158, 274 82, 30, 73, 29, 71, 210, 13, 181, 17, 66, 275 57, 15, 4, 14, 64, 62, 39, 63, 132, 65, 276 11, 66, 202, 236, 234, 152, 64, 59, 14, 49, 277 230, 65, 122, 94, 113, 212, 15, 15, 120, 15, 278 60, 61, 216, 221, 166, 215, 55, 132, 119, 30, 279 108, 29, 47, 14, 14, 151, 14, 150, 116, 77, 280 76, 102, 75, 70, 105, 16, 103, 104, 89, 106, 281 88, 50, 9, 87, 36, 171, 8, 134, 5, 2, 282 1, 94, 139, 174, 0, 56, 142, 143, 145, 146, 283 0, 0, 0, 0, 55, 0, 196, 30, 0, 29, 284 148, 149, 0, 0, 0, 0, 0, 0, 0, 0, 285 0, 147, 0, 0, 0, 162, 0, 0, 0, 0, 286 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, 287 0, 154, 0, 0, 0, 0, 0, 0, 178, 0, 288 173, 0, 55, 0, 0, 30, 0, 29, 45, 46, 289 176, 86, 0, 0, 0, 0, 0, 190, 0, 0, 290 0, 0, 0, 0, 0, 0, 98, 0, 0, 0, 291 0, 0, 189, 19, 0, 204, 30, 94, 29, 153, 292 17, 211, 203, 0, 0, 0, 0, 0, 0, 0, 293 0, 0, 206, 0, 0, 95, 96, 25, 27, 99, 294 0, 100, 101, 0, 90, 91, 92, 93, 55, 200, 295 201, 30, 42, 29, 98, 33, 35, 0, 24, 26, 296 0, 28, 23, 0, 114, 94, 34, 107, 115, 191, 297 0, 45, 46, 200, 201, 0, 25, 27, 0, 31, 298 32, 37, 38, 95, 96, 25, 27, 99, 0, 100, 299 101, 0, 90, 91, 92, 93, 12, 110, 111, 112, 300 109, 0, 98, 33, 35, 34, 24, 26, 0, 28, 301 23, 0, 55, 0, 34, 30, 0, 29, 31, 32, 302 37, 38, 113, 200, 201, 0, 0, 31, 32, 37, 303 38, 95, 96, 25, 27, 99, 0, 100, 101, 220, 304 90, 91, 92, 93, 187, 0, 222, 0, 0, 0, 305 98, 33, 35, 0, 24, 26, 0, 28, 23, 0, 306 55, 0, 34, 30, 0, 29, 0, 235, 0, 0, 307 0, 237, 0, 239, 0, 31, 32, 37, 38, 95, 308 96, 25, 27, 99, 0, 100, 101, 0, 90, 91, 309 92, 93, 0, 0, 0, 94, 0, 84, 98, 33, 310 35, 0, 24, 26, 0, 28, 23, 0, 55, 121, 311 34, 30, 0, 29, 0, 0, 229, 0, 0, 0, 312 233, 0, 0, 31, 32, 37, 38, 95, 96, 25, 313 27, 99, 0, 100, 101, 0, 90, 91, 92, 93, 314 0, 55, 0, 94, 30, 0, 29, 33, 35, 0, 315 24, 26, 0, 28, 23, 0, 10, 0, 34, 0, 316 25, 27, 0, 0, 98, 85, 0, 0, 0, 0, 317 0, 31, 32, 37, 38, 0, 0, 20, 33, 35, 318 0, 24, 26, 0, 28, 23, 0, 184, 0, 34, 319 30, 0, 29, 95, 96, 25, 27, 0, 0, 0, 320 0, 0, 31, 32, 37, 38, 224, 0, 0, 0, 321 0, 0, 0, 33, 35, 0, 24, 26, 0, 28, 322 23, 0, 55, 214, 34, 30, 213, 29, 98, 0, 323 0, 0, 0, 0, 0, 0, 0, 31, 32, 37, 324 38, 0, 0, 157, 0, 110, 111, 112, 109, 0, 325 159, 160, 161, 140, 141, 0, 0, 95, 96, 25, 326 27, 99, 0, 100, 101, 0, 90, 91, 92, 93, 327 55, 0, 0, 30, 0, 29, 98, 33, 35, 0, 328 24, 26, 55, 28, 23, 30, 0, 29, 34, 0, 329 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 330 0, 31, 32, 37, 38, 95, 96, 25, 27, 99, 331 0, 100, 101, 0, 90, 91, 92, 93, 0, 55, 332 0, 0, 30, 0, 29, 33, 35, 0, 24, 26, 333 0, 28, 23, 0, 0, 170, 34, 195, 43, 0, 334 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 335 32, 37, 38, 0, 0, 25, 27, 98, 55, 121, 336 0, 30, 131, 29, 0, 0, 0, 0, 0, 0, 337 0, 0, 0, 33, 35, 0, 24, 26, 0, 28, 338 23, 53, 51, 0, 34, 0, 95, 96, 25, 27, 339 0, 0, 0, 0, 0, 0, 0, 31, 32, 37, 340 38, 238, 0, 240, 0, 241, 33, 188, 0, 24, 341 26, 19, 28, 23, 30, 0, 29, 34, 17, 0, 342 55, 232, 0, 30, 0, 29, 0, 0, 0, 0, 343 31, 32, 37, 38, 25, 27, 0, 0, 0, 0, 344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 345 0, 185, 33, 35, 0, 24, 26, 0, 28, 23, 346 0, 0, 0, 34, 0, 0, 0, 0, 184, 25, 347 27, 30, 0, 29, 0, 0, 31, 32, 37, 38, 348 55, 231, 0, 30, 0, 29, 0, 33, 35, 0, 349 24, 26, 0, 28, 23, 0, 0, 0, 34, 0, 350 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 351 0, 31, 32, 37, 38, 0, 0, 25, 27, 55, 352 217, 0, 30, 0, 29, 0, 0, 0, 55, 25, 353 27, 30, 169, 29, 0, 33, 35, 0, 24, 26, 354 0, 28, 23, 53, 51, 0, 34, 33, 35, 0, 355 24, 26, 0, 28, 23, 0, 0, 0, 34, 31, 356 32, 37, 38, 42, 0, 55, 25, 27, 30, 168, 357 29, 31, 32, 37, 38, 0, 0, 55, 0, 0, 358 30, 167, 29, 0, 33, 35, 0, 24, 26, 0, 359 28, 23, 0, 0, 0, 34, 0, 0, 0, 0, 360 0, 0, 0, 0, 0, 25, 27, 0, 31, 32, 361 37, 38, 55, 163, 0, 30, 0, 29, 0, 0, 362 0, 0, 0, 33, 35, 0, 24, 26, 0, 28, 363 23, 0, 0, 0, 34, 0, 0, 0, 0, 0, 364 0, 0, 0, 0, 0, 0, 0, 31, 32, 37, 365 38, 55, 121, 0, 30, 0, 29, 0, 25, 27, 366 55, 0, 0, 30, 131, 29, 0, 25, 27, 0, 367 0, 0, 0, 0, 0, 20, 33, 35, 0, 24, 368 26, 0, 28, 23, 0, 33, 35, 34, 24, 26, 369 0, 28, 23, 0, 0, 0, 34, 0, 0, 0, 370 31, 32, 37, 38, 0, 0, 0, 0, 0, 31, 371 32, 37, 38, 0, 0, 25, 27, 55, 129, 0, 372 30, 0, 29, 0, 0, 0, 55, 25, 27, 30, 373 0, 29, 185, 33, 35, 0, 24, 26, 0, 28, 374 23, 0, 0, 114, 34, 33, 35, 115, 24, 26, 375 0, 28, 23, 0, 0, 0, 34, 31, 32, 37, 376 38, 179, 0, 0, 0, 0, 25, 27, 0, 31, 377 32, 37, 38, 0, 74, 25, 27, 30, 0, 29, 378 0, 0, 0, 0, 33, 35, 0, 24, 26, 0, 379 28, 23, 0, 33, 35, 34, 24, 26, 0, 28, 380 23, 113, 0, 114, 34, 0, 0, 115, 31, 32, 381 37, 38, 25, 27, 156, 0, 0, 31, 32, 37, 382 38, 0, 0, 0, 25, 27, 0, 0, 0, 0, 383 33, 35, 0, 24, 26, 0, 28, 23, 0, 0, 384 0, 34, 33, 35, 0, 24, 26, 0, 28, 23, 385 0, 0, 0, 34, 31, 32, 37, 38, 0, 25, 386 27, 113, 0, 0, 0, 0, 31, 32, 37, 38, 387 0, 0, 0, 0, 0, 0, 0, 33, 35, 0, 388 24, 26, 0, 28, 23, 0, 0, 0, 34, 0, 389 0, 0, 0, 0, 0, 0, 0, 0, 25, 27, 390 0, 31, 32, 37, 38, 0, 0, 25, 27, 0, 391 0, 0, 0, 186, 0, 0, 33, 35, 0, 24, 392 26, 0, 28, 23, 0, 33, 35, 34, 24, 26, 393 0, 28, 23, 0, 0, 0, 34, 0, 0, 0, 394 31, 32, 37, 38, 0, 0, 207, 208, 0, 31, 395 32, 37, 38, 0, 0, 0, 0, 0, 0, 0, 396 0, 0, 218, 219, 25, 27, 0, 0, 0, 0, 397 0, 0, 223, 25, 27, 0, 0, 0, 0, 0, 398 0, 0, 33, 35, 0, 24, 26, 0, 28, 23, 399 0, 33, 35, 34, 24, 26, 0, 28, 23, 0, 400 0, 0, 34, 0, 0, 0, 31, 32, 37, 38, 401 0, 0, 0, 0, 0, 31, 32, 37, 38, 0, 402 0, 25, 27, 0, 110, 111, 112, 109, 0, 159, 403 160, 161, 0, 0, 0, 0, 0, 22, 0, 33, 404 35, 0, 24, 26, 0, 28, 23, 0, 0, 0, 405 34, 0, 0, 0, 0, 0, 54, 0, 0, 0, 406 0, 0, 0, 31, 32, 37, 38, 54, 54, 80, 407 81, 0, 0, 0, 0, 0, 54, 0, 0, 0, 408 0, 0, 157, 0, 110, 111, 112, 109, 0, 159, 409 160, 161, 0, 0, 0, 0, 54, 0, 0, 0, 410 54, 54, 54, 54, 54, 0, 0, 0, 0, 0, 411 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 412 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 413 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 414 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 415 0, 78, 79, 0, 0, 54, 54, 0, 0, 0, 416 83, 0, 0, 0, 0, 0, 54, 0, 54, 0, 417 0, 54, 0, 54, 54, 54, 54, 0, 0, 0, 418 52, 0, 54, 0, 123, 124, 125, 126, 127, 0, 419 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 420 97, 0, 54, 54, 0, 0, 18, 0, 0, 0, 421 0, 0, 0, 0, 0, 0, 0, 0, 54, 52, 422 58, 18, 0, 0, 0, 0, 72, 0, 0, 0, 423 54, 0, 54, 0, 0, 0, 54, 54, 0, 52, 424 52, 0, 0, 54, 0, 0, 18, 18, 0, 18, 425 52, 0, 52, 0, 117, 52, 118, 52, 52, 52, 426 52, 0, 0, 0, 54, 54, 52, 0, 0, 0, 427 128, 130, 0, 0, 0, 133, 135, 136, 137, 0, 428 0, 0, 0, 138, 0, 0, 52, 52, 0, 0, 429 0, 0, 144, 0, 0, 0, 72, 72, 0, 0, 430 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 431 0, 0, 0, 0, 52, 0, 52, 0, 0, 0, 432 52, 52, 0, 0, 0, 0, 0, 52, 0, 0, 433 0, 0, 164, 165, 0, 0, 0, 0, 0, 0, 434 0, 0, 0, 0, 0, 0, 0, 0, 52, 52, 435 0, 180, 180, 0, 0, 0, 0, 0, 0, 0, 436 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 437 194, 0, 0, 0, 0, 0, 198, 0, 0, 199, 438 0, 0, 0, 0, 0, 205, 180, 0, 0, 0, 439 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 440 0, 180, 180, 0, 0, 0, 0, 0, 0, 0, 441 0, 180, 0, 0, 226, 0, 227 }; 442 static YYCONST yytabelem yypact[]={ 443 444 -220,-10000000, -249,-10000000, -80, 183,-10000000,-10000000, -250, -22, 445 -82, -21,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, 540, 681, 446 681, 22, -297,-10000000, 73, 1044, 72, 70, 69, 996, 447 996, -304, -304,-10000000,-10000000, -41,-10000000,-10000000, 996, 282, 448 -10000000,-10000000,-10000000,-10000000,-10000000, 681, 681,-10000000, 681, 152, 449 -10, 11, 22, 996, -323, 996, 57, 47, 378, 41, 450 -282,-10000000, 996, 996, 996, 996, 996,-10000000,-10000000, 996, 451 987,-10000000, 930, 24, 1044, 996, 996, 996,-10000000,-10000000, 452 -10000000,-10000000, 996,-10000000,-10000000,-10000000, -22, 330, 330,-10000000, 453 -22, 589, -22, -22,-10000000, 1044, 1044, 996,-10000000, 67, 454 65, 35, 104, -279,-10000000, 56, -104,-10000000, 1077,-10000000, 455 -10000000,-10000000,-10000000,-10000000,-10000000, -10,-10000000, -1, 921,-10000000, 456 -10000000,-10000000,-10000000, 34, 34,-10000000,-10000000,-10000000, 996,-10000000, 457 882, 996, 996, 628, 53, 847, 835, 798, 552,-10000000, 458 -265,-10000000,-10000000,-10000000, 589,-10000000,-10000000, 8, -113, -113, 459 738, 738, 411,-10000000,-10000000,-10000000,-10000000, -10, -314,-10000000, 460 -10000000,-10000000, 238,-10000000, 996, 996,-10000000, 996, -292, 996, 461 -10000000, 330, -253,-10000000,-10000000, 996,-10000000,-10000000, 996, 31, 462 540,-10000000,-10000000,-10000000, 738, 738, -19, -4, -62, -40, 463 1017,-10000000, 492, 51, 789,-10000000,-10000000,-10000000, 996, 996, 464 738, 738, -253, 52, 47, 378, 41, -285,-10000000, -253, 465 457, -293,-10000000, 996,-10000000, 996,-10000000,-10000000, -288,-10000000, 466 -10000000,-10000000,-10000000, -43, 218, 39, 750, 690, 218, 33, 467 -253,-10000000,-10000000, 32, -253, 330, -253, 330,-10000000, 330, 468 -10000000,-10000000 }; 469 static YYCONST yytabelem yypgo[]={ 470 471 0, 130, 129, 128, 126, 66, 47, 1071, 115, 70, 472 1510, 57, 40, 125, 146, 124, 1431, 123, 56, 1347, 473 54, 122, 45, 52, 38, 121, 49, 201, 475, 120, 474 118 }; 475 static YYCONST yytabelem yyr1[]={ 476 477 0, 1, 1, 2, 2, 2, 4, 4, 4, 6, 478 6, 6, 6, 8, 8, 8, 8, 7, 7, 7, 479 7, 13, 15, 15, 17, 12, 12, 19, 19, 19, 480 19, 19, 16, 16, 16, 16, 16, 16, 16, 16, 481 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 482 16, 16, 16, 16, 16, 10, 10, 10, 14, 14, 483 21, 21, 21, 21, 21, 3, 3, 3, 9, 9, 484 9, 9, 20, 20, 20, 23, 23, 23, 24, 24, 485 25, 18, 26, 26, 26, 26, 26, 26, 26, 26, 486 26, 26, 26, 26, 11, 11, 22, 22, 27, 27, 487 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 488 28, 28, 28, 28, 28, 28, 5, 5, 29, 30, 489 30, 30 }; 490 static YYCONST yytabelem yyr2[]={ 491 492 0, 7, 3, 9, 4, 1, 9, 4, 1, 7, 493 7, 5, 7, 7, 7, 5, 7, 3, 2, 2, 494 2, 4, 3, 5, 11, 7, 7, 3, 3, 3, 495 9, 2, 2, 3, 3, 7, 9, 5, 17, 13, 496 17, 13, 13, 7, 7, 7, 7, 7, 7, 5, 497 5, 5, 5, 5, 5, 2, 5, 7, 2, 0, 498 3, 9, 7, 13, 7, 7, 1, 5, 3, 2, 499 2, 2, 2, 2, 1, 7, 7, 7, 2, 2, 500 1, 9, 3, 3, 3, 3, 3, 3, 7, 5, 501 5, 5, 5, 7, 7, 7, 2, 2, 9, 5, 502 9, 5, 3, 1, 3, 4, 5, 9, 5, 2, 503 5, 5, 7, 5, 5, 7, 5, 1, 11, 21, 504 19, 17 }; 505 static YYCONST yytabelem yychk[]={ 506 507 -10000000, -1, -2, 256, 282, -3, 284, 123, -4, -21, 508 283, -9, 123, -18, -11, -12, -8, 47, -10, 40, 509 304, -16, -19, 312, 308, 287, 309, 288, 311, 45, 510 43, 329, 330, 305, 316, 306, -15, 331, 332, -5, 511 284, -22, 284, 59, 123, 302, 303, 123, 44, -5, 512 -25, 314, -16, 313, -19, 40, -8, -12, -10, -11, 513 -9, -9, 43, 45, 42, 47, 37, 329, 330, 301, 514 40, -20, -10, -23, 40, 40, 40, 40, -16, -16, 515 -19, -19, 91, -16, 125, -28, -27, -17, -29, -30, 516 294, 295, 296, 297, 123, 285, 286, -10, 256, 289, 517 291, 292, -5, -9, -9, -5, -9, 125, -26, 320, 518 317, 318, 319, 94, 36, 40, -18, -10, -10, 41, 519 41, 41, 41, -16, -16, -16, -16, -16, -10, 41, 520 -10, 44, 44, -10, -23, -10, -10, -10, -10, -22, 521 -28, -28, -22, -22, -10, -22, -22, -5, -20, -20, 522 40, 40, 40, 125, 125, 123, 47, 315, -26, 322, 523 323, 324, -26, 41, -10, -10, 41, 44, 44, 44, 524 93, -13, 290, -22, 125, -24, 313, 124, -24, -7, 525 -10, -11, -12, -6, 40, 304, -7, -27, 306, -5, 526 -26, 41, -10, 306, -10, -28, -14, 284, -10, -10, 527 302, 303, 41, -6, -12, -10, -11, -7, -7, 41, 528 59, 293, 125, 44, 41, 44, 41, 41, -7, -7, 529 -14, 41, -14, -7, 59, 306, -10, -10, 59, -27, 530 41, 41, 41, -27, 41, -14, 41, -14, -28, -14, 531 -28, -28 }; 532 static YYCONST yytabelem yydef[]={ 533 534 -2, -2, 66, 2, 0, 8, 4, 117, 1, 67, 535 0, 60, 117, 68, 69, 70, 71, 80, 0, 0, 536 0, 55, 32, 33, 34, 74, 0, 0, 0, 0, 537 0, 0, 0, 27, 28, 29, 31, 22, 0, -2, 538 7, 65, 96, 97, 117, 0, 0, 117, 0, -2, 539 0, 0, 56, 0, 32, 0, 71, 70, 0, 69, 540 0, 15, 0, 0, 0, 0, 0, 53, 54, 0, 541 0, 37, 72, 73, 0, 0, 0, 0, 49, 50, 542 51, 52, 0, 23, 3, 116, 0, -2, -2, 109, 543 0, 0, 0, 0, 117, 74, 74, 102, 104, 0, 544 0, 0, -2, 13, 14, -2, 62, 64, 0, 82, 545 83, 84, 85, 86, 87, 0, 25, 94, 0, 16, 546 26, 43, 95, 44, 45, 46, 47, 48, 57, 35, 547 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 548 106, 108, 110, 111, 0, 113, 114, -2, 99, 101, 549 0, 0, -2, 6, 61, 117, 81, 0, 89, 90, 550 91, 92, 0, 36, 75, 76, 77, 0, 0, 0, 551 30, -2, 59, 112, 115, 0, 78, 79, 0, 0, 552 17, 18, 19, 20, 0, 0, 0, 0, 29, -2, 553 88, 93, 0, 0, 0, 107, 21, 58, 98, 100, 554 0, 0, 59, 20, 19, 17, 18, 0, 11, 59, 555 0, 0, 63, 0, 39, 0, 41, 42, 9, 10, 556 24, 12, 118, 0, -2, 0, 0, 0, -2, 0, 557 59, 38, 40, 0, 59, -2, 59, -2, 121, -2, 558 120, 119 }; 559 typedef struct 560 #ifdef __cplusplus 561 yytoktype 562 #endif 563 { 564 #ifdef __cplusplus 565 const 566 #endif 567 char *t_name; int t_val; } yytoktype; 568 #ifndef YYDEBUG 569 # define YYDEBUG 0 /* don't allow debugging */ 570 #endif 571 572 #if YYDEBUG 573 574 yytoktype yytoks[] = 575 { 576 "FIRSTTOKEN", 257, 577 "FINAL", 258, 578 "FATAL", 259, 579 "LT", 260, 580 "LE", 261, 581 "GT", 262, 582 "GE", 263, 583 "EQ", 264, 584 "NE", 265, 585 "MATCH", 266, 586 "NOTMATCH", 267, 587 "APPEND", 268, 588 "ADD", 269, 589 "MINUS", 270, 590 "MULT", 271, 591 "DIVIDE", 272, 592 "MOD", 273, 593 "UMINUS", 274, 594 "ASSIGN", 275, 595 "ADDEQ", 276, 596 "SUBEQ", 277, 597 "MULTEQ", 278, 598 "DIVEQ", 279, 599 "MODEQ", 280, 600 "JUMP", 281, 601 "XBEGIN", 282, 602 "XEND", 283, 603 "NL", 284, 604 "PRINT", 285, 605 "PRINTF", 286, 606 "SPRINTF", 287, 607 "SPLIT", 288, 608 "IF", 289, 609 "ELSE", 290, 610 "WHILE", 291, 611 "FOR", 292, 612 "IN", 293, 613 "NEXT", 294, 614 "EXIT", 295, 615 "BREAK", 296, 616 "CONTINUE", 297, 617 "PROGRAM", 298, 618 "PASTAT", 299, 619 "PASTAT2", 300, 620 "ASGNOP", 301, 621 "BOR", 302, 622 "AND", 303, 623 "NOT", 304, 624 "NUMBER", 305, 625 "VAR", 306, 626 "ARRAY", 307, 627 "FNCN", 308, 628 "SUBSTR", 309, 629 "LSUBSTR", 310, 630 "INDEX", 311, 631 "GETLINE", 312, 632 "RELOP", 313, 633 "MATCHOP", 314, 634 "OR", 315, 635 "STRING", 316, 636 "DOT", 317, 637 "CCL", 318, 638 "NCCL", 319, 639 "CHAR", 320, 640 "(", 40, 641 "^", 94, 642 "$", 36, 643 "CAT", 321, 644 "+", 43, 645 "-", 45, 646 "*", 42, 647 "/", 47, 648 "%", 37, 649 "STAR", 322, 650 "PLUS", 323, 651 "QUEST", 324, 652 "POSTINCR", 325, 653 "PREINCR", 326, 654 "POSTDECR", 327, 655 "PREDECR", 328, 656 "INCR", 329, 657 "DECR", 330, 658 "FIELD", 331, 659 "INDIRECT", 332, 660 "JUMPTRUE", 333, 661 "JUMPFALSE", 334, 662 "PUSH", 335, 663 "GETREC", 336, 664 "NEWSTAT", 337, 665 "IN_INIT", 338, 666 "IN_EXIT", 339, 667 "LASTTOKEN", 340, 668 "-unknown-", -1 /* ends search */ 669 }; 670 671 #ifdef __cplusplus 672 const 673 #endif 674 char * yyreds[] = 675 { 676 "-no such reduction-", 677 "program : begin pa_stats end", 678 "program : error", 679 "begin : XBEGIN '{' stat_list '}'", 680 "begin : begin NL", 681 "begin : /* empty */", 682 "end : XEND '{' stat_list '}'", 683 "end : end NL", 684 "end : /* empty */", 685 "compound_conditional : conditional BOR conditional", 686 "compound_conditional : conditional AND conditional", 687 "compound_conditional : NOT conditional", 688 "compound_conditional : '(' compound_conditional ')'", 689 "compound_pattern : pattern BOR pattern", 690 "compound_pattern : pattern AND pattern", 691 "compound_pattern : NOT pattern", 692 "compound_pattern : '(' compound_pattern ')'", 693 "conditional : expr", 694 "conditional : rel_expr", 695 "conditional : lex_expr", 696 "conditional : compound_conditional", 697 "else : ELSE optNL", 698 "field : FIELD", 699 "field : INDIRECT term", 700 "if : IF '(' conditional ')' optNL", 701 "lex_expr : expr MATCHOP regular_expr", 702 "lex_expr : '(' lex_expr ')'", 703 "var : NUMBER", 704 "var : STRING", 705 "var : VAR", 706 "var : VAR '[' expr ']'", 707 "var : field", 708 "term : var", 709 "term : GETLINE", 710 "term : FNCN", 711 "term : FNCN '(' ')'", 712 "term : FNCN '(' expr ')'", 713 "term : SPRINTF print_list", 714 "term : SUBSTR '(' expr ',' expr ',' expr ')'", 715 "term : SUBSTR '(' expr ',' expr ')'", 716 "term : SPLIT '(' expr ',' VAR ',' expr ')'", 717 "term : SPLIT '(' expr ',' VAR ')'", 718 "term : INDEX '(' expr ',' expr ')'", 719 "term : '(' expr ')'", 720 "term : term '+' term", 721 "term : term '-' term", 722 "term : term '*' term", 723 "term : term '/' term", 724 "term : term '%' term", 725 "term : '-' term", 726 "term : '+' term", 727 "term : INCR var", 728 "term : DECR var", 729 "term : var INCR", 730 "term : var DECR", 731 "expr : term", 732 "expr : expr term", 733 "expr : var ASGNOP expr", 734 "optNL : NL", 735 "optNL : /* empty */", 736 "pa_stat : pattern", 737 "pa_stat : pattern '{' stat_list '}'", 738 "pa_stat : pattern ',' pattern", 739 "pa_stat : pattern ',' pattern '{' stat_list '}'", 740 "pa_stat : '{' stat_list '}'", 741 "pa_stats : pa_stats pa_stat st", 742 "pa_stats : /* empty */", 743 "pa_stats : pa_stats pa_stat", 744 "pattern : regular_expr", 745 "pattern : rel_expr", 746 "pattern : lex_expr", 747 "pattern : compound_pattern", 748 "print_list : expr", 749 "print_list : pe_list", 750 "print_list : /* empty */", 751 "pe_list : expr ',' expr", 752 "pe_list : pe_list ',' expr", 753 "pe_list : '(' pe_list ')'", 754 "redir : RELOP", 755 "redir : '|'", 756 "regular_expr : '/'", 757 "regular_expr : '/' r '/'", 758 "r : CHAR", 759 "r : DOT", 760 "r : CCL", 761 "r : NCCL", 762 "r : '^'", 763 "r : '$'", 764 "r : r OR r", 765 "r : r r", 766 "r : r STAR", 767 "r : r PLUS", 768 "r : r QUEST", 769 "r : '(' r ')'", 770 "rel_expr : expr RELOP expr", 771 "rel_expr : '(' rel_expr ')'", 772 "st : NL", 773 "st : ';'", 774 "simple_stat : PRINT print_list redir expr", 775 "simple_stat : PRINT print_list", 776 "simple_stat : PRINTF print_list redir expr", 777 "simple_stat : PRINTF print_list", 778 "simple_stat : expr", 779 "simple_stat : /* empty */", 780 "simple_stat : error", 781 "statement : simple_stat st", 782 "statement : if statement", 783 "statement : if statement else statement", 784 "statement : while statement", 785 "statement : for", 786 "statement : NEXT st", 787 "statement : EXIT st", 788 "statement : EXIT expr st", 789 "statement : BREAK st", 790 "statement : CONTINUE st", 791 "statement : '{' stat_list '}'", 792 "stat_list : stat_list statement", 793 "stat_list : /* empty */", 794 "while : WHILE '(' conditional ')' optNL", 795 "for : FOR '(' simple_stat ';' conditional ';' simple_stat ')' optNL statement", 796 "for : FOR '(' simple_stat ';' ';' simple_stat ')' optNL statement", 797 "for : FOR '(' VAR IN VAR ')' optNL statement", 798 }; 799 #endif /* YYDEBUG */ 800 # line 1 "/usr/share/lib/ccs/yaccpar" 801 /* 802 * CDDL HEADER START 803 * 804 * The contents of this file are subject to the terms of the 805 * Common Development and Distribution License, Version 1.0 only 806 * (the "License"). You may not use this file except in compliance 807 * with the License. 808 * 809 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 810 * or http://www.opensolaris.org/os/licensing. 811 * See the License for the specific language governing permissions 812 * and limitations under the License. 813 * 814 * When distributing Covered Code, include this CDDL HEADER in each 815 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 816 * If applicable, add the following below this CDDL HEADER, with the 817 * fields enclosed by brackets "[]" replaced with your own identifying 818 * information: Portions Copyright [yyyy] [name of copyright owner] 819 * 820 * CDDL HEADER END 821 */ 822 /* 823 * Copyright 1993 Sun Microsystems, Inc. All rights reserved. 824 * Use is subject to license terms. 825 */ 826 827 /* Copyright (c) 1988 AT&T */ 828 /* All Rights Reserved */ 829 830 #pragma ident "%Z%%M% %I% %E% SMI" 831 832 /* 833 ** Skeleton parser driver for yacc output 834 */ 835 836 /* 837 ** yacc user known macros and defines 838 */ 839 #define YYERROR goto yyerrlab 840 #define YYACCEPT return(0) 841 #define YYABORT return(1) 842 #define YYBACKUP( newtoken, newvalue )\ 843 {\ 844 if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ 845 {\ 846 yyerror( "syntax error - cannot backup" );\ 847 goto yyerrlab;\ 848 }\ 849 yychar = newtoken;\ 850 yystate = *yyps;\ 851 yylval = newvalue;\ 852 goto yynewstate;\ 853 } 854 #define YYRECOVERING() (!!yyerrflag) 855 #define YYNEW(type) malloc(sizeof(type) * yynewmax) 856 #define YYCOPY(to, from, type) \ 857 (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) 858 #define YYENLARGE( from, type) \ 859 (type *) realloc((char *) from, yynewmax * sizeof(type)) 860 #ifndef YYDEBUG 861 # define YYDEBUG 1 /* make debugging available */ 862 #endif 863 864 /* 865 ** user known globals 866 */ 867 int yydebug; /* set to 1 to get debugging */ 868 869 /* 870 ** driver internal defines 871 */ 872 #define YYFLAG (-10000000) 873 874 /* 875 ** global variables used by the parser 876 */ 877 YYSTYPE *yypv; /* top of value stack */ 878 int *yyps; /* top of state stack */ 879 880 int yystate; /* current state */ 881 int yytmp; /* extra var (lasts between blocks) */ 882 883 int yynerrs; /* number of errors */ 884 int yyerrflag; /* error recovery flag */ 885 int yychar; /* current input token number */ 886 887 888 889 #ifdef YYNMBCHARS 890 #define YYLEX() yycvtok(yylex()) 891 /* 892 ** yycvtok - return a token if i is a wchar_t value that exceeds 255. 893 ** If i<255, i itself is the token. If i>255 but the neither 894 ** of the 30th or 31st bit is on, i is already a token. 895 */ 896 #if defined(__STDC__) || defined(__cplusplus) 897 int yycvtok(int i) 898 #else 899 int yycvtok(i) int i; 900 #endif 901 { 902 int first = 0; 903 int last = YYNMBCHARS - 1; 904 int mid; 905 wchar_t j; 906 907 if(i&0x60000000){/*Must convert to a token. */ 908 if( yymbchars[last].character < i ){ 909 return i;/*Giving up*/ 910 } 911 while ((last>=first)&&(first>=0)) {/*Binary search loop*/ 912 mid = (first+last)/2; 913 j = yymbchars[mid].character; 914 if( j==i ){/*Found*/ 915 return yymbchars[mid].tvalue; 916 }else if( j<i ){ 917 first = mid + 1; 918 }else{ 919 last = mid -1; 920 } 921 } 922 /*No entry in the table.*/ 923 return i;/* Giving up.*/ 924 }else{/* i is already a token. */ 925 return i; 926 } 927 } 928 #else/*!YYNMBCHARS*/ 929 #define YYLEX() yylex() 930 #endif/*!YYNMBCHARS*/ 931 932 /* 933 ** yyparse - return 0 if worked, 1 if syntax error not recovered from 934 */ 935 #if defined(__STDC__) || defined(__cplusplus) 936 int yyparse(void) 937 #else 938 int yyparse() 939 #endif 940 { 941 register YYSTYPE *yypvt = 0; /* top of value stack for $vars */ 942 943 #if defined(__cplusplus) || defined(lint) 944 /* 945 hacks to please C++ and lint - goto's inside 946 switch should never be executed 947 */ 948 static int __yaccpar_lint_hack__ = 0; 949 switch (__yaccpar_lint_hack__) 950 { 951 case 1: goto yyerrlab; 952 case 2: goto yynewstate; 953 } 954 #endif 955 956 /* 957 ** Initialize externals - yyparse may be called more than once 958 */ 959 yypv = &yyv[-1]; 960 yyps = &yys[-1]; 961 yystate = 0; 962 yytmp = 0; 963 yynerrs = 0; 964 yyerrflag = 0; 965 yychar = -1; 966 967 #if YYMAXDEPTH <= 0 968 if (yymaxdepth <= 0) 969 { 970 if ((yymaxdepth = YYEXPAND(0)) <= 0) 971 { 972 yyerror("yacc initialization error"); 973 YYABORT; 974 } 975 } 976 #endif 977 978 { 979 register YYSTYPE *yy_pv; /* top of value stack */ 980 register int *yy_ps; /* top of state stack */ 981 register int yy_state; /* current state */ 982 register int yy_n; /* internal state number info */ 983 goto yystack; /* moved from 6 lines above to here to please C++ */ 984 985 /* 986 ** get globals into registers. 987 ** branch to here only if YYBACKUP was called. 988 */ 989 yynewstate: 990 yy_pv = yypv; 991 yy_ps = yyps; 992 yy_state = yystate; 993 goto yy_newstate; 994 995 /* 996 ** get globals into registers. 997 ** either we just started, or we just finished a reduction 998 */ 999 yystack: 1000 yy_pv = yypv; 1001 yy_ps = yyps; 1002 yy_state = yystate; 1003 1004 /* 1005 ** top of for (;;) loop while no reductions done 1006 */ 1007 yy_stack: 1008 /* 1009 ** put a state and value onto the stacks 1010 */ 1011 #if YYDEBUG 1012 /* 1013 ** if debugging, look up token value in list of value vs. 1014 ** name pairs. 0 and negative (-1) are special values. 1015 ** Note: linear search is used since time is not a real 1016 ** consideration while debugging. 1017 */ 1018 if ( yydebug ) 1019 { 1020 register int yy_i; 1021 1022 printf( "State %d, token ", yy_state ); 1023 if ( yychar == 0 ) 1024 printf( "end-of-file\n" ); 1025 else if ( yychar < 0 ) 1026 printf( "-none-\n" ); 1027 else 1028 { 1029 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 1030 yy_i++ ) 1031 { 1032 if ( yytoks[yy_i].t_val == yychar ) 1033 break; 1034 } 1035 printf( "%s\n", yytoks[yy_i].t_name ); 1036 } 1037 } 1038 #endif /* YYDEBUG */ 1039 if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ 1040 { 1041 /* 1042 ** reallocate and recover. Note that pointers 1043 ** have to be reset, or bad things will happen 1044 */ 1045 long yyps_index = (yy_ps - yys); 1046 long yypv_index = (yy_pv - yyv); 1047 long yypvt_index = (yypvt - yyv); 1048 int yynewmax; 1049 #ifdef YYEXPAND 1050 yynewmax = YYEXPAND(yymaxdepth); 1051 #else 1052 yynewmax = 2 * yymaxdepth; /* double table size */ 1053 if (yymaxdepth == YYMAXDEPTH) /* first time growth */ 1054 { 1055 char *newyys = (char *)YYNEW(int); 1056 char *newyyv = (char *)YYNEW(YYSTYPE); 1057 if (newyys != 0 && newyyv != 0) 1058 { 1059 yys = YYCOPY(newyys, yys, int); 1060 yyv = YYCOPY(newyyv, yyv, YYSTYPE); 1061 } 1062 else 1063 yynewmax = 0; /* failed */ 1064 } 1065 else /* not first time */ 1066 { 1067 yys = YYENLARGE(yys, int); 1068 yyv = YYENLARGE(yyv, YYSTYPE); 1069 if (yys == 0 || yyv == 0) 1070 yynewmax = 0; /* failed */ 1071 } 1072 #endif 1073 if (yynewmax <= yymaxdepth) /* tables not expanded */ 1074 { 1075 yyerror( "yacc stack overflow" ); 1076 YYABORT; 1077 } 1078 yymaxdepth = yynewmax; 1079 1080 yy_ps = yys + yyps_index; 1081 yy_pv = yyv + yypv_index; 1082 yypvt = yyv + yypvt_index; 1083 } 1084 *yy_ps = yy_state; 1085 *++yy_pv = yyval; 1086 1087 /* 1088 ** we have a new state - find out what to do 1089 */ 1090 yy_newstate: 1091 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) 1092 goto yydefault; /* simple state */ 1093 #if YYDEBUG 1094 /* 1095 ** if debugging, need to mark whether new token grabbed 1096 */ 1097 yytmp = yychar < 0; 1098 #endif 1099 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 1100 yychar = 0; /* reached EOF */ 1101 #if YYDEBUG 1102 if ( yydebug && yytmp ) 1103 { 1104 register int yy_i; 1105 1106 printf( "Received token " ); 1107 if ( yychar == 0 ) 1108 printf( "end-of-file\n" ); 1109 else if ( yychar < 0 ) 1110 printf( "-none-\n" ); 1111 else 1112 { 1113 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 1114 yy_i++ ) 1115 { 1116 if ( yytoks[yy_i].t_val == yychar ) 1117 break; 1118 } 1119 printf( "%s\n", yytoks[yy_i].t_name ); 1120 } 1121 } 1122 #endif /* YYDEBUG */ 1123 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) 1124 goto yydefault; 1125 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ 1126 { 1127 yychar = -1; 1128 yyval = yylval; 1129 yy_state = yy_n; 1130 if ( yyerrflag > 0 ) 1131 yyerrflag--; 1132 goto yy_stack; 1133 } 1134 1135 yydefault: 1136 if ( ( yy_n = yydef[ yy_state ] ) == -2 ) 1137 { 1138 #if YYDEBUG 1139 yytmp = yychar < 0; 1140 #endif 1141 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 1142 yychar = 0; /* reached EOF */ 1143 #if YYDEBUG 1144 if ( yydebug && yytmp ) 1145 { 1146 register int yy_i; 1147 1148 printf( "Received token " ); 1149 if ( yychar == 0 ) 1150 printf( "end-of-file\n" ); 1151 else if ( yychar < 0 ) 1152 printf( "-none-\n" ); 1153 else 1154 { 1155 for ( yy_i = 0; 1156 yytoks[yy_i].t_val >= 0; 1157 yy_i++ ) 1158 { 1159 if ( yytoks[yy_i].t_val 1160 == yychar ) 1161 { 1162 break; 1163 } 1164 } 1165 printf( "%s\n", yytoks[yy_i].t_name ); 1166 } 1167 } 1168 #endif /* YYDEBUG */ 1169 /* 1170 ** look through exception table 1171 */ 1172 { 1173 register YYCONST int *yyxi = yyexca; 1174 1175 while ( ( *yyxi != -1 ) || 1176 ( yyxi[1] != yy_state ) ) 1177 { 1178 yyxi += 2; 1179 } 1180 while ( ( *(yyxi += 2) >= 0 ) && 1181 ( *yyxi != yychar ) ) 1182 ; 1183 if ( ( yy_n = yyxi[1] ) < 0 ) 1184 YYACCEPT; 1185 } 1186 } 1187 1188 /* 1189 ** check for syntax error 1190 */ 1191 if ( yy_n == 0 ) /* have an error */ 1192 { 1193 /* no worry about speed here! */ 1194 switch ( yyerrflag ) 1195 { 1196 case 0: /* new error */ 1197 yyerror( "syntax error" ); 1198 goto skip_init; 1199 yyerrlab: 1200 /* 1201 ** get globals into registers. 1202 ** we have a user generated syntax type error 1203 */ 1204 yy_pv = yypv; 1205 yy_ps = yyps; 1206 yy_state = yystate; 1207 skip_init: 1208 yynerrs++; 1209 /* FALLTHRU */ 1210 case 1: 1211 case 2: /* incompletely recovered error */ 1212 /* try again... */ 1213 yyerrflag = 3; 1214 /* 1215 ** find state where "error" is a legal 1216 ** shift action 1217 */ 1218 while ( yy_ps >= yys ) 1219 { 1220 yy_n = yypact[ *yy_ps ] + YYERRCODE; 1221 if ( yy_n >= 0 && yy_n < YYLAST && 1222 yychk[yyact[yy_n]] == YYERRCODE) { 1223 /* 1224 ** simulate shift of "error" 1225 */ 1226 yy_state = yyact[ yy_n ]; 1227 goto yy_stack; 1228 } 1229 /* 1230 ** current state has no shift on 1231 ** "error", pop stack 1232 */ 1233 #if YYDEBUG 1234 # define _POP_ "Error recovery pops state %d, uncovers state %d\n" 1235 if ( yydebug ) 1236 printf( _POP_, *yy_ps, 1237 yy_ps[-1] ); 1238 # undef _POP_ 1239 #endif 1240 yy_ps--; 1241 yy_pv--; 1242 } 1243 /* 1244 ** there is no state on stack with "error" as 1245 ** a valid shift. give up. 1246 */ 1247 YYABORT; 1248 case 3: /* no shift yet; eat a token */ 1249 #if YYDEBUG 1250 /* 1251 ** if debugging, look up token in list of 1252 ** pairs. 0 and negative shouldn't occur, 1253 ** but since timing doesn't matter when 1254 ** debugging, it doesn't hurt to leave the 1255 ** tests here. 1256 */ 1257 if ( yydebug ) 1258 { 1259 register int yy_i; 1260 1261 printf( "Error recovery discards " ); 1262 if ( yychar == 0 ) 1263 printf( "token end-of-file\n" ); 1264 else if ( yychar < 0 ) 1265 printf( "token -none-\n" ); 1266 else 1267 { 1268 for ( yy_i = 0; 1269 yytoks[yy_i].t_val >= 0; 1270 yy_i++ ) 1271 { 1272 if ( yytoks[yy_i].t_val 1273 == yychar ) 1274 { 1275 break; 1276 } 1277 } 1278 printf( "token %s\n", 1279 yytoks[yy_i].t_name ); 1280 } 1281 } 1282 #endif /* YYDEBUG */ 1283 if ( yychar == 0 ) /* reached EOF. quit */ 1284 YYABORT; 1285 yychar = -1; 1286 goto yy_newstate; 1287 } 1288 }/* end if ( yy_n == 0 ) */ 1289 /* 1290 ** reduction by production yy_n 1291 ** put stack tops, etc. so things right after switch 1292 */ 1293 #if YYDEBUG 1294 /* 1295 ** if debugging, print the string that is the user's 1296 ** specification of the reduction which is just about 1297 ** to be done. 1298 */ 1299 if ( yydebug ) 1300 printf( "Reduce by (%d) \"%s\"\n", 1301 yy_n, yyreds[ yy_n ] ); 1302 #endif 1303 yytmp = yy_n; /* value to switch over */ 1304 yypvt = yy_pv; /* $vars top of value stack */ 1305 /* 1306 ** Look in goto table for next state 1307 ** Sorry about using yy_state here as temporary 1308 ** register variable, but why not, if it works... 1309 ** If yyr2[ yy_n ] doesn't have the low order bit 1310 ** set, then there is no action to be done for 1311 ** this reduction. So, no saving & unsaving of 1312 ** registers done. The only difference between the 1313 ** code just after the if and the body of the if is 1314 ** the goto yy_stack in the body. This way the test 1315 ** can be made before the choice of what to do is needed. 1316 */ 1317 { 1318 /* length of production doubled with extra bit */ 1319 register int yy_len = yyr2[ yy_n ]; 1320 1321 if ( !( yy_len & 01 ) ) 1322 { 1323 yy_len >>= 1; 1324 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 1325 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 1326 *( yy_ps -= yy_len ) + 1; 1327 if ( yy_state >= YYLAST || 1328 yychk[ yy_state = 1329 yyact[ yy_state ] ] != -yy_n ) 1330 { 1331 yy_state = yyact[ yypgo[ yy_n ] ]; 1332 } 1333 goto yy_stack; 1334 } 1335 yy_len >>= 1; 1336 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 1337 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 1338 *( yy_ps -= yy_len ) + 1; 1339 if ( yy_state >= YYLAST || 1340 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) 1341 { 1342 yy_state = yyact[ yypgo[ yy_n ] ]; 1343 } 1344 } 1345 /* save until reenter driver code */ 1346 yystate = yy_state; 1347 yyps = yy_ps; 1348 yypv = yy_pv; 1349 } 1350 /* 1351 ** code supplied by user is placed in this switch 1352 */ 1353 switch( yytmp ) 1354 { 1355 1356 case 1: 1357 # line 81 "awk.g.y" 1358 { 1359 if (errorflag==0) 1360 winner = (NODE *)stat3(PROGRAM, yypvt[-2], yypvt[-1], yypvt[-0]); } break; 1361 case 2: 1362 # line 84 "awk.g.y" 1363 { yyclearin; yyerror("bailing out"); } break; 1364 case 3: 1365 # line 89 "awk.g.y" 1366 { yyval = yypvt[-1]; } break; 1367 case 5: 1368 # line 91 "awk.g.y" 1369 { yyval = (int) 0; } break; 1370 case 6: 1371 # line 96 "awk.g.y" 1372 { yyval = yypvt[-1]; } break; 1373 case 8: 1374 # line 98 "awk.g.y" 1375 { yyval = (int) 0; } break; 1376 case 9: 1377 # line 103 "awk.g.y" 1378 { yyval = op2(BOR, yypvt[-2], yypvt[-0]); } break; 1379 case 10: 1380 # line 104 "awk.g.y" 1381 { yyval = op2(AND, yypvt[-2], yypvt[-0]); } break; 1382 case 11: 1383 # line 105 "awk.g.y" 1384 { yyval = op1(NOT, yypvt[-0]); } break; 1385 case 12: 1386 # line 106 "awk.g.y" 1387 { yyval = yypvt[-1]; } break; 1388 case 13: 1389 # line 111 "awk.g.y" 1390 { yyval = op2(BOR, yypvt[-2], yypvt[-0]); } break; 1391 case 14: 1392 # line 112 "awk.g.y" 1393 { yyval = op2(AND, yypvt[-2], yypvt[-0]); } break; 1394 case 15: 1395 # line 113 "awk.g.y" 1396 { yyval = op1(NOT, yypvt[-0]); } break; 1397 case 16: 1398 # line 114 "awk.g.y" 1399 { yyval = yypvt[-1]; } break; 1400 case 17: 1401 # line 119 "awk.g.y" 1402 { 1403 yyval = op2(NE, yypvt[-0], 1404 valtonode(lookup(L_zeronull, symtab, 0), CCON)); 1405 } break; 1406 case 22: 1407 # line 135 "awk.g.y" 1408 { yyval = valtonode(yypvt[-0], CFLD); } break; 1409 case 23: 1410 # line 136 "awk.g.y" 1411 { yyval = op1(INDIRECT, yypvt[-0]); } break; 1412 case 24: 1413 # line 141 "awk.g.y" 1414 { yyval = yypvt[-2]; } break; 1415 case 25: 1416 # line 146 "awk.g.y" 1417 { 1418 yyval = op2(yypvt[-1], yypvt[-2], makedfa(yypvt[-0])); } break; 1419 case 26: 1420 # line 148 "awk.g.y" 1421 { yyval = yypvt[-1]; } break; 1422 case 27: 1423 # line 153 "awk.g.y" 1424 { yyval = valtonode(yypvt[-0], CCON); } break; 1425 case 28: 1426 # line 154 "awk.g.y" 1427 { yyval = valtonode(yypvt[-0], CCON); } break; 1428 case 29: 1429 # line 155 "awk.g.y" 1430 { yyval = valtonode(yypvt[-0], CVAR); } break; 1431 case 30: 1432 # line 156 "awk.g.y" 1433 { yyval = op2(ARRAY, yypvt[-3], yypvt[-1]); } break; 1434 case 33: 1435 # line 161 "awk.g.y" 1436 { yyval = op1(GETLINE, 0); } break; 1437 case 34: 1438 # line 162 "awk.g.y" 1439 { 1440 yyval = op2(FNCN, yypvt[-0], 1441 valtonode(lookup(L_record, symtab, 0), CFLD)); 1442 } break; 1443 case 35: 1444 # line 166 "awk.g.y" 1445 { 1446 yyval = op2(FNCN, yypvt[-2], 1447 valtonode(lookup(L_record, symtab, 0), CFLD)); 1448 } break; 1449 case 36: 1450 # line 170 "awk.g.y" 1451 { yyval = op2(FNCN, yypvt[-3], yypvt[-1]); } break; 1452 case 37: 1453 # line 171 "awk.g.y" 1454 { yyval = op1(yypvt[-1], yypvt[-0]); } break; 1455 case 38: 1456 # line 173 "awk.g.y" 1457 { yyval = op3(SUBSTR, yypvt[-5], yypvt[-3], yypvt[-1]); } break; 1458 case 39: 1459 # line 175 "awk.g.y" 1460 { yyval = op3(SUBSTR, yypvt[-3], yypvt[-1], 0); } break; 1461 case 40: 1462 # line 177 "awk.g.y" 1463 { yyval = op3(SPLIT, yypvt[-5], yypvt[-3], yypvt[-1]); } break; 1464 case 41: 1465 # line 179 "awk.g.y" 1466 { yyval = op3(SPLIT, yypvt[-3], yypvt[-1], 0); } break; 1467 case 42: 1468 # line 181 "awk.g.y" 1469 { yyval = op2(INDEX, yypvt[-3], yypvt[-1]); } break; 1470 case 43: 1471 # line 182 "awk.g.y" 1472 {yyval = yypvt[-1]; } break; 1473 case 44: 1474 # line 183 "awk.g.y" 1475 { yyval = op2(ADD, yypvt[-2], yypvt[-0]); } break; 1476 case 45: 1477 # line 184 "awk.g.y" 1478 { yyval = op2(MINUS, yypvt[-2], yypvt[-0]); } break; 1479 case 46: 1480 # line 185 "awk.g.y" 1481 { yyval = op2(MULT, yypvt[-2], yypvt[-0]); } break; 1482 case 47: 1483 # line 186 "awk.g.y" 1484 { yyval = op2(DIVIDE, yypvt[-2], yypvt[-0]); } break; 1485 case 48: 1486 # line 187 "awk.g.y" 1487 { yyval = op2(MOD, yypvt[-2], yypvt[-0]); } break; 1488 case 49: 1489 # line 188 "awk.g.y" 1490 { yyval = op1(UMINUS, yypvt[-0]); } break; 1491 case 50: 1492 # line 189 "awk.g.y" 1493 { yyval = yypvt[-0]; } break; 1494 case 51: 1495 # line 190 "awk.g.y" 1496 { yyval = op1(PREINCR, yypvt[-0]); } break; 1497 case 52: 1498 # line 191 "awk.g.y" 1499 { yyval = op1(PREDECR, yypvt[-0]); } break; 1500 case 53: 1501 # line 192 "awk.g.y" 1502 { yyval= op1(POSTINCR, yypvt[-1]); } break; 1503 case 54: 1504 # line 193 "awk.g.y" 1505 { yyval= op1(POSTDECR, yypvt[-1]); } break; 1506 case 56: 1507 # line 199 "awk.g.y" 1508 { yyval = op2(CAT, yypvt[-1], yypvt[-0]); } break; 1509 case 57: 1510 # line 200 "awk.g.y" 1511 { yyval = op2(yypvt[-1], yypvt[-2], yypvt[-0]); } break; 1512 case 60: 1513 # line 211 "awk.g.y" 1514 { yyval = stat2(PASTAT, yypvt[-0], genprint()); } break; 1515 case 61: 1516 # line 212 "awk.g.y" 1517 { yyval = stat2(PASTAT, yypvt[-3], yypvt[-1]); } break; 1518 case 62: 1519 # line 213 "awk.g.y" 1520 { yyval = pa2stat(yypvt[-2], yypvt[-0], genprint()); } break; 1521 case 63: 1522 # line 215 "awk.g.y" 1523 { yyval = pa2stat(yypvt[-5], yypvt[-3], yypvt[-1]); } break; 1524 case 64: 1525 # line 216 "awk.g.y" 1526 { yyval = stat2(PASTAT, 0, yypvt[-1]); } break; 1527 case 65: 1528 # line 221 "awk.g.y" 1529 { yyval = linkum(yypvt[-2], yypvt[-1]); } break; 1530 case 66: 1531 # line 222 "awk.g.y" 1532 { yyval = (int)0; } break; 1533 case 67: 1534 # line 223 "awk.g.y" 1535 { yyval = linkum(yypvt[-1], yypvt[-0]); } break; 1536 case 68: 1537 # line 228 "awk.g.y" 1538 { 1539 yyval = op2(MATCH, 1540 valtonode(lookup(L_record, symtab, 0), CFLD), makedfa(yypvt[-0])); 1541 } break; 1542 case 74: 1543 # line 241 "awk.g.y" 1544 { 1545 yyval = valtonode(lookup(L_record, symtab, 0), CFLD); 1546 } break; 1547 case 75: 1548 # line 248 "awk.g.y" 1549 {yyval = linkum(yypvt[-2], yypvt[-0]); } break; 1550 case 76: 1551 # line 249 "awk.g.y" 1552 {yyval = linkum(yypvt[-2], yypvt[-0]); } break; 1553 case 77: 1554 # line 250 "awk.g.y" 1555 {yyval = yypvt[-1]; } break; 1556 case 80: 1557 # line 261 "awk.g.y" 1558 { startreg(); } break; 1559 case 81: 1560 # line 263 "awk.g.y" 1561 { yyval = yypvt[-1]; } break; 1562 case 82: 1563 # line 268 "awk.g.y" 1564 { yyval = op2(CHAR, (NODE *) 0, yypvt[-0]); } break; 1565 case 83: 1566 # line 269 "awk.g.y" 1567 { yyval = op2(DOT, (NODE *) 0, (NODE *) 0); } break; 1568 case 84: 1569 # line 270 "awk.g.y" 1570 { yyval = op2(CCL, (NODE *) 0, cclenter(yypvt[-0])); } break; 1571 case 85: 1572 # line 271 "awk.g.y" 1573 { yyval = op2(NCCL, (NODE *) 0, cclenter(yypvt[-0])); } break; 1574 case 86: 1575 # line 272 "awk.g.y" 1576 { yyval = op2(CHAR, (NODE *) 0, HAT); } break; 1577 case 87: 1578 # line 273 "awk.g.y" 1579 { yyval = op2(CHAR, (NODE *) 0, (NODE *) 0); } break; 1580 case 88: 1581 # line 274 "awk.g.y" 1582 { yyval = op2(OR, yypvt[-2], yypvt[-0]); } break; 1583 case 89: 1584 # line 276 "awk.g.y" 1585 { yyval = op2(CAT, yypvt[-1], yypvt[-0]); } break; 1586 case 90: 1587 # line 277 "awk.g.y" 1588 { yyval = op2(STAR, yypvt[-1], (NODE *) 0); } break; 1589 case 91: 1590 # line 278 "awk.g.y" 1591 { yyval = op2(PLUS, yypvt[-1], (NODE *) 0); } break; 1592 case 92: 1593 # line 279 "awk.g.y" 1594 { yyval = op2(QUEST, yypvt[-1], (NODE *) 0); } break; 1595 case 93: 1596 # line 280 "awk.g.y" 1597 { yyval = yypvt[-1]; } break; 1598 case 94: 1599 # line 286 "awk.g.y" 1600 { yyval = op2(yypvt[-1], yypvt[-2], yypvt[-0]); } break; 1601 case 95: 1602 # line 288 "awk.g.y" 1603 { yyval = yypvt[-1]; } break; 1604 case 98: 1605 # line 300 "awk.g.y" 1606 { yyval = stat3(yypvt[-3], yypvt[-2], yypvt[-1], yypvt[-0]); } break; 1607 case 99: 1608 # line 302 "awk.g.y" 1609 { yyval = stat3(yypvt[-1], yypvt[-0], 0, 0); } break; 1610 case 100: 1611 # line 304 "awk.g.y" 1612 { yyval = stat3(yypvt[-3], yypvt[-2], yypvt[-1], yypvt[-0]); } break; 1613 case 101: 1614 # line 306 "awk.g.y" 1615 { yyval = stat3(yypvt[-1], yypvt[-0], 0, 0); } break; 1616 case 102: 1617 # line 307 "awk.g.y" 1618 { yyval = exptostat(yypvt[-0]); } break; 1619 case 103: 1620 # line 308 "awk.g.y" 1621 { yyval = (int)0; } break; 1622 case 104: 1623 # line 309 "awk.g.y" 1624 { yyclearin; yyerror("illegal statement"); yyval = (int)0; } break; 1625 case 106: 1626 # line 315 "awk.g.y" 1627 { yyval = stat3(IF, yypvt[-1], yypvt[-0], 0); } break; 1628 case 107: 1629 # line 317 "awk.g.y" 1630 { yyval = stat3(IF, yypvt[-3], yypvt[-2], yypvt[-0]); } break; 1631 case 108: 1632 # line 318 "awk.g.y" 1633 { yyval = stat2(WHILE, yypvt[-1], yypvt[-0]); } break; 1634 case 110: 1635 # line 320 "awk.g.y" 1636 { yyval = stat1(NEXT, 0); } break; 1637 case 111: 1638 # line 321 "awk.g.y" 1639 { yyval = stat1(EXIT, 0); } break; 1640 case 112: 1641 # line 322 "awk.g.y" 1642 { yyval = stat1(EXIT, yypvt[-1]); } break; 1643 case 113: 1644 # line 323 "awk.g.y" 1645 { yyval = stat1(BREAK, 0); } break; 1646 case 114: 1647 # line 324 "awk.g.y" 1648 { yyval = stat1(CONTINUE, 0); } break; 1649 case 115: 1650 # line 325 "awk.g.y" 1651 { yyval = yypvt[-1]; } break; 1652 case 116: 1653 # line 330 "awk.g.y" 1654 { yyval = linkum(yypvt[-1], yypvt[-0]); } break; 1655 case 117: 1656 # line 331 "awk.g.y" 1657 { yyval = (int)0; } break; 1658 case 118: 1659 # line 336 "awk.g.y" 1660 { yyval = yypvt[-2]; } break; 1661 case 119: 1662 # line 342 "awk.g.y" 1663 { yyval = stat4(FOR, yypvt[-7], yypvt[-5], yypvt[-3], yypvt[-0]); } break; 1664 case 120: 1665 # line 344 "awk.g.y" 1666 { yyval = stat4(FOR, yypvt[-6], 0, yypvt[-3], yypvt[-0]); } break; 1667 case 121: 1668 # line 346 "awk.g.y" 1669 { yyval = stat3(IN, yypvt[-5], yypvt[-3], yypvt[-0]); } break; 1670 # line 556 "/usr/share/lib/ccs/yaccpar" 1671 } 1672 goto yystack; /* reset registers in driver code */ 1673 } 1674 1675