- Timestamp:
- 2000-07-13T10:21:53+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New_Config_Format-branch/gsdl/packages/mg/src/text/bool_parser.c
r531 r1279 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 YY MINOR 97 #define yyclearin (yychar=(-1)) 8 #define yyerrok (yyerrflag=0)9 #define YYRECOVERING (yyerrflag!=0) 10 # define YYPREFIX "yy"11 #line 25 "bool_parser.y" 1 2 /* A Bison parser, made from bool_parser.y 3 by GNU Bison version 1.27 4 */ 5 6 #define YYBISON 1 /* Identify Bison output. */ 7 8 #define TERM 257 9 10 #line 24 "bool_parser.y" 11 12 12 13 13 #include "sysfuncs.h" … … 48 48 static u_long invf_ptr; 49 49 static u_long invf_len; 50 #line 65 "bool_parser.y" 50 51 #line 66 "bool_parser.y" 51 52 typedef union { 52 53 char *text; 53 54 bool_tree_node *node; 54 55 } YYSTYPE; 55 #line 55 "y.tab.c" 56 #define TERM 257 57 #define YYERRCODE 256 58 short yylhs[] = { -1, 59 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 60 4, 4, 61 }; 62 short yylen[] = { 2, 63 1, 1, 3, 1, 1, 1, 2, 3, 2, 1, 64 3, 1, 65 }; 66 short yydefred[] = { 0, 67 2, 0, 4, 5, 0, 0, 6, 10, 0, 0, 68 0, 7, 0, 9, 0, 3, 8, 0, 69 }; 70 short yydgoto[] = { 6, 71 7, 8, 9, 10, 72 }; 73 short yysindex[] = { -32, 74 0, -32, 0, 0, -32, 0, 0, 0, -33, -118, 75 -37, 0, -32, 0, -32, 0, 0, -33, 76 }; 77 short yyrindex[] = { 0, 78 0, 0, 0, 0, 0, 0, 0, 0, 2, 12, 79 0, 0, 0, 0, 0, 0, 0, 3, 80 }; 81 short yygindex[] = { 0, 82 0, 6, -2, 14, 83 }; 84 #define YYTABLESIZE 225 85 short yytable[] = { 5, 86 5, 12, 11, 16, 13, 15, 2, 2, 3, 3, 87 12, 1, 18, 0, 14, 11, 0, 0, 17, 0, 88 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 89 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90 0, 0, 12, 11, 0, 0, 0, 0, 0, 0, 91 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 93 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 98 0, 0, 0, 0, 0, 12, 11, 0, 0, 0, 99 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108 0, 0, 0, 1, 1, 109 }; 110 short yycheck[] = { 33, 111 33, 0, 0, 41, 38, 124, 40, 40, 42, 42, 112 5, 0, 15, -1, 9, 2, -1, -1, 13, -1, 113 -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, 114 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115 -1, -1, 41, 41, -1, -1, -1, -1, -1, -1, 116 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117 -1, 95, 95, -1, -1, -1, -1, -1, -1, -1, 118 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119 -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, 120 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 121 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 123 -1, -1, -1, -1, -1, 124, 124, -1, -1, -1, 124 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 126 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 130 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133 -1, -1, -1, 257, 257, 134 }; 135 #define YYFINAL 6 136 #ifndef YYDEBUG 137 #define YYDEBUG 0 138 #endif 139 #define YYMAXTOKEN 257 140 #if YYDEBUG 141 char *yyname[] = { 142 "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, 143 "'!'",0,0,0,0,"'&'",0,"'('","')'","'*'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 144 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'_'",0,0,0,0,0, 145 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,0,0,0,0,0, 146 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 147 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 148 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 149 "TERM", 150 }; 151 char *yyrule[] = { 152 "$accept : query", 153 "query : or", 154 "term : TERM", 155 "term : '(' or ')'", 156 "term : '*'", 157 "term : '_'", 158 "not : term", 159 "not : '!' not", 160 "and : and '&' not", 161 "and : and not", 162 "and : not", 163 "or : or '|' and", 164 "or : and", 165 }; 166 #endif 167 #ifdef YYSTACKSIZE 56 #include <stdio.h> 57 58 #ifndef __cplusplus 59 #ifndef __STDC__ 60 #define const 61 #endif 62 #endif 63 64 65 66 #define YYFINAL 20 67 #define YYFLAG -32768 68 #define YYNTBASE 11 69 70 #define YYTRANSLATE(x) ((unsigned)(x) <= 257 ? yytranslate[x] : 16) 71 72 static const char yytranslate[] = { 0, 73 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 74 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 75 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 76 2, 2, 8, 2, 2, 2, 2, 9, 2, 4, 77 5, 6, 2, 2, 2, 2, 2, 2, 2, 2, 78 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 79 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 80 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 82 2, 2, 2, 2, 7, 2, 2, 2, 2, 2, 83 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 85 2, 2, 2, 10, 2, 2, 2, 2, 2, 2, 86 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 87 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 88 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 89 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 90 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 91 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 93 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 94 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 95 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 96 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 97 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 98 2, 2, 2, 2, 2, 1, 3 99 }; 100 101 #if YYDEBUG != 0 102 static const short yyprhs[] = { 0, 103 0, 2, 4, 8, 10, 12, 14, 17, 21, 24, 104 26, 30 105 }; 106 107 static const short yyrhs[] = { 15, 108 0, 3, 0, 4, 15, 5, 0, 6, 0, 7, 109 0, 12, 0, 8, 13, 0, 14, 9, 13, 0, 110 14, 13, 0, 13, 0, 15, 10, 14, 0, 14, 111 0 112 }; 113 114 #endif 115 116 #if YYDEBUG != 0 117 static const short yyrline[] = { 0, 118 76, 80, 81, 82, 83, 86, 87, 90, 91, 92, 119 95, 96 120 }; 121 #endif 122 123 124 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) 125 126 static const char * const yytname[] = { "$","error","$undefined.","TERM","'('", 127 "')'","'*'","'_'","'!'","'&'","'|'","query","term","not","and","or", NULL 128 }; 129 #endif 130 131 static const short yyr1[] = { 0, 132 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, 133 15, 15 134 }; 135 136 static const short yyr2[] = { 0, 137 1, 1, 3, 1, 1, 1, 2, 3, 2, 1, 138 3, 1 139 }; 140 141 static const short yydefact[] = { 0, 142 2, 0, 4, 5, 0, 6, 10, 12, 1, 0, 143 7, 0, 9, 0, 3, 8, 11, 0, 0, 0 144 }; 145 146 static const short yydefgoto[] = { 18, 147 6, 7, 8, 9 148 }; 149 150 static const short yypact[] = { 10, 151 -32768, 10,-32768,-32768, 10,-32768,-32768, 2, -9, 14, 152 -32768, 10,-32768, 10,-32768,-32768, 2, 4, 15,-32768 153 }; 154 155 static const short yypgoto[] = {-32768, 156 -32768, -5, -12, 18 157 }; 158 159 160 #define YYLAST 24 161 162 163 static const short yytable[] = { 11, 164 14, 17, 13, 19, 1, 2, 16, 3, 4, 5, 165 12, 13, 1, 2, 20, 3, 4, 5, 15, 10, 166 0, 0, 0, 14 167 }; 168 169 static const short yycheck[] = { 5, 170 10, 14, 8, 0, 3, 4, 12, 6, 7, 8, 171 9, 17, 3, 4, 0, 6, 7, 8, 5, 2, 172 -1, -1, -1, 10 173 }; 174 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 175 #line 3 "/usr/share/bison.simple" 176 /* This file comes from bison-1.27. */ 177 178 /* Skeleton output parser for bison, 179 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. 180 181 This program is free software; you can redistribute it and/or modify 182 it under the terms of the GNU General Public License as published by 183 the Free Software Foundation; either version 2, or (at your option) 184 any later version. 185 186 This program is distributed in the hope that it will be useful, 187 but WITHOUT ANY WARRANTY; without even the implied warranty of 188 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 189 GNU General Public License for more details. 190 191 You should have received a copy of the GNU General Public License 192 along with this program; if not, write to the Free Software 193 Foundation, Inc., 59 Temple Place - Suite 330, 194 Boston, MA 02111-1307, USA. */ 195 196 /* As a special exception, when this file is copied by Bison into a 197 Bison output file, you may use that output file without restriction. 198 This special exception was added by the Free Software Foundation 199 in version 1.24 of Bison. */ 200 201 /* This is the parser code that is written into each bison parser 202 when the %semantic_parser declaration is not specified in the grammar. 203 It was written by Richard Stallman by simplifying the hairy parser 204 used when %semantic_parser is specified. */ 205 206 #ifndef YYSTACK_USE_ALLOCA 207 #ifdef alloca 208 #define YYSTACK_USE_ALLOCA 209 #else /* alloca not defined */ 210 #ifdef __GNUC__ 211 #define YYSTACK_USE_ALLOCA 212 #define alloca __builtin_alloca 213 #else /* not GNU C. */ 214 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) 215 #define YYSTACK_USE_ALLOCA 216 #include <alloca.h> 217 #else /* not sparc */ 218 /* We think this test detects Watcom and Microsoft C. */ 219 /* This used to test MSDOS, but that is a bad idea 220 since that symbol is in the user namespace. */ 221 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) 222 #if 0 /* No need for malloc.h, which pollutes the namespace; 223 instead, just don't use alloca. */ 224 #include <malloc.h> 225 #endif 226 #else /* not MSDOS, or __TURBOC__ */ 227 #if defined(_AIX) 228 /* I don't know what this was needed for, but it pollutes the namespace. 229 So I turned it off. rms, 2 May 1997. */ 230 /* #include <malloc.h> */ 231 #pragma alloca 232 #define YYSTACK_USE_ALLOCA 233 #else /* not MSDOS, or __TURBOC__, or _AIX */ 234 #if 0 235 #ifdef __hpux /* [email protected] says this works for HPUX 9.05 and up, 236 and on HPUX 10. Eventually we can turn this on. */ 237 #define YYSTACK_USE_ALLOCA 238 #define alloca __builtin_alloca 239 #endif /* __hpux */ 240 #endif 241 #endif /* not _AIX */ 242 #endif /* not MSDOS, or __TURBOC__ */ 243 #endif /* not sparc */ 244 #endif /* not GNU C */ 245 #endif /* alloca not defined */ 246 #endif /* YYSTACK_USE_ALLOCA not defined */ 247 248 #ifdef YYSTACK_USE_ALLOCA 249 #define YYSTACK_ALLOC alloca 250 #else 251 #define YYSTACK_ALLOC malloc 252 #endif 253 254 /* Note: there must be only one dollar sign in this file. 255 It is replaced by the list of actions, each action 256 as one case of the switch. */ 257 258 #define yyerrok (yyerrstatus = 0) 259 #define yyclearin (yychar = YYEMPTY) 260 #define YYEMPTY -2 261 #define YYEOF 0 262 #define YYACCEPT goto yyacceptlab 263 #define YYABORT goto yyabortlab 264 #define YYERROR goto yyerrlab1 265 /* Like YYERROR except do call yyerror. 266 This remains here temporarily to ease the 267 transition to the new meaning of YYERROR, for GCC. 268 Once GCC version 2 has supplanted version 1, this can go. */ 269 #define YYFAIL goto yyerrlab 270 #define YYRECOVERING() (!!yyerrstatus) 271 #define YYBACKUP(token, value) \ 272 do \ 273 if (yychar == YYEMPTY && yylen == 1) \ 274 { yychar = (token), yylval = (value); \ 275 yychar1 = YYTRANSLATE (yychar); \ 276 YYPOPSTACK; \ 277 goto yybackup; \ 278 } \ 279 else \ 280 { yyerror ("syntax error: cannot back up"); YYERROR; } \ 281 while (0) 282 283 #define YYTERROR 1 284 #define YYERRCODE 256 285 286 #ifndef YYPURE 287 #define YYLEX yylex() 288 #endif 289 290 #ifdef YYPURE 291 #ifdef YYLSP_NEEDED 292 #ifdef YYLEX_PARAM 293 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) 294 #else 295 #define YYLEX yylex(&yylval, &yylloc) 296 #endif 297 #else /* not YYLSP_NEEDED */ 298 #ifdef YYLEX_PARAM 299 #define YYLEX yylex(&yylval, YYLEX_PARAM) 300 #else 301 #define YYLEX yylex(&yylval) 302 #endif 303 #endif /* not YYLSP_NEEDED */ 304 #endif 305 306 /* If nonreentrant, generate the variables here */ 307 308 #ifndef YYPURE 309 310 int yychar; /* the lookahead symbol */ 311 YYSTYPE yylval; /* the semantic value of the */ 312 /* lookahead symbol */ 313 314 #ifdef YYLSP_NEEDED 315 YYLTYPE yylloc; /* location data for the lookahead */ 316 /* symbol */ 317 #endif 318 319 int yynerrs; /* number of parse errors so far */ 320 #endif /* not YYPURE */ 321 322 #if YYDEBUG != 0 323 int yydebug; /* nonzero means print parse trace */ 324 /* Since this is uninitialized, it does not stop multiple parsers 325 from coexisting. */ 326 #endif 327 328 /* YYINITDEPTH indicates the initial size of the parser's stacks */ 329 330 #ifndef YYINITDEPTH 331 #define YYINITDEPTH 200 332 #endif 333 334 /* YYMAXDEPTH is the maximum size the stacks can grow to 335 (effective only if the built-in stack extension method is used). */ 336 337 #if YYMAXDEPTH == 0 168 338 #undef YYMAXDEPTH 169 #define YYMAXDEPTH YYSTACKSIZE 339 #endif 340 341 #ifndef YYMAXDEPTH 342 #define YYMAXDEPTH 10000 343 #endif 344 345 346 /* Define __yy_memcpy. Note that the size argument 347 should be passed with type unsigned int, because that is what the non-GCC 348 definitions require. With GCC, __builtin_memcpy takes an arg 349 of type size_t, but it can handle unsigned int. */ 350 351 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ 352 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) 353 #else /* not GNU C or C++ */ 354 #ifndef __cplusplus 355 356 /* This is the most reliable way to avoid incompatibilities 357 in available built-in functions on various systems. */ 358 static void 359 __yy_memcpy (to, from, count) 360 char *to; 361 char *from; 362 unsigned int count; 363 { 364 register char *f = from; 365 register char *t = to; 366 register int i = count; 367 368 while (i-- > 0) 369 *t++ = *f++; 370 } 371 372 #else /* __cplusplus */ 373 374 /* This is the most reliable way to avoid incompatibilities 375 in available built-in functions on various systems. */ 376 static void 377 __yy_memcpy (char *to, char *from, unsigned int count) 378 { 379 register char *t = to; 380 register char *f = from; 381 register int i = count; 382 383 while (i-- > 0) 384 *t++ = *f++; 385 } 386 387 #endif 388 #endif 389 390 391 #line 216 "/usr/share/bison.simple" 392 393 /* The user can define YYPARSE_PARAM as the name of an argument to be passed 394 into yyparse. The argument should have type void *. 395 It should actually point to an object. 396 Grammar actions can access the variable by casting it 397 to the proper pointer type. */ 398 399 #ifdef YYPARSE_PARAM 400 #ifdef __cplusplus 401 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 402 #define YYPARSE_PARAM_DECL 403 #else /* not __cplusplus */ 404 #define YYPARSE_PARAM_ARG YYPARSE_PARAM 405 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 406 #endif /* not __cplusplus */ 407 #else /* not YYPARSE_PARAM */ 408 #define YYPARSE_PARAM_ARG 409 #define YYPARSE_PARAM_DECL 410 #endif /* not YYPARSE_PARAM */ 411 412 /* Prevent warning if -Wstrict-prototypes. */ 413 #ifdef __GNUC__ 414 #ifdef YYPARSE_PARAM 415 int yyparse (void *); 170 416 #else 171 #ifdef YYMAXDEPTH 172 #define YYSTACKSIZE YYMAXDEPTH 417 int yyparse (void); 418 #endif 419 #endif 420 421 int 422 yyparse(YYPARSE_PARAM_ARG) 423 YYPARSE_PARAM_DECL 424 { 425 register int yystate; 426 register int yyn; 427 register short *yyssp; 428 register YYSTYPE *yyvsp; 429 int yyerrstatus; /* number of tokens to shift before error messages enabled */ 430 int yychar1 = 0; /* lookahead token as an internal (translated) token number */ 431 432 short yyssa[YYINITDEPTH]; /* the state stack */ 433 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ 434 435 short *yyss = yyssa; /* refer to the stacks thru separate pointers */ 436 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ 437 438 #ifdef YYLSP_NEEDED 439 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ 440 YYLTYPE *yyls = yylsa; 441 YYLTYPE *yylsp; 442 443 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 173 444 #else 174 #define YYSTACKSIZE 500 175 #define YYMAXDEPTH 500 176 #endif 177 #endif 178 int yydebug; 179 int yynerrs; 180 int yyerrflag; 181 int yychar; 182 short *yyssp; 183 YYSTYPE *yyvsp; 184 YYSTYPE yyval; 185 YYSTYPE yylval; 186 short yyss[YYSTACKSIZE]; 187 YYSTYPE yyvs[YYSTACKSIZE]; 188 #define yystacksize YYSTACKSIZE 445 #define YYPOPSTACK (yyvsp--, yyssp--) 446 #endif 447 448 int yystacksize = YYINITDEPTH; 449 int yyfree_stacks = 0; 450 451 #ifdef YYPURE 452 int yychar; 453 YYSTYPE yylval; 454 int yynerrs; 455 #ifdef YYLSP_NEEDED 456 YYLTYPE yylloc; 457 #endif 458 #endif 459 460 YYSTYPE yyval; /* the variable used to return */ 461 /* semantic values from the action */ 462 /* routines */ 463 464 int yylen; 465 466 #if YYDEBUG != 0 467 if (yydebug) 468 fprintf(stderr, "Starting parse\n"); 469 #endif 470 471 yystate = 0; 472 yyerrstatus = 0; 473 yynerrs = 0; 474 yychar = YYEMPTY; /* Cause a token to be read. */ 475 476 /* Initialize stack pointers. 477 Waste one element of value and location stack 478 so that they stay on the same level as the state stack. 479 The wasted elements are never initialized. */ 480 481 yyssp = yyss - 1; 482 yyvsp = yyvs; 483 #ifdef YYLSP_NEEDED 484 yylsp = yyls; 485 #endif 486 487 /* Push a new state, which is found in yystate . */ 488 /* In all cases, when you get here, the value and location stacks 489 have just been pushed. so pushing a state here evens the stacks. */ 490 yynewstate: 491 492 *++yyssp = yystate; 493 494 if (yyssp >= yyss + yystacksize - 1) 495 { 496 /* Give user a chance to reallocate the stack */ 497 /* Use copies of these so that the &'s don't force the real ones into memory. */ 498 YYSTYPE *yyvs1 = yyvs; 499 short *yyss1 = yyss; 500 #ifdef YYLSP_NEEDED 501 YYLTYPE *yyls1 = yyls; 502 #endif 503 504 /* Get the current used size of the three stacks, in elements. */ 505 int size = yyssp - yyss + 1; 506 507 #ifdef yyoverflow 508 /* Each stack pointer address is followed by the size of 509 the data in use in that stack, in bytes. */ 510 #ifdef YYLSP_NEEDED 511 /* This used to be a conditional around just the two extra args, 512 but that might be undefined if yyoverflow is a macro. */ 513 yyoverflow("parser stack overflow", 514 &yyss1, size * sizeof (*yyssp), 515 &yyvs1, size * sizeof (*yyvsp), 516 &yyls1, size * sizeof (*yylsp), 517 &yystacksize); 518 #else 519 yyoverflow("parser stack overflow", 520 &yyss1, size * sizeof (*yyssp), 521 &yyvs1, size * sizeof (*yyvsp), 522 &yystacksize); 523 #endif 524 525 yyss = yyss1; yyvs = yyvs1; 526 #ifdef YYLSP_NEEDED 527 yyls = yyls1; 528 #endif 529 #else /* no yyoverflow */ 530 /* Extend the stack our own way. */ 531 if (yystacksize >= YYMAXDEPTH) 532 { 533 yyerror("parser stack overflow"); 534 if (yyfree_stacks) 535 { 536 free (yyss); 537 free (yyvs); 538 #ifdef YYLSP_NEEDED 539 free (yyls); 540 #endif 541 } 542 return 2; 543 } 544 yystacksize *= 2; 545 if (yystacksize > YYMAXDEPTH) 546 yystacksize = YYMAXDEPTH; 547 #ifndef YYSTACK_USE_ALLOCA 548 yyfree_stacks = 1; 549 #endif 550 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); 551 __yy_memcpy ((char *)yyss, (char *)yyss1, 552 size * (unsigned int) sizeof (*yyssp)); 553 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); 554 __yy_memcpy ((char *)yyvs, (char *)yyvs1, 555 size * (unsigned int) sizeof (*yyvsp)); 556 #ifdef YYLSP_NEEDED 557 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); 558 __yy_memcpy ((char *)yyls, (char *)yyls1, 559 size * (unsigned int) sizeof (*yylsp)); 560 #endif 561 #endif /* no yyoverflow */ 562 563 yyssp = yyss + size - 1; 564 yyvsp = yyvs + size - 1; 565 #ifdef YYLSP_NEEDED 566 yylsp = yyls + size - 1; 567 #endif 568 569 #if YYDEBUG != 0 570 if (yydebug) 571 fprintf(stderr, "Stack size increased to %d\n", yystacksize); 572 #endif 573 574 if (yyssp >= yyss + yystacksize - 1) 575 YYABORT; 576 } 577 578 #if YYDEBUG != 0 579 if (yydebug) 580 fprintf(stderr, "Entering state %d\n", yystate); 581 #endif 582 583 goto yybackup; 584 yybackup: 585 586 /* Do appropriate processing given the current state. */ 587 /* Read a lookahead token if we need one and don't already have one. */ 588 /* yyresume: */ 589 590 /* First try to decide what to do without reference to lookahead token. */ 591 592 yyn = yypact[yystate]; 593 if (yyn == YYFLAG) 594 goto yydefault; 595 596 /* Not known => get a lookahead token if don't already have one. */ 597 598 /* yychar is either YYEMPTY or YYEOF 599 or a valid token in external form. */ 600 601 if (yychar == YYEMPTY) 602 { 603 #if YYDEBUG != 0 604 if (yydebug) 605 fprintf(stderr, "Reading a token: "); 606 #endif 607 yychar = YYLEX; 608 } 609 610 /* Convert token to internal form (in yychar1) for indexing tables with */ 611 612 if (yychar <= 0) /* This means end of input. */ 613 { 614 yychar1 = 0; 615 yychar = YYEOF; /* Don't call YYLEX any more */ 616 617 #if YYDEBUG != 0 618 if (yydebug) 619 fprintf(stderr, "Now at end of input.\n"); 620 #endif 621 } 622 else 623 { 624 yychar1 = YYTRANSLATE(yychar); 625 626 #if YYDEBUG != 0 627 if (yydebug) 628 { 629 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); 630 /* Give the individual parser a way to print the precise meaning 631 of a token, for further debugging info. */ 632 #ifdef YYPRINT 633 YYPRINT (stderr, yychar, yylval); 634 #endif 635 fprintf (stderr, ")\n"); 636 } 637 #endif 638 } 639 640 yyn += yychar1; 641 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 642 goto yydefault; 643 644 yyn = yytable[yyn]; 645 646 /* yyn is what to do for this token type in this state. 647 Negative => reduce, -yyn is rule number. 648 Positive => shift, yyn is new state. 649 New state is final state => don't bother to shift, 650 just return success. 651 0, or most negative number => error. */ 652 653 if (yyn < 0) 654 { 655 if (yyn == YYFLAG) 656 goto yyerrlab; 657 yyn = -yyn; 658 goto yyreduce; 659 } 660 else if (yyn == 0) 661 goto yyerrlab; 662 663 if (yyn == YYFINAL) 664 YYACCEPT; 665 666 /* Shift the lookahead token. */ 667 668 #if YYDEBUG != 0 669 if (yydebug) 670 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); 671 #endif 672 673 /* Discard the token being shifted unless it is eof. */ 674 if (yychar != YYEOF) 675 yychar = YYEMPTY; 676 677 *++yyvsp = yylval; 678 #ifdef YYLSP_NEEDED 679 *++yylsp = yylloc; 680 #endif 681 682 /* count tokens shifted since error; after three, turn off error status. */ 683 if (yyerrstatus) yyerrstatus--; 684 685 yystate = yyn; 686 goto yynewstate; 687 688 /* Do the default action for the current state. */ 689 yydefault: 690 691 yyn = yydefact[yystate]; 692 if (yyn == 0) 693 goto yyerrlab; 694 695 /* Do a reduction. yyn is the number of a rule to reduce with. */ 696 yyreduce: 697 yylen = yyr2[yyn]; 698 if (yylen > 0) 699 yyval = yyvsp[1-yylen]; /* implement default value of the action */ 700 701 #if YYDEBUG != 0 702 if (yydebug) 703 { 704 int i; 705 706 fprintf (stderr, "Reducing via rule %d (line %d), ", 707 yyn, yyrline[yyn]); 708 709 /* Print the symbols being reduced, and their result. */ 710 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) 711 fprintf (stderr, "%s ", yytname[yyrhs[i]]); 712 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); 713 } 714 #endif 715 716 717 switch (yyn) { 718 719 case 1: 720 #line 76 "bool_parser.y" 721 { tree_base = yyvsp[0].node;; 722 break;} 723 case 2: 724 #line 80 "bool_parser.y" 725 { yyval.node = CreateBoolTermNode(term_list, yyvsp[0].text, 1, word_num, count, doc_count, invf_ptr, invf_len, stemmer_num); ; 726 break;} 727 case 3: 728 #line 81 "bool_parser.y" 729 { yyval.node = yyvsp[-1].node; ; 730 break;} 731 case 4: 732 #line 82 "bool_parser.y" 733 { yyval.node = CreateBoolTreeNode(N_all, NULL, NULL); ; 734 break;} 735 case 5: 736 #line 83 "bool_parser.y" 737 { yyval.node = CreateBoolTreeNode(N_none, NULL, NULL); ; 738 break;} 739 case 7: 740 #line 87 "bool_parser.y" 741 { yyval.node = CreateBoolTreeNode(N_not, yyvsp[0].node, NULL); ; 742 break;} 743 case 8: 744 #line 90 "bool_parser.y" 745 { yyval.node = CreateBoolTreeNode(N_and, yyvsp[-2].node, yyvsp[0].node); ; 746 break;} 747 case 9: 748 #line 91 "bool_parser.y" 749 { yyval.node = CreateBoolTreeNode(N_and, yyvsp[-1].node, yyvsp[0].node); ; 750 break;} 751 case 11: 752 #line 95 "bool_parser.y" 753 { yyval.node = CreateBoolTreeNode(N_or, yyvsp[-2].node, yyvsp[0].node); ; 754 break;} 755 } 756 /* the action file gets copied in in place of this dollarsign */ 757 #line 542 "/usr/share/bison.simple" 758 759 760 yyvsp -= yylen; 761 yyssp -= yylen; 762 #ifdef YYLSP_NEEDED 763 yylsp -= yylen; 764 #endif 765 766 #if YYDEBUG != 0 767 if (yydebug) 768 { 769 short *ssp1 = yyss - 1; 770 fprintf (stderr, "state stack now"); 771 while (ssp1 != yyssp) 772 fprintf (stderr, " %d", *++ssp1); 773 fprintf (stderr, "\n"); 774 } 775 #endif 776 777 *++yyvsp = yyval; 778 779 #ifdef YYLSP_NEEDED 780 yylsp++; 781 if (yylen == 0) 782 { 783 yylsp->first_line = yylloc.first_line; 784 yylsp->first_column = yylloc.first_column; 785 yylsp->last_line = (yylsp-1)->last_line; 786 yylsp->last_column = (yylsp-1)->last_column; 787 yylsp->text = 0; 788 } 789 else 790 { 791 yylsp->last_line = (yylsp+yylen-1)->last_line; 792 yylsp->last_column = (yylsp+yylen-1)->last_column; 793 } 794 #endif 795 796 /* Now "shift" the result of the reduction. 797 Determine what state that goes to, 798 based on the state we popped back to 799 and the rule number reduced by. */ 800 801 yyn = yyr1[yyn]; 802 803 yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 804 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 805 yystate = yytable[yystate]; 806 else 807 yystate = yydefgoto[yyn - YYNTBASE]; 808 809 goto yynewstate; 810 811 yyerrlab: /* here on detecting error */ 812 813 if (! yyerrstatus) 814 /* If not already recovering from an error, report this error. */ 815 { 816 ++yynerrs; 817 818 #ifdef YYERROR_VERBOSE 819 yyn = yypact[yystate]; 820 821 if (yyn > YYFLAG && yyn < YYLAST) 822 { 823 int size = 0; 824 char *msg; 825 int x, count; 826 827 count = 0; 828 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ 829 for (x = (yyn < 0 ? -yyn : 0); 830 x < (sizeof(yytname) / sizeof(char *)); x++) 831 if (yycheck[x + yyn] == x) 832 size += strlen(yytname[x]) + 15, count++; 833 msg = (char *) malloc(size + 15); 834 if (msg != 0) 835 { 836 strcpy(msg, "parse error"); 837 838 if (count < 5) 839 { 840 count = 0; 841 for (x = (yyn < 0 ? -yyn : 0); 842 x < (sizeof(yytname) / sizeof(char *)); x++) 843 if (yycheck[x + yyn] == x) 844 { 845 strcat(msg, count == 0 ? ", expecting `" : " or `"); 846 strcat(msg, yytname[x]); 847 strcat(msg, "'"); 848 count++; 849 } 850 } 851 yyerror(msg); 852 free(msg); 853 } 854 else 855 yyerror ("parse error; also virtual memory exceeded"); 856 } 857 else 858 #endif /* YYERROR_VERBOSE */ 859 yyerror("parse error"); 860 } 861 862 goto yyerrlab1; 863 yyerrlab1: /* here on error raised explicitly by an action */ 864 865 if (yyerrstatus == 3) 866 { 867 /* if just tried and failed to reuse lookahead token after an error, discard it. */ 868 869 /* return failure if at end of input */ 870 if (yychar == YYEOF) 871 YYABORT; 872 873 #if YYDEBUG != 0 874 if (yydebug) 875 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); 876 #endif 877 878 yychar = YYEMPTY; 879 } 880 881 /* Else will try to reuse lookahead token 882 after shifting the error token. */ 883 884 yyerrstatus = 3; /* Each real token shifted decrements this */ 885 886 goto yyerrhandle; 887 888 yyerrdefault: /* current state does not do anything special for the error token. */ 889 890 #if 0 891 /* This is wrong; only states that explicitly want error tokens 892 should shift them. */ 893 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ 894 if (yyn) goto yydefault; 895 #endif 896 897 yyerrpop: /* pop the current state because it cannot handle the error token */ 898 899 if (yyssp == yyss) YYABORT; 900 yyvsp--; 901 yystate = *--yyssp; 902 #ifdef YYLSP_NEEDED 903 yylsp--; 904 #endif 905 906 #if YYDEBUG != 0 907 if (yydebug) 908 { 909 short *ssp1 = yyss - 1; 910 fprintf (stderr, "Error: state stack now"); 911 while (ssp1 != yyssp) 912 fprintf (stderr, " %d", *++ssp1); 913 fprintf (stderr, "\n"); 914 } 915 #endif 916 917 yyerrhandle: 918 919 yyn = yypact[yystate]; 920 if (yyn == YYFLAG) 921 goto yyerrdefault; 922 923 yyn += YYTERROR; 924 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 925 goto yyerrdefault; 926 927 yyn = yytable[yyn]; 928 if (yyn < 0) 929 { 930 if (yyn == YYFLAG) 931 goto yyerrpop; 932 yyn = -yyn; 933 goto yyreduce; 934 } 935 else if (yyn == 0) 936 goto yyerrpop; 937 938 if (yyn == YYFINAL) 939 YYACCEPT; 940 941 #if YYDEBUG != 0 942 if (yydebug) 943 fprintf(stderr, "Shifting error token, "); 944 #endif 945 946 *++yyvsp = yylval; 947 #ifdef YYLSP_NEEDED 948 *++yylsp = yylloc; 949 #endif 950 951 yystate = yyn; 952 goto yynewstate; 953 954 yyacceptlab: 955 /* YYACCEPT comes here. */ 956 if (yyfree_stacks) 957 { 958 free (yyss); 959 free (yyvs); 960 #ifdef YYLSP_NEEDED 961 free (yyls); 962 #endif 963 } 964 return 0; 965 966 yyabortlab: 967 /* YYABORT comes here. */ 968 if (yyfree_stacks) 969 { 970 free (yyss); 971 free (yyvs); 972 #ifdef YYLSP_NEEDED 973 free (yyls); 974 #endif 975 } 976 return 1; 977 } 189 978 #line 99 "bool_parser.y" 979 190 980 191 981 /* Bison on one mips machine defined "const" to be nothing but … … 381 1171 bool_tree_node * 382 1172 ParseBool(char *query_line, int query_len, 383 TermList **the_term_list, int the_stemmer_num, int the_stem_method, 384 int *res, 1173 TermList **the_term_list, int the_stemmer_num, int the_stem_method, int *res, 385 1174 stemmed_dict * the_sd, int is_indexed, /* [RPAP - Jan 97: Stem Index Change] */ 386 1175 QueryTermList **the_query_term_list) /* [RPAP - Feb 97: Term Frequency] */ … … 407 1196 408 1197 409 #line 407 "y.tab.c"410 #define YYABORT goto yyabort411 #define YYREJECT goto yyabort412 #define YYACCEPT goto yyaccept413 #define YYERROR goto yyerrlab414 int415 yyparse()416 {417 register int yym, yyn, yystate;418 #if YYDEBUG419 register char *yys;420 extern char *getenv();421 422 if (yys = getenv("YYDEBUG"))423 {424 yyn = *yys;425 if (yyn >= '0' && yyn <= '9')426 yydebug = yyn - '0';427 }428 #endif429 430 yynerrs = 0;431 yyerrflag = 0;432 yychar = (-1);433 434 yyssp = yyss;435 yyvsp = yyvs;436 *yyssp = yystate = 0;437 438 yyloop:439 if (yyn = yydefred[yystate]) goto yyreduce;440 if (yychar < 0)441 {442 if ((yychar = yylex()) < 0) yychar = 0;443 #if YYDEBUG444 if (yydebug)445 {446 yys = 0;447 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];448 if (!yys) yys = "illegal-symbol";449 printf("%sdebug: state %d, reading %d (%s)\n",450 YYPREFIX, yystate, yychar, yys);451 }452 #endif453 }454 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&455 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)456 {457 #if YYDEBUG458 if (yydebug)459 printf("%sdebug: state %d, shifting to state %d\n",460 YYPREFIX, yystate, yytable[yyn]);461 #endif462 if (yyssp >= yyss + yystacksize - 1)463 {464 goto yyoverflow;465 }466 *++yyssp = yystate = yytable[yyn];467 *++yyvsp = yylval;468 yychar = (-1);469 if (yyerrflag > 0) --yyerrflag;470 goto yyloop;471 }472 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&473 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)474 {475 yyn = yytable[yyn];476 goto yyreduce;477 }478 if (yyerrflag) goto yyinrecovery;479 #ifdef lint480 goto yynewerror;481 #endif482 yynewerror:483 yyerror("syntax error");484 #ifdef lint485 goto yyerrlab;486 #endif487 yyerrlab:488 ++yynerrs;489 yyinrecovery:490 if (yyerrflag < 3)491 {492 yyerrflag = 3;493 for (;;)494 {495 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&496 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)497 {498 #if YYDEBUG499 if (yydebug)500 printf("%sdebug: state %d, error recovery shifting\501 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);502 #endif503 if (yyssp >= yyss + yystacksize - 1)504 {505 goto yyoverflow;506 }507 *++yyssp = yystate = yytable[yyn];508 *++yyvsp = yylval;509 goto yyloop;510 }511 else512 {513 #if YYDEBUG514 if (yydebug)515 printf("%sdebug: error recovery discarding state %d\n",516 YYPREFIX, *yyssp);517 #endif518 if (yyssp <= yyss) goto yyabort;519 --yyssp;520 --yyvsp;521 }522 }523 }524 else525 {526 if (yychar == 0) goto yyabort;527 #if YYDEBUG528 if (yydebug)529 {530 yys = 0;531 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];532 if (!yys) yys = "illegal-symbol";533 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",534 YYPREFIX, yystate, yychar, yys);535 }536 #endif537 yychar = (-1);538 goto yyloop;539 }540 yyreduce:541 #if YYDEBUG542 if (yydebug)543 printf("%sdebug: state %d, reducing by rule %d (%s)\n",544 YYPREFIX, yystate, yyn, yyrule[yyn]);545 #endif546 yym = yylen[yyn];547 yyval = yyvsp[1-yym];548 switch (yyn)549 {550 case 1:551 #line 75 "bool_parser.y"552 { tree_base = yyvsp[0].node;}553 break;554 case 2:555 #line 79 "bool_parser.y"556 { yyval.node = CreateBoolTermNode(term_list, yyvsp[0].text, 1, word_num, count, doc_count, invf_ptr, invf_len, stemmer_num); }557 break;558 case 3:559 #line 80 "bool_parser.y"560 { yyval.node = yyvsp[-1].node; }561 break;562 case 4:563 #line 81 "bool_parser.y"564 { yyval.node = CreateBoolTreeNode(N_all, NULL, NULL); }565 break;566 case 5:567 #line 82 "bool_parser.y"568 { yyval.node = CreateBoolTreeNode(N_none, NULL, NULL); }569 break;570 case 7:571 #line 86 "bool_parser.y"572 { yyval.node = CreateBoolTreeNode(N_not, yyvsp[0].node, NULL); }573 break;574 case 8:575 #line 89 "bool_parser.y"576 { yyval.node = CreateBoolTreeNode(N_and, yyvsp[-2].node, yyvsp[0].node); }577 break;578 case 9:579 #line 90 "bool_parser.y"580 { yyval.node = CreateBoolTreeNode(N_and, yyvsp[-1].node, yyvsp[0].node); }581 break;582 case 11:583 #line 94 "bool_parser.y"584 { yyval.node = CreateBoolTreeNode(N_or, yyvsp[-2].node, yyvsp[0].node); }585 break;586 #line 584 "y.tab.c"587 }588 yyssp -= yym;589 yystate = *yyssp;590 yyvsp -= yym;591 yym = yylhs[yyn];592 if (yystate == 0 && yym == 0)593 {594 #if YYDEBUG595 if (yydebug)596 printf("%sdebug: after reduction, shifting from state 0 to\597 state %d\n", YYPREFIX, YYFINAL);598 #endif599 yystate = YYFINAL;600 *++yyssp = YYFINAL;601 *++yyvsp = yyval;602 if (yychar < 0)603 {604 if ((yychar = yylex()) < 0) yychar = 0;605 #if YYDEBUG606 if (yydebug)607 {608 yys = 0;609 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];610 if (!yys) yys = "illegal-symbol";611 printf("%sdebug: state %d, reading %d (%s)\n",612 YYPREFIX, YYFINAL, yychar, yys);613 }614 #endif615 }616 if (yychar == 0) goto yyaccept;617 goto yyloop;618 }619 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&620 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)621 yystate = yytable[yyn];622 else623 yystate = yydgoto[yym];624 #if YYDEBUG625 if (yydebug)626 printf("%sdebug: after reduction, shifting from state %d \627 to state %d\n", YYPREFIX, *yyssp, yystate);628 #endif629 if (yyssp >= yyss + yystacksize - 1)630 {631 goto yyoverflow;632 }633 *++yyssp = yystate;634 *++yyvsp = yyval;635 goto yyloop;636 yyoverflow:637 yyerror("yacc stack overflow");638 yyabort:639 return (1);640 yyaccept:641 return (0);642 }643
Note:
See TracChangeset
for help on using the changeset viewer.