1 #ifndef lint 2 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; 3 #endif 4 #define YYBYACC 1 5 #define YYMAJOR 1 6 #define YYMINOR 9 7 #define yyclearin (yychar=(-1)) 8 #define yyerrok (yyerrflag=0) 9 #define YYRECOVERING (yyerrflag!=0) 10 #define YYPREFIX "yy" 11 #line 10 "./parse.y" 12 /*- 13 * Copyright (c) 1990 The Regents of the University of California. 14 * All rights reserved. 15 * 16 * This code is derived from software contributed to Berkeley by 17 * Vern Paxson. 18 * 19 * The United States Government has rights in this work pursuant 20 * to contract no. DE-AC03-76SF00098 between the United States 21 * Department of Energy and the University of California. 22 * 23 * Redistribution and use in source and binary forms with or without 24 * modification are permitted provided that: (1) source distributions retain 25 * this entire copyright notice and comment, and (2) distributions including 26 * binaries display the following acknowledgement: ``This product includes 27 * software developed by the University of California, Berkeley and its 28 * contributors'' in the documentation or other materials provided with the 29 * distribution and in all advertising materials mentioning features or use 30 * of this software. Neither the name of the University nor the names of 31 * its contributors may be used to endorse or promote products derived from 32 * this software without specific prior written permission. 33 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 34 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 35 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 36 */ 37 38 /* $Header: /home/daffy/u0/vern/flex/RCS/parse.y,v 2.28 95/04/21 11:51:51 vern Exp $ */ 39 40 41 /* Some versions of bison are broken in that they use alloca() but don't 42 * declare it properly. The following is the patented (just kidding!) 43 * #ifdef chud to fix the problem, courtesy of Francois Pinard. 44 */ 45 #ifdef YYBISON 46 /* AIX requires this to be the first thing in the file. What a piece. */ 47 # ifdef _AIX 48 #pragma alloca 49 # endif 50 #endif 51 52 #include "flexdef.h" 53 54 /* The remainder of the alloca() cruft has to come after including flexdef.h, 55 * so HAVE_ALLOCA_H is (possibly) defined. 56 */ 57 #ifdef YYBISON 58 # ifdef __GNUC__ 59 # ifndef alloca 60 # define alloca __builtin_alloca 61 # endif 62 # else 63 # if HAVE_ALLOCA_H 64 # include <alloca.h> 65 # else 66 # ifdef __hpux 67 void *alloca (); 68 # else 69 # ifdef __TURBOC__ 70 # include <malloc.h> 71 # else 72 char *alloca (); 73 # endif 74 # endif 75 # endif 76 # endif 77 #endif 78 79 /* Bletch, ^^^^ that was ugly! */ 80 81 82 int pat, scnum, eps, headcnt, trailcnt, anyccl, lastchar, i, rulelen; 83 int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule; 84 85 int *scon_stk; 86 int scon_stk_ptr; 87 88 static int madeany = false; /* whether we've made the '.' character class */ 89 int previous_continued_action; /* whether the previous rule's action was '|' */ 90 91 /* Expand a POSIX character class expression. */ 92 #define CCL_EXPR(func) \ 93 { \ 94 int c; \ 95 for ( c = 0; c < csize; ++c ) \ 96 if ( isascii(c) && func(c) ) \ 97 ccladd( currccl, c ); \ 98 } 99 100 /* While POSIX defines isblank(), it's not ANSI C. */ 101 #define IS_BLANK(c) ((c) == ' ' || (c) == '\t') 102 103 /* On some over-ambitious machines, such as DEC Alpha's, the default 104 * token type is "long" instead of "int"; this leads to problems with 105 * declaring yylval in flexdef.h. But so far, all the yacc's I've seen 106 * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the 107 * following should ensure that the default token type is "int". 108 */ 109 #define YYSTYPE int 110 111 #line 112 "y.tab.c" 112 #define CHAR 257 113 #define NUMBER 258 114 #define SECTEND 259 115 #define SCDECL 260 116 #define XSCDECL 261 117 #define NAME 262 118 #define PREVCCL 263 119 #define EOF_OP 264 120 #define OPTION_OP 265 121 #define OPT_OUTFILE 266 122 #define OPT_PREFIX 267 123 #define OPT_YYCLASS 268 124 #define CCE_ALNUM 269 125 #define CCE_ALPHA 270 126 #define CCE_BLANK 271 127 #define CCE_CNTRL 272 128 #define CCE_DIGIT 273 129 #define CCE_GRAPH 274 130 #define CCE_LOWER 275 131 #define CCE_PRINT 276 132 #define CCE_PUNCT 277 133 #define CCE_SPACE 278 134 #define CCE_UPPER 279 135 #define CCE_XDIGIT 280 136 #define YYERRCODE 256 137 short yylhs[] = { -1, 138 0, 1, 2, 2, 2, 2, 3, 6, 6, 7, 139 7, 7, 8, 9, 9, 10, 10, 10, 4, 4, 140 4, 5, 12, 12, 12, 12, 14, 11, 11, 11, 141 15, 15, 15, 16, 13, 13, 13, 13, 18, 18, 142 17, 19, 19, 20, 20, 20, 20, 20, 20, 20, 143 20, 20, 20, 20, 20, 21, 21, 23, 23, 23, 144 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 145 24, 24, 24, 22, 22, 146 }; 147 short yylen[] = { 2, 148 5, 0, 3, 2, 0, 1, 1, 1, 1, 2, 149 1, 1, 2, 2, 0, 3, 3, 3, 5, 5, 150 0, 0, 2, 1, 1, 1, 0, 4, 3, 0, 151 3, 1, 1, 1, 2, 3, 2, 1, 3, 1, 152 2, 2, 1, 2, 2, 2, 6, 5, 4, 1, 153 1, 1, 3, 3, 1, 3, 4, 4, 2, 2, 154 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 155 1, 1, 1, 2, 0, 156 }; 157 short yydefred[] = { 2, 158 0, 0, 6, 0, 7, 8, 9, 15, 21, 0, 159 4, 0, 0, 12, 11, 0, 0, 0, 0, 14, 160 0, 1, 0, 10, 0, 0, 0, 0, 0, 21, 161 0, 16, 17, 18, 29, 33, 34, 0, 32, 0, 162 26, 55, 52, 25, 0, 50, 75, 0, 0, 0, 163 24, 0, 0, 0, 0, 51, 28, 0, 20, 23, 164 0, 0, 61, 0, 19, 0, 37, 0, 41, 0, 165 0, 44, 45, 46, 31, 74, 53, 54, 0, 0, 166 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 167 72, 73, 56, 60, 36, 0, 0, 57, 0, 49, 168 0, 58, 0, 48, 47, 169 }; 170 short yydgoto[] = { 1, 171 2, 4, 9, 13, 22, 10, 16, 11, 12, 20, 172 23, 50, 51, 29, 38, 39, 52, 53, 54, 55, 173 56, 61, 64, 94, 174 }; 175 short yysindex[] = { 0, 176 0, -235, 0, -191, 0, 0, 0, 0, 0, -207, 177 0, -215, -18, 0, 0, -202, 4, 26, 32, 0, 178 41, 0, -35, 0, -168, -166, -165, 38, -180, 0, 179 -30, 0, 0, 0, 0, 0, 0, -16, 0, -40, 180 0, 0, 0, 0, -2, 0, 0, -2, 8, 93, 181 0, -2, -25, -2, 15, 0, 0, -153, 0, 0, 182 -27, -26, 0, -88, 0, -23, 0, -2, 0, 15, 183 -150, 0, 0, 0, 0, 0, 0, 0, -3, 65, 184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 185 0, 0, 0, 0, 0, -2, -21, 0, -145, 0, 186 -116, 0, -12, 0, 0, 187 }; 188 short yyrindex[] = { 0, 189 0, -188, 0, 0, 0, 0, 0, 0, 0, 0, 190 0, -154, 1, 0, 0, -140, 0, 0, 0, 0, 191 -176, 0, -28, 0, 0, 0, 0, 0, 0, 0, 192 0, 0, 0, 0, 0, 0, 0, 0, 0, -32, 193 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 194 0, 0, 106, 7, -10, 0, 0, 0, 0, 0, 195 0, 0, 0, 0, 0, 108, 0, 0, 0, -7, 196 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 198 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 199 0, 0, 0, 0, 0, 200 }; 201 short yygindex[] = { 0, 202 0, 0, 0, 92, 100, 0, 0, 0, 0, 0, 203 0, 0, 81, 0, 0, 69, 0, 27, 60, -29, 204 0, 0, 66, 0, 205 }; 206 #define YYTABLESIZE 326 207 short yytable[] = { 43, 208 22, 30, 42, 47, 93, 22, 77, 30, 104, 48, 209 67, 22, 95, 30, 78, 46, 40, 22, 39, 21, 210 3, 69, 101, 43, 70, 43, 42, 58, 42, 43, 211 43, 47, 42, 42, 30, 43, 43, 48, 42, 42, 212 30, 21, 40, 46, 39, 57, 30, 40, 14, 39, 213 17, 18, 19, 40, 15, 39, 72, 73, 30, 24, 214 49, 30, 22, 45, 25, 22, 70, 5, 6, 7, 215 5, 5, 5, 8, 62, 36, 5, 74, 66, 27, 216 43, 37, 28, 42, 59, 27, 26, 30, 49, 98, 217 30, 30, 27, 32, 30, 33, 34, 68, 68, 35, 218 68, 63, 65, 100, 13, 13, 13, 97, 37, 99, 219 13, 102, 105, 43, 61, 38, 42, 35, 3, 3, 220 3, 40, 31, 30, 3, 60, 75, 96, 79, 0, 221 40, 0, 39, 0, 0, 0, 0, 71, 59, 0, 222 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 227 91, 92, 0, 0, 0, 0, 0, 0, 0, 0, 228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 229 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 230 0, 0, 0, 30, 30, 41, 42, 22, 22, 76, 231 30, 30, 43, 44, 22, 22, 0, 0, 0, 0, 232 0, 0, 0, 0, 0, 0, 43, 0, 0, 42, 233 0, 0, 43, 80, 42, 42, 30, 30, 0, 0, 234 43, 0, 0, 30, 30, 81, 82, 83, 84, 85, 235 86, 87, 88, 89, 90, 91, 92, 0, 61, 0, 236 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 237 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 238 61, 61, 59, 0, 0, 0, 0, 0, 0, 0, 239 0, 0, 0, 0, 59, 59, 59, 59, 59, 59, 240 59, 59, 59, 59, 59, 59, 241 }; 242 short yycheck[] = { 10, 243 0, 34, 10, 34, 93, 34, 34, 40, 125, 40, 244 36, 40, 36, 46, 41, 46, 10, 46, 10, 60, 245 256, 47, 44, 34, 54, 36, 34, 44, 36, 40, 246 41, 34, 40, 41, 34, 46, 47, 40, 46, 47, 247 40, 60, 36, 46, 36, 62, 46, 41, 256, 41, 248 266, 267, 268, 47, 262, 47, 42, 43, 91, 262, 249 91, 94, 91, 94, 61, 94, 96, 259, 260, 261, 250 259, 260, 261, 265, 48, 256, 265, 63, 52, 256, 251 91, 262, 42, 91, 125, 262, 61, 123, 91, 93, 252 123, 91, 61, 262, 94, 262, 262, 124, 124, 62, 253 124, 94, 10, 125, 259, 260, 261, 258, 262, 45, 254 265, 257, 125, 124, 93, 10, 124, 10, 259, 260, 255 261, 30, 23, 123, 265, 45, 58, 68, 63, -1, 256 124, -1, 124, -1, -1, -1, -1, 123, 93, -1, 257 -1, 258, -1, -1, -1, -1, -1, -1, -1, -1, 258 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 259 -1, -1, -1, -1, -1, -1, -1, -1, 257, -1, 260 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 261 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 262 279, 280, -1, -1, -1, -1, -1, -1, -1, -1, 263 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 264 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 265 -1, -1, -1, 256, 257, 256, 257, 256, 257, 257, 266 263, 264, 263, 264, 263, 264, -1, -1, -1, -1, 267 -1, -1, -1, -1, -1, -1, 257, -1, -1, 257, 268 -1, -1, 263, 257, 257, 263, 256, 257, -1, -1, 269 263, -1, -1, 263, 264, 269, 270, 271, 272, 273, 270 274, 275, 276, 277, 278, 279, 280, -1, 257, -1, 271 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 273 279, 280, 257, -1, -1, -1, -1, -1, -1, -1, 274 -1, -1, -1, -1, 269, 270, 271, 272, 273, 274, 275 275, 276, 277, 278, 279, 280, 276 }; 277 #define YYFINAL 1 278 #ifndef YYDEBUG 279 #define YYDEBUG 0 280 #endif 281 #define YYMAXTOKEN 280 282 #if YYDEBUG 283 char *yyname[] = { 284 "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 285 0,0,0,"'\"'",0,"'$'",0,0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0, 286 0,0,0,0,0,0,0,0,0,0,"'<'","'='","'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 287 0,0,0,0,0,0,0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 288 0,0,0,0,0,0,0,"'{'","'|'","'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 289 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 290 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 291 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"CHAR","NUMBER","SECTEND", 292 "SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","OPTION_OP","OPT_OUTFILE", 293 "OPT_PREFIX","OPT_YYCLASS","CCE_ALNUM","CCE_ALPHA","CCE_BLANK","CCE_CNTRL", 294 "CCE_DIGIT","CCE_GRAPH","CCE_LOWER","CCE_PRINT","CCE_PUNCT","CCE_SPACE", 295 "CCE_UPPER","CCE_XDIGIT", 296 }; 297 char *yyrule[] = { 298 "$accept : goal", 299 "goal : initlex sect1 sect1end sect2 initforrule", 300 "initlex :", 301 "sect1 : sect1 startconddecl namelist1", 302 "sect1 : sect1 options", 303 "sect1 :", 304 "sect1 : error", 305 "sect1end : SECTEND", 306 "startconddecl : SCDECL", 307 "startconddecl : XSCDECL", 308 "namelist1 : namelist1 NAME", 309 "namelist1 : NAME", 310 "namelist1 : error", 311 "options : OPTION_OP optionlist", 312 "optionlist : optionlist option", 313 "optionlist :", 314 "option : OPT_OUTFILE '=' NAME", 315 "option : OPT_PREFIX '=' NAME", 316 "option : OPT_YYCLASS '=' NAME", 317 "sect2 : sect2 scon initforrule flexrule '\\n'", 318 "sect2 : sect2 scon '{' sect2 '}'", 319 "sect2 :", 320 "initforrule :", 321 "flexrule : '^' rule", 322 "flexrule : rule", 323 "flexrule : EOF_OP", 324 "flexrule : error", 325 "scon_stk_ptr :", 326 "scon : '<' scon_stk_ptr namelist2 '>'", 327 "scon : '<' '*' '>'", 328 "scon :", 329 "namelist2 : namelist2 ',' sconname", 330 "namelist2 : sconname", 331 "namelist2 : error", 332 "sconname : NAME", 333 "rule : re2 re", 334 "rule : re2 re '$'", 335 "rule : re '$'", 336 "rule : re", 337 "re : re '|' series", 338 "re : series", 339 "re2 : re '/'", 340 "series : series singleton", 341 "series : singleton", 342 "singleton : singleton '*'", 343 "singleton : singleton '+'", 344 "singleton : singleton '?'", 345 "singleton : singleton '{' NUMBER ',' NUMBER '}'", 346 "singleton : singleton '{' NUMBER ',' '}'", 347 "singleton : singleton '{' NUMBER '}'", 348 "singleton : '.'", 349 "singleton : fullccl", 350 "singleton : PREVCCL", 351 "singleton : '\"' string '\"'", 352 "singleton : '(' re ')'", 353 "singleton : CHAR", 354 "fullccl : '[' ccl ']'", 355 "fullccl : '[' '^' ccl ']'", 356 "ccl : ccl CHAR '-' CHAR", 357 "ccl : ccl CHAR", 358 "ccl : ccl ccl_expr", 359 "ccl :", 360 "ccl_expr : CCE_ALNUM", 361 "ccl_expr : CCE_ALPHA", 362 "ccl_expr : CCE_BLANK", 363 "ccl_expr : CCE_CNTRL", 364 "ccl_expr : CCE_DIGIT", 365 "ccl_expr : CCE_GRAPH", 366 "ccl_expr : CCE_LOWER", 367 "ccl_expr : CCE_PRINT", 368 "ccl_expr : CCE_PUNCT", 369 "ccl_expr : CCE_SPACE", 370 "ccl_expr : CCE_UPPER", 371 "ccl_expr : CCE_XDIGIT", 372 "string : string CHAR", 373 "string :", 374 }; 375 #endif 376 #ifndef YYSTYPE 377 typedef int YYSTYPE; 378 #endif 379 #ifdef YYSTACKSIZE 380 #undef YYMAXDEPTH 381 #define YYMAXDEPTH YYSTACKSIZE 382 #else 383 #ifdef YYMAXDEPTH 384 #define YYSTACKSIZE YYMAXDEPTH 385 #else 386 #define YYSTACKSIZE 500 387 #define YYMAXDEPTH 500 388 #endif 389 #endif 390 int yydebug; 391 int yynerrs; 392 int yyerrflag; 393 int yychar; 394 short *yyssp; 395 YYSTYPE *yyvsp; 396 YYSTYPE yyval; 397 YYSTYPE yylval; 398 short yyss[YYSTACKSIZE]; 399 YYSTYPE yyvs[YYSTACKSIZE]; 400 #define yystacksize YYSTACKSIZE 401 #line 776 "./parse.y" 402 403 404 /* build_eof_action - build the "<<EOF>>" action for the active start 405 * conditions 406 */ 407 408 void build_eof_action() 409 { 410 register int i; 411 char action_text[MAXLINE]; 412 413 for ( i = 1; i <= scon_stk_ptr; ++i ) 414 { 415 if ( sceof[scon_stk[i]] ) 416 format_pinpoint_message( 417 "multiple <<EOF>> rules for start condition %s", 418 scname[scon_stk[i]] ); 419 420 else 421 { 422 sceof[scon_stk[i]] = true; 423 sprintf( action_text, "case YY_STATE_EOF(%s):\n", 424 scname[scon_stk[i]] ); 425 add_action( action_text ); 426 } 427 } 428 429 line_directive_out( (FILE *) 0, 1 ); 430 431 /* This isn't a normal rule after all - don't count it as 432 * such, so we don't have any holes in the rule numbering 433 * (which make generating "rule can never match" warnings 434 * more difficult. 435 */ 436 --num_rules; 437 ++num_eof_rules; 438 } 439 440 441 /* format_synerr - write out formatted syntax error */ 442 443 void format_synerr( msg, arg ) 444 char msg[], arg[]; 445 { 446 char errmsg[MAXLINE]; 447 448 (void) sprintf( errmsg, msg, arg ); 449 synerr( errmsg ); 450 } 451 452 453 /* synerr - report a syntax error */ 454 455 void synerr( str ) 456 char str[]; 457 { 458 syntaxerror = true; 459 pinpoint_message( str ); 460 } 461 462 463 /* format_warn - write out formatted warning */ 464 465 void format_warn( msg, arg ) 466 char msg[], arg[]; 467 { 468 char warn_msg[MAXLINE]; 469 470 (void) sprintf( warn_msg, msg, arg ); 471 warn( warn_msg ); 472 } 473 474 475 /* warn - report a warning, unless -w was given */ 476 477 void warn( str ) 478 char str[]; 479 { 480 line_warning( str, linenum ); 481 } 482 483 /* format_pinpoint_message - write out a message formatted with one string, 484 * pinpointing its location 485 */ 486 487 void format_pinpoint_message( msg, arg ) 488 char msg[], arg[]; 489 { 490 char errmsg[MAXLINE]; 491 492 (void) sprintf( errmsg, msg, arg ); 493 pinpoint_message( errmsg ); 494 } 495 496 497 /* pinpoint_message - write out a message, pinpointing its location */ 498 499 void pinpoint_message( str ) 500 char str[]; 501 { 502 line_pinpoint( str, linenum ); 503 } 504 505 506 /* line_warning - report a warning at a given line, unless -w was given */ 507 508 void line_warning( str, line ) 509 char str[]; 510 int line; 511 { 512 char warning[MAXLINE]; 513 514 if ( ! nowarn ) 515 { 516 sprintf( warning, "warning, %s", str ); 517 line_pinpoint( warning, line ); 518 } 519 } 520 521 522 /* line_pinpoint - write out a message, pinpointing it at the given line */ 523 524 void line_pinpoint( str, line ) 525 char str[]; 526 int line; 527 { 528 fprintf( stderr, "\"%s\", line %d: %s\n", infilename, line, str ); 529 } 530 531 532 /* yyerror - eat up an error message from the parser; 533 * currently, messages are ignore 534 */ 535 536 void yyerror( msg ) 537 char msg[]; 538 { 539 } 540 #line 541 "y.tab.c" 541 #define YYABORT goto yyabort 542 #define YYREJECT goto yyabort 543 #define YYACCEPT goto yyaccept 544 #define YYERROR goto yyerrlab 545 int 546 yyparse() 547 { 548 register int yym, yyn, yystate; 549 #if YYDEBUG 550 register char *yys; 551 extern char *getenv(); 552 553 if (yys = getenv("YYDEBUG")) 554 { 555 yyn = *yys; 556 if (yyn >= '0' && yyn <= '9') 557 yydebug = yyn - '0'; 558 } 559 #endif 560 561 yynerrs = 0; 562 yyerrflag = 0; 563 yychar = (-1); 564 565 yyssp = yyss; 566 yyvsp = yyvs; 567 *yyssp = yystate = 0; 568 569 yyloop: 570 if (yyn = yydefred[yystate]) goto yyreduce; 571 if (yychar < 0) 572 { 573 if ((yychar = yylex()) < 0) yychar = 0; 574 #if YYDEBUG 575 if (yydebug) 576 { 577 yys = 0; 578 if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; 579 if (!yys) yys = "illegal-symbol"; 580 printf("%sdebug: state %d, reading %d (%s)\n", 581 YYPREFIX, yystate, yychar, yys); 582 } 583 #endif 584 } 585 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && 586 yyn <= YYTABLESIZE && yycheck[yyn] == yychar) 587 { 588 #if YYDEBUG 589 if (yydebug) 590 printf("%sdebug: state %d, shifting to state %d\n", 591 YYPREFIX, yystate, yytable[yyn]); 592 #endif 593 if (yyssp >= yyss + yystacksize - 1) 594 { 595 goto yyoverflow; 596 } 597 *++yyssp = yystate = yytable[yyn]; 598 *++yyvsp = yylval; 599 yychar = (-1); 600 if (yyerrflag > 0) --yyerrflag; 601 goto yyloop; 602 } 603 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && 604 yyn <= YYTABLESIZE && yycheck[yyn] == yychar) 605 { 606 yyn = yytable[yyn]; 607 goto yyreduce; 608 } 609 if (yyerrflag) goto yyinrecovery; 610 #ifdef lint 611 goto yynewerror; 612 #endif 613 yynewerror: 614 yyerror("syntax error"); 615 #ifdef lint 616 goto yyerrlab; 617 #endif 618 yyerrlab: 619 ++yynerrs; 620 yyinrecovery: 621 if (yyerrflag < 3) 622 { 623 yyerrflag = 3; 624 for (;;) 625 { 626 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && 627 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) 628 { 629 #if YYDEBUG 630 if (yydebug) 631 printf("%sdebug: state %d, error recovery shifting\ 632 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); 633 #endif 634 if (yyssp >= yyss + yystacksize - 1) 635 { 636 goto yyoverflow; 637 } 638 *++yyssp = yystate = yytable[yyn]; 639 *++yyvsp = yylval; 640 goto yyloop; 641 } 642 else 643 { 644 #if YYDEBUG 645 if (yydebug) 646 printf("%sdebug: error recovery discarding state %d\n", 647 YYPREFIX, *yyssp); 648 #endif 649 if (yyssp <= yyss) goto yyabort; 650 --yyssp; 651 --yyvsp; 652 } 653 } 654 } 655 else 656 { 657 if (yychar == 0) goto yyabort; 658 #if YYDEBUG 659 if (yydebug) 660 { 661 yys = 0; 662 if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; 663 if (!yys) yys = "illegal-symbol"; 664 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 665 YYPREFIX, yystate, yychar, yys); 666 } 667 #endif 668 yychar = (-1); 669 goto yyloop; 670 } 671 yyreduce: 672 #if YYDEBUG 673 if (yydebug) 674 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 675 YYPREFIX, yystate, yyn, yyrule[yyn]); 676 #endif 677 yym = yylen[yyn]; 678 yyval = yyvsp[1-yym]; 679 switch (yyn) 680 { 681 case 1: 682 #line 113 "./parse.y" 683 { /* add default rule */ 684 int def_rule; 685 686 pat = cclinit(); 687 cclnegate( pat ); 688 689 def_rule = mkstate( -pat ); 690 691 /* Remember the number of the default rule so we 692 * don't generate "can't match" warnings for it. 693 */ 694 default_rule = num_rules; 695 696 finish_rule( def_rule, false, 0, 0 ); 697 698 for ( i = 1; i <= lastsc; ++i ) 699 scset[i] = mkbranch( scset[i], def_rule ); 700 701 if ( spprdflt ) 702 add_action( 703 "YY_FATAL_ERROR( \"flex scanner jammed\" )" ); 704 else 705 add_action( "ECHO" ); 706 707 add_action( ";\n\tYY_BREAK\n" ); 708 } 709 break; 710 case 2: 711 #line 142 "./parse.y" 712 { /* initialize for processing rules */ 713 714 /* Create default DFA start condition. */ 715 scinstal( "INITIAL", false ); 716 } 717 break; 718 case 6: 719 #line 153 "./parse.y" 720 { synerr( "unknown error processing section 1" ); } 721 break; 722 case 7: 723 #line 157 "./parse.y" 724 { 725 check_options(); 726 scon_stk = allocate_integer_array( lastsc + 1 ); 727 scon_stk_ptr = 0; 728 } 729 break; 730 case 8: 731 #line 165 "./parse.y" 732 { xcluflg = false; } 733 break; 734 case 9: 735 #line 168 "./parse.y" 736 { xcluflg = true; } 737 break; 738 case 10: 739 #line 172 "./parse.y" 740 { scinstal( nmstr, xcluflg ); } 741 break; 742 case 11: 743 #line 175 "./parse.y" 744 { scinstal( nmstr, xcluflg ); } 745 break; 746 case 12: 747 #line 178 "./parse.y" 748 { synerr( "bad start condition list" ); } 749 break; 750 case 16: 751 #line 189 "./parse.y" 752 { 753 outfilename = copy_string( nmstr ); 754 did_outfilename = 1; 755 } 756 break; 757 case 17: 758 #line 194 "./parse.y" 759 { prefix = copy_string( nmstr ); } 760 break; 761 case 18: 762 #line 196 "./parse.y" 763 { yyclass = copy_string( nmstr ); } 764 break; 765 case 19: 766 #line 200 "./parse.y" 767 { scon_stk_ptr = yyvsp[-3]; } 768 break; 769 case 20: 770 #line 202 "./parse.y" 771 { scon_stk_ptr = yyvsp[-3]; } 772 break; 773 case 22: 774 #line 207 "./parse.y" 775 { 776 /* Initialize for a parse of one rule. */ 777 trlcontxt = variable_trail_rule = varlength = false; 778 trailcnt = headcnt = rulelen = 0; 779 current_state_type = STATE_NORMAL; 780 previous_continued_action = continued_action; 781 in_rule = true; 782 783 new_rule(); 784 } 785 break; 786 case 23: 787 #line 220 "./parse.y" 788 { 789 pat = yyvsp[0]; 790 finish_rule( pat, variable_trail_rule, 791 headcnt, trailcnt ); 792 793 if ( scon_stk_ptr > 0 ) 794 { 795 for ( i = 1; i <= scon_stk_ptr; ++i ) 796 scbol[scon_stk[i]] = 797 mkbranch( scbol[scon_stk[i]], 798 pat ); 799 } 800 801 else 802 { 803 /* Add to all non-exclusive start conditions, 804 * including the default (0) start condition. 805 */ 806 807 for ( i = 1; i <= lastsc; ++i ) 808 if ( ! scxclu[i] ) 809 scbol[i] = mkbranch( scbol[i], 810 pat ); 811 } 812 813 if ( ! bol_needed ) 814 { 815 bol_needed = true; 816 817 if ( performance_report > 1 ) 818 pinpoint_message( 819 "'^' operator results in sub-optimal performance" ); 820 } 821 } 822 break; 823 case 24: 824 #line 256 "./parse.y" 825 { 826 pat = yyvsp[0]; 827 finish_rule( pat, variable_trail_rule, 828 headcnt, trailcnt ); 829 830 if ( scon_stk_ptr > 0 ) 831 { 832 for ( i = 1; i <= scon_stk_ptr; ++i ) 833 scset[scon_stk[i]] = 834 mkbranch( scset[scon_stk[i]], 835 pat ); 836 } 837 838 else 839 { 840 for ( i = 1; i <= lastsc; ++i ) 841 if ( ! scxclu[i] ) 842 scset[i] = 843 mkbranch( scset[i], 844 pat ); 845 } 846 } 847 break; 848 case 25: 849 #line 280 "./parse.y" 850 { 851 if ( scon_stk_ptr > 0 ) 852 build_eof_action(); 853 854 else 855 { 856 /* This EOF applies to all start conditions 857 * which don't already have EOF actions. 858 */ 859 for ( i = 1; i <= lastsc; ++i ) 860 if ( ! sceof[i] ) 861 scon_stk[++scon_stk_ptr] = i; 862 863 if ( scon_stk_ptr == 0 ) 864 warn( 865 "all start conditions already have <<EOF>> rules" ); 866 867 else 868 build_eof_action(); 869 } 870 } 871 break; 872 case 26: 873 #line 303 "./parse.y" 874 { synerr( "unrecognized rule" ); } 875 break; 876 case 27: 877 #line 307 "./parse.y" 878 { yyval = scon_stk_ptr; } 879 break; 880 case 28: 881 #line 311 "./parse.y" 882 { yyval = yyvsp[-2]; } 883 break; 884 case 29: 885 #line 314 "./parse.y" 886 { 887 yyval = scon_stk_ptr; 888 889 for ( i = 1; i <= lastsc; ++i ) 890 { 891 int j; 892 893 for ( j = 1; j <= scon_stk_ptr; ++j ) 894 if ( scon_stk[j] == i ) 895 break; 896 897 if ( j > scon_stk_ptr ) 898 scon_stk[++scon_stk_ptr] = i; 899 } 900 } 901 break; 902 case 30: 903 #line 331 "./parse.y" 904 { yyval = scon_stk_ptr; } 905 break; 906 case 33: 907 #line 339 "./parse.y" 908 { synerr( "bad start condition list" ); } 909 break; 910 case 34: 911 #line 343 "./parse.y" 912 { 913 if ( (scnum = sclookup( nmstr )) == 0 ) 914 format_pinpoint_message( 915 "undeclared start condition %s", 916 nmstr ); 917 else 918 { 919 for ( i = 1; i <= scon_stk_ptr; ++i ) 920 if ( scon_stk[i] == scnum ) 921 { 922 format_warn( 923 "<%s> specified twice", 924 scname[scnum] ); 925 break; 926 } 927 928 if ( i > scon_stk_ptr ) 929 scon_stk[++scon_stk_ptr] = scnum; 930 } 931 } 932 break; 933 case 35: 934 #line 366 "./parse.y" 935 { 936 if ( transchar[lastst[yyvsp[0]]] != SYM_EPSILON ) 937 /* Provide final transition \now/ so it 938 * will be marked as a trailing context 939 * state. 940 */ 941 yyvsp[0] = link_machines( yyvsp[0], 942 mkstate( SYM_EPSILON ) ); 943 944 mark_beginning_as_normal( yyvsp[0] ); 945 current_state_type = STATE_NORMAL; 946 947 if ( previous_continued_action ) 948 { 949 /* We need to treat this as variable trailing 950 * context so that the backup does not happen 951 * in the action but before the action switch 952 * statement. If the backup happens in the 953 * action, then the rules "falling into" this 954 * one's action will *also* do the backup, 955 * erroneously. 956 */ 957 if ( ! varlength || headcnt != 0 ) 958 warn( 959 "trailing context made variable due to preceding '|' action" ); 960 961 /* Mark as variable. */ 962 varlength = true; 963 headcnt = 0; 964 } 965 966 if ( lex_compat || (varlength && headcnt == 0) ) 967 { /* variable trailing context rule */ 968 /* Mark the first part of the rule as the 969 * accepting "head" part of a trailing 970 * context rule. 971 * 972 * By the way, we didn't do this at the 973 * beginning of this production because back 974 * then current_state_type was set up for a 975 * trail rule, and add_accept() can create 976 * a new state ... 977 */ 978 add_accept( yyvsp[-1], 979 num_rules | YY_TRAILING_HEAD_MASK ); 980 variable_trail_rule = true; 981 } 982 983 else 984 trailcnt = rulelen; 985 986 yyval = link_machines( yyvsp[-1], yyvsp[0] ); 987 } 988 break; 989 case 36: 990 #line 421 "./parse.y" 991 { synerr( "trailing context used twice" ); } 992 break; 993 case 37: 994 #line 424 "./parse.y" 995 { 996 headcnt = 0; 997 trailcnt = 1; 998 rulelen = 1; 999 varlength = false; 1000 1001 current_state_type = STATE_TRAILING_CONTEXT; 1002 1003 if ( trlcontxt ) 1004 { 1005 synerr( "trailing context used twice" ); 1006 yyval = mkstate( SYM_EPSILON ); 1007 } 1008 1009 else if ( previous_continued_action ) 1010 { 1011 /* See the comment in the rule for "re2 re" 1012 * above. 1013 */ 1014 warn( 1015 "trailing context made variable due to preceding '|' action" ); 1016 1017 varlength = true; 1018 } 1019 1020 if ( lex_compat || varlength ) 1021 { 1022 /* Again, see the comment in the rule for 1023 * "re2 re" above. 1024 */ 1025 add_accept( yyvsp[-1], 1026 num_rules | YY_TRAILING_HEAD_MASK ); 1027 variable_trail_rule = true; 1028 } 1029 1030 trlcontxt = true; 1031 1032 eps = mkstate( SYM_EPSILON ); 1033 yyval = link_machines( yyvsp[-1], 1034 link_machines( eps, mkstate( '\n' ) ) ); 1035 } 1036 break; 1037 case 38: 1038 #line 467 "./parse.y" 1039 { 1040 yyval = yyvsp[0]; 1041 1042 if ( trlcontxt ) 1043 { 1044 if ( lex_compat || (varlength && headcnt == 0) ) 1045 /* Both head and trail are 1046 * variable-length. 1047 */ 1048 variable_trail_rule = true; 1049 else 1050 trailcnt = rulelen; 1051 } 1052 } 1053 break; 1054 case 39: 1055 #line 485 "./parse.y" 1056 { 1057 varlength = true; 1058 yyval = mkor( yyvsp[-2], yyvsp[0] ); 1059 } 1060 break; 1061 case 40: 1062 #line 491 "./parse.y" 1063 { yyval = yyvsp[0]; } 1064 break; 1065 case 41: 1066 #line 496 "./parse.y" 1067 { 1068 /* This rule is written separately so the 1069 * reduction will occur before the trailing 1070 * series is parsed. 1071 */ 1072 1073 if ( trlcontxt ) 1074 synerr( "trailing context used twice" ); 1075 else 1076 trlcontxt = true; 1077 1078 if ( varlength ) 1079 /* We hope the trailing context is 1080 * fixed-length. 1081 */ 1082 varlength = false; 1083 else 1084 headcnt = rulelen; 1085 1086 rulelen = 0; 1087 1088 current_state_type = STATE_TRAILING_CONTEXT; 1089 yyval = yyvsp[-1]; 1090 } 1091 break; 1092 case 42: 1093 #line 523 "./parse.y" 1094 { 1095 /* This is where concatenation of adjacent patterns 1096 * gets done. 1097 */ 1098 yyval = link_machines( yyvsp[-1], yyvsp[0] ); 1099 } 1100 break; 1101 case 43: 1102 #line 531 "./parse.y" 1103 { yyval = yyvsp[0]; } 1104 break; 1105 case 44: 1106 #line 535 "./parse.y" 1107 { 1108 varlength = true; 1109 1110 yyval = mkclos( yyvsp[-1] ); 1111 } 1112 break; 1113 case 45: 1114 #line 542 "./parse.y" 1115 { 1116 varlength = true; 1117 yyval = mkposcl( yyvsp[-1] ); 1118 } 1119 break; 1120 case 46: 1121 #line 548 "./parse.y" 1122 { 1123 varlength = true; 1124 yyval = mkopt( yyvsp[-1] ); 1125 } 1126 break; 1127 case 47: 1128 #line 554 "./parse.y" 1129 { 1130 varlength = true; 1131 1132 if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 ) 1133 { 1134 synerr( "bad iteration values" ); 1135 yyval = yyvsp[-5]; 1136 } 1137 else 1138 { 1139 if ( yyvsp[-3] == 0 ) 1140 { 1141 if ( yyvsp[-1] <= 0 ) 1142 { 1143 synerr( 1144 "bad iteration values" ); 1145 yyval = yyvsp[-5]; 1146 } 1147 else 1148 yyval = mkopt( 1149 mkrep( yyvsp[-5], 1, yyvsp[-1] ) ); 1150 } 1151 else 1152 yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] ); 1153 } 1154 } 1155 break; 1156 case 48: 1157 #line 582 "./parse.y" 1158 { 1159 varlength = true; 1160 1161 if ( yyvsp[-2] <= 0 ) 1162 { 1163 synerr( "iteration value must be positive" ); 1164 yyval = yyvsp[-4]; 1165 } 1166 1167 else 1168 yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITY ); 1169 } 1170 break; 1171 case 49: 1172 #line 596 "./parse.y" 1173 { 1174 /* The singleton could be something like "(foo)", 1175 * in which case we have no idea what its length 1176 * is, so we punt here. 1177 */ 1178 varlength = true; 1179 1180 if ( yyvsp[-1] <= 0 ) 1181 { 1182 synerr( "iteration value must be positive" ); 1183 yyval = yyvsp[-3]; 1184 } 1185 1186 else 1187 yyval = link_machines( yyvsp[-3], 1188 copysingl( yyvsp[-3], yyvsp[-1] - 1 ) ); 1189 } 1190 break; 1191 case 50: 1192 #line 615 "./parse.y" 1193 { 1194 if ( ! madeany ) 1195 { 1196 /* Create the '.' character class. */ 1197 anyccl = cclinit(); 1198 ccladd( anyccl, '\n' ); 1199 cclnegate( anyccl ); 1200 1201 if ( useecs ) 1202 mkeccl( ccltbl + cclmap[anyccl], 1203 ccllen[anyccl], nextecm, 1204 ecgroup, csize, csize ); 1205 1206 madeany = true; 1207 } 1208 1209 ++rulelen; 1210 1211 yyval = mkstate( -anyccl ); 1212 } 1213 break; 1214 case 51: 1215 #line 637 "./parse.y" 1216 { 1217 if ( ! cclsorted ) 1218 /* Sort characters for fast searching. We 1219 * use a shell sort since this list could 1220 * be large. 1221 */ 1222 cshell( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], true ); 1223 1224 if ( useecs ) 1225 mkeccl( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], 1226 nextecm, ecgroup, csize, csize ); 1227 1228 ++rulelen; 1229 1230 yyval = mkstate( -yyvsp[0] ); 1231 } 1232 break; 1233 case 52: 1234 #line 655 "./parse.y" 1235 { 1236 ++rulelen; 1237 1238 yyval = mkstate( -yyvsp[0] ); 1239 } 1240 break; 1241 case 53: 1242 #line 662 "./parse.y" 1243 { yyval = yyvsp[-1]; } 1244 break; 1245 case 54: 1246 #line 665 "./parse.y" 1247 { yyval = yyvsp[-1]; } 1248 break; 1249 case 55: 1250 #line 668 "./parse.y" 1251 { 1252 ++rulelen; 1253 1254 if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' ) 1255 yyvsp[0] = clower( yyvsp[0] ); 1256 1257 yyval = mkstate( yyvsp[0] ); 1258 } 1259 break; 1260 case 56: 1261 #line 679 "./parse.y" 1262 { yyval = yyvsp[-1]; } 1263 break; 1264 case 57: 1265 #line 682 "./parse.y" 1266 { 1267 cclnegate( yyvsp[-1] ); 1268 yyval = yyvsp[-1]; 1269 } 1270 break; 1271 case 58: 1272 #line 689 "./parse.y" 1273 { 1274 if ( caseins ) 1275 { 1276 if ( yyvsp[-2] >= 'A' && yyvsp[-2] <= 'Z' ) 1277 yyvsp[-2] = clower( yyvsp[-2] ); 1278 if ( yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' ) 1279 yyvsp[0] = clower( yyvsp[0] ); 1280 } 1281 1282 if ( yyvsp[-2] > yyvsp[0] ) 1283 synerr( "negative range in character class" ); 1284 1285 else 1286 { 1287 for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i ) 1288 ccladd( yyvsp[-3], i ); 1289 1290 /* Keep track if this ccl is staying in 1291 * alphabetical order. 1292 */ 1293 cclsorted = cclsorted && (yyvsp[-2] > lastchar); 1294 lastchar = yyvsp[0]; 1295 } 1296 1297 yyval = yyvsp[-3]; 1298 } 1299 break; 1300 case 59: 1301 #line 717 "./parse.y" 1302 { 1303 if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' ) 1304 yyvsp[0] = clower( yyvsp[0] ); 1305 1306 ccladd( yyvsp[-1], yyvsp[0] ); 1307 cclsorted = cclsorted && (yyvsp[0] > lastchar); 1308 lastchar = yyvsp[0]; 1309 yyval = yyvsp[-1]; 1310 } 1311 break; 1312 case 60: 1313 #line 728 "./parse.y" 1314 { 1315 /* Too hard to properly maintain cclsorted. */ 1316 cclsorted = false; 1317 yyval = yyvsp[-1]; 1318 } 1319 break; 1320 case 61: 1321 #line 735 "./parse.y" 1322 { 1323 cclsorted = true; 1324 lastchar = 0; 1325 currccl = yyval = cclinit(); 1326 } 1327 break; 1328 case 62: 1329 #line 742 "./parse.y" 1330 { CCL_EXPR(isalnum) } 1331 break; 1332 case 63: 1333 #line 743 "./parse.y" 1334 { CCL_EXPR(isalpha) } 1335 break; 1336 case 64: 1337 #line 744 "./parse.y" 1338 { CCL_EXPR(IS_BLANK) } 1339 break; 1340 case 65: 1341 #line 745 "./parse.y" 1342 { CCL_EXPR(iscntrl) } 1343 break; 1344 case 66: 1345 #line 746 "./parse.y" 1346 { CCL_EXPR(isdigit) } 1347 break; 1348 case 67: 1349 #line 747 "./parse.y" 1350 { CCL_EXPR(isgraph) } 1351 break; 1352 case 68: 1353 #line 748 "./parse.y" 1354 { CCL_EXPR(islower) } 1355 break; 1356 case 69: 1357 #line 749 "./parse.y" 1358 { CCL_EXPR(isprint) } 1359 break; 1360 case 70: 1361 #line 750 "./parse.y" 1362 { CCL_EXPR(ispunct) } 1363 break; 1364 case 71: 1365 #line 751 "./parse.y" 1366 { CCL_EXPR(isspace) } 1367 break; 1368 case 72: 1369 #line 752 "./parse.y" 1370 { 1371 if ( caseins ) 1372 CCL_EXPR(islower) 1373 else 1374 CCL_EXPR(isupper) 1375 } 1376 break; 1377 case 73: 1378 #line 758 "./parse.y" 1379 { CCL_EXPR(isxdigit) } 1380 break; 1381 case 74: 1382 #line 762 "./parse.y" 1383 { 1384 if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' ) 1385 yyvsp[0] = clower( yyvsp[0] ); 1386 1387 ++rulelen; 1388 1389 yyval = link_machines( yyvsp[-1], mkstate( yyvsp[0] ) ); 1390 } 1391 break; 1392 case 75: 1393 #line 772 "./parse.y" 1394 { yyval = mkstate( SYM_EPSILON ); } 1395 break; 1396 #line 1397 "y.tab.c" 1397 } 1398 yyssp -= yym; 1399 yystate = *yyssp; 1400 yyvsp -= yym; 1401 yym = yylhs[yyn]; 1402 if (yystate == 0 && yym == 0) 1403 { 1404 #if YYDEBUG 1405 if (yydebug) 1406 printf("%sdebug: after reduction, shifting from state 0 to\ 1407 state %d\n", YYPREFIX, YYFINAL); 1408 #endif 1409 yystate = YYFINAL; 1410 *++yyssp = YYFINAL; 1411 *++yyvsp = yyval; 1412 if (yychar < 0) 1413 { 1414 if ((yychar = yylex()) < 0) yychar = 0; 1415 #if YYDEBUG 1416 if (yydebug) 1417 { 1418 yys = 0; 1419 if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; 1420 if (!yys) yys = "illegal-symbol"; 1421 printf("%sdebug: state %d, reading %d (%s)\n", 1422 YYPREFIX, YYFINAL, yychar, yys); 1423 } 1424 #endif 1425 } 1426 if (yychar == 0) goto yyaccept; 1427 goto yyloop; 1428 } 1429 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && 1430 yyn <= YYTABLESIZE && yycheck[yyn] == yystate) 1431 yystate = yytable[yyn]; 1432 else 1433 yystate = yydgoto[yym]; 1434 #if YYDEBUG 1435 if (yydebug) 1436 printf("%sdebug: after reduction, shifting from state %d \ 1437 to state %d\n", YYPREFIX, *yyssp, yystate); 1438 #endif 1439 if (yyssp >= yyss + yystacksize - 1) 1440 { 1441 goto yyoverflow; 1442 } 1443 *++yyssp = yystate; 1444 *++yyvsp = yyval; 1445 goto yyloop; 1446 yyoverflow: 1447 yyerror("yacc stack overflow"); 1448 yyabort: 1449 return (1); 1450 yyaccept: 1451 return (0); 1452 } 1453