fooparser.cpp
00001 00002 /* A Bison parser, made from ./fooparser.y 00003 by GNU Bison version 1.28 */ 00004 00005 #define YYBISON 1 /* Identify Bison output. */ 00006 00007 #define yyparse kdeprint_foomatic2parse 00008 #define yylex kdeprint_foomatic2lex 00009 #define yyerror kdeprint_foomatic2error 00010 #define yylval kdeprint_foomatic2lval 00011 #define yychar kdeprint_foomatic2char 00012 #define yydebug kdeprint_foomatic2debug 00013 #define yynerrs kdeprint_foomatic2nerrs 00014 #define VAR 257 00015 #define STRING 258 00016 #define NUMBER 259 00017 #define UNDEF 260 00018 #define POSTPIPE 261 00019 #define QUOTED 262 00020 00021 #line 1 "./fooparser.y" 00022 00023 /* 00024 * This file is part of the KDE libraries 00025 * Copyright (c) 2001-2003 Michael Goffioul <kdeprint@swing.be> 00026 * 00027 * This library is free software; you can redistribute it and/or 00028 * modify it under the terms of the GNU Library General Public 00029 * License version 2 as published by the Free Software Foundation. 00030 * 00031 * This library is distributed in the hope that it will be useful, 00032 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00033 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00034 * Library General Public License for more details. 00035 * 00036 * You should have received a copy of the GNU Library General Public License 00037 * along with this library; see the file COPYING.LIB. If not, write to 00038 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00039 * Boston, MA 02110-1301, USA. 00040 **/ 00041 00042 #define YYSTYPE QVariant 00043 #define YYPARSE_PARAM fooloader 00044 #ifndef YYDEBUG 00045 #define YYDEBUG 1 00046 #endif 00047 00048 #include <stdlib.h> 00049 #include <qvariant.h> 00050 #include "foomatic2loader.h" 00051 00052 void yyerror(const char*) {} 00053 int yylex(); 00054 #ifndef YYSTYPE 00055 #define YYSTYPE int 00056 #endif 00057 #include <stdio.h> 00058 00059 #ifndef __cplusplus 00060 #ifndef __STDC__ 00061 #define const 00062 #endif 00063 #endif 00064 00065 00066 00067 #define YYFINAL 36 00068 #define YYFLAG -32768 00069 #define YYNTBASE 17 00070 00071 #define YYTRANSLATE(x) ((unsigned)(x) <= 262 ? yytranslate[x] : 23) 00072 00073 static const char yytranslate[] = { 0, 00074 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00075 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00076 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00077 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00078 2, 2, 2, 13, 2, 2, 2, 2, 2, 2, 00079 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, 00080 9, 14, 2, 2, 2, 2, 2, 2, 2, 2, 00081 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00082 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00083 15, 2, 16, 2, 2, 2, 2, 2, 2, 2, 00084 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00085 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00086 2, 2, 10, 2, 11, 2, 2, 2, 2, 2, 00087 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00088 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00089 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00090 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00091 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00092 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00093 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00094 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00095 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00096 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00097 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00098 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00099 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 00100 7, 8 00101 }; 00102 00103 #if YYDEBUG != 0 00104 static const short yyprhs[] = { 0, 00105 0, 2, 5, 12, 17, 19, 23, 28, 30, 34, 00106 36, 38, 40, 44, 48, 51 00107 }; 00108 00109 static const short yyrhs[] = { 18, 00110 0, 17, 18, 0, 3, 9, 10, 19, 11, 12, 00111 0, 7, 9, 8, 12, 0, 20, 0, 19, 13, 00112 20, 0, 4, 9, 14, 22, 0, 22, 0, 21, 00113 13, 22, 0, 6, 0, 4, 0, 5, 0, 15, 00114 21, 16, 0, 10, 19, 11, 0, 15, 16, 0, 00115 10, 11, 0 00116 }; 00117 00118 #endif 00119 00120 #if YYDEBUG != 0 00121 static const short yyrline[] = { 0, 00122 42, 43, 46, 47, 50, 51, 54, 57, 58, 61, 00123 62, 63, 64, 65, 66, 67 00124 }; 00125 #endif 00126 00127 00128 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) 00129 00130 static const char * const yytname[] = { "$","error","$undefined.","VAR","STRING", 00131 "NUMBER","UNDEF","POSTPIPE","QUOTED","'='","'{'","'}'","';'","','","'>'","'['", 00132 "']'","foo","foodata","fieldlist","assignment","valuelist","value", NULL 00133 }; 00134 #endif 00135 00136 static const short yyr1[] = { 0, 00137 17, 17, 18, 18, 19, 19, 20, 21, 21, 22, 00138 22, 22, 22, 22, 22, 22 00139 }; 00140 00141 static const short yyr2[] = { 0, 00142 1, 2, 6, 4, 1, 3, 4, 1, 3, 1, 00143 1, 1, 3, 3, 2, 2 00144 }; 00145 00146 static const short yydefact[] = { 0, 00147 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 00148 0, 5, 4, 0, 0, 0, 0, 3, 6, 11, 00149 12, 10, 0, 0, 7, 16, 0, 15, 0, 8, 00150 14, 0, 13, 9, 0, 0 00151 }; 00152 00153 static const short yydefgoto[] = { 3, 00154 4, 11, 12, 29, 25 00155 }; 00156 00157 static const short yypact[] = { 15, 00158 11, 20, 10,-32768, -2, 18,-32768, 27, 7, 23, 00159 14,-32768,-32768, 19, 22, 27, -1,-32768,-32768,-32768, 00160 -32768,-32768, 12, -4,-32768,-32768, 17,-32768, 8,-32768, 00161 -32768, -1,-32768,-32768, 35,-32768 00162 }; 00163 00164 static const short yypgoto[] = {-32768, 00165 33, 16, 21,-32768, -17 00166 }; 00167 00168 00169 #define YYLAST 39 00170 00171 00172 static const short yytable[] = { 20, 00173 21, 22, 20, 21, 22, 23, 30, 8, 23, 35, 00174 24, 28, 1, 24, 34, 10, 2, 1, 13, 5, 00175 32, 2, 26, 33, 15, 9, 16, 31, 6, 16, 00176 10, 14, 17, 18, 36, 7, 19, 0, 27 00177 }; 00178 00179 static const short yycheck[] = { 4, 00180 5, 6, 4, 5, 6, 10, 24, 10, 10, 0, 00181 15, 16, 3, 15, 32, 4, 7, 3, 12, 9, 00182 13, 7, 11, 16, 11, 8, 13, 11, 9, 13, 00183 4, 9, 14, 12, 0, 3, 16, -1, 23 00184 }; 00185 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 00186 #line 3 "/usr/lib/bison.simple" 00187 /* This file comes from bison-1.28. */ 00188 00189 /* Skeleton output parser for bison, 00190 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. 00191 00192 This program is free software; you can redistribute it and/or modify 00193 it under the terms of the GNU General Public License as published by 00194 the Free Software Foundation; either version 2, or (at your option) 00195 any later version. 00196 00197 This program is distributed in the hope that it will be useful, 00198 but WITHOUT ANY WARRANTY; without even the implied warranty of 00199 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00200 GNU General Public License for more details. 00201 00202 You should have received a copy of the GNU General Public License 00203 along with this program; if not, write to the Free Software 00204 Foundation, Inc., 51 Franklin Street, Fifth Floor, 00205 Boston, MA 02110-1301, USA. */ 00206 00207 /* As a special exception, when this file is copied by Bison into a 00208 Bison output file, you may use that output file without restriction. 00209 This special exception was added by the Free Software Foundation 00210 in version 1.24 of Bison. */ 00211 00212 /* This is the parser code that is written into each bison parser 00213 when the %semantic_parser declaration is not specified in the grammar. 00214 It was written by Richard Stallman by simplifying the hairy parser 00215 used when %semantic_parser is specified. */ 00216 00217 #ifndef YYSTACK_USE_ALLOCA 00218 #ifdef alloca 00219 #define YYSTACK_USE_ALLOCA 00220 #else /* alloca not defined */ 00221 #ifdef __GNUC__ 00222 #define YYSTACK_USE_ALLOCA 00223 #define alloca __builtin_alloca 00224 #else /* not GNU C. */ 00225 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) 00226 #define YYSTACK_USE_ALLOCA 00227 #include <alloca.h> 00228 #else /* not sparc */ 00229 /* We think this test detects Watcom and Microsoft C. */ 00230 /* This used to test MSDOS, but that is a bad idea 00231 since that symbol is in the user namespace. */ 00232 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) 00233 #if 0 /* No need for malloc.h, which pollutes the namespace; 00234 instead, just don't use alloca. */ 00235 #include <malloc.h> 00236 #endif 00237 #else /* not MSDOS, or __TURBOC__ */ 00238 #if defined(_AIX) 00239 /* I don't know what this was needed for, but it pollutes the namespace. 00240 So I turned it off. rms, 2 May 1997. */ 00241 /* #include <malloc.h> */ 00242 #pragma alloca 00243 #define YYSTACK_USE_ALLOCA 00244 #else /* not MSDOS, or __TURBOC__, or _AIX */ 00245 #if 0 00246 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, 00247 and on HPUX 10. Eventually we can turn this on. */ 00248 #define YYSTACK_USE_ALLOCA 00249 #define alloca __builtin_alloca 00250 #endif /* __hpux */ 00251 #endif 00252 #endif /* not _AIX */ 00253 #endif /* not MSDOS, or __TURBOC__ */ 00254 #endif /* not sparc */ 00255 #endif /* not GNU C */ 00256 #endif /* alloca not defined */ 00257 #endif /* YYSTACK_USE_ALLOCA not defined */ 00258 00259 #ifdef YYSTACK_USE_ALLOCA 00260 #define YYSTACK_ALLOC alloca 00261 #else 00262 #define YYSTACK_ALLOC malloc 00263 #endif 00264 00265 /* Note: there must be only one dollar sign in this file. 00266 It is replaced by the list of actions, each action 00267 as one case of the switch. */ 00268 00269 #define yyerrok (yyerrstatus = 0) 00270 #define yyclearin (yychar = YYEMPTY) 00271 #define YYEMPTY -2 00272 #define YYEOF 0 00273 #define YYACCEPT goto yyacceptlab 00274 #define YYABORT goto yyabortlab 00275 #define YYERROR goto yyerrlab1 00276 /* Like YYERROR except do call yyerror. 00277 This remains here temporarily to ease the 00278 transition to the new meaning of YYERROR, for GCC. 00279 Once GCC version 2 has supplanted version 1, this can go. */ 00280 #define YYFAIL goto yyerrlab 00281 #define YYRECOVERING() (!!yyerrstatus) 00282 #define YYBACKUP(token, value) \ 00283 do \ 00284 if (yychar == YYEMPTY && yylen == 1) \ 00285 { yychar = (token), yylval = (value); \ 00286 yychar1 = YYTRANSLATE (yychar); \ 00287 YYPOPSTACK; \ 00288 goto yybackup; \ 00289 } \ 00290 else \ 00291 { yyerror ("syntax error: cannot back up"); YYERROR; } \ 00292 while (0) 00293 00294 #define YYTERROR 1 00295 #define YYERRCODE 256 00296 00297 #ifndef YYPURE 00298 #define YYLEX yylex() 00299 #endif 00300 00301 #ifdef YYPURE 00302 #ifdef YYLSP_NEEDED 00303 #ifdef YYLEX_PARAM 00304 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) 00305 #else 00306 #define YYLEX yylex(&yylval, &yylloc) 00307 #endif 00308 #else /* not YYLSP_NEEDED */ 00309 #ifdef YYLEX_PARAM 00310 #define YYLEX yylex(&yylval, YYLEX_PARAM) 00311 #else 00312 #define YYLEX yylex(&yylval) 00313 #endif 00314 #endif /* not YYLSP_NEEDED */ 00315 #endif 00316 00317 /* If nonreentrant, generate the variables here */ 00318 00319 #ifndef YYPURE 00320 00321 int yychar; /* the lookahead symbol */ 00322 YYSTYPE yylval; /* the semantic value of the */ 00323 /* lookahead symbol */ 00324 00325 #ifdef YYLSP_NEEDED 00326 YYLTYPE yylloc; /* location data for the lookahead */ 00327 /* symbol */ 00328 #endif 00329 00330 int yynerrs; /* number of parse errors so far */ 00331 #endif /* not YYPURE */ 00332 00333 #if YYDEBUG != 0 00334 int yydebug; /* nonzero means print parse trace */ 00335 /* Since this is uninitialized, it does not stop multiple parsers 00336 from coexisting. */ 00337 #endif 00338 00339 /* YYINITDEPTH indicates the initial size of the parser's stacks */ 00340 00341 #ifndef YYINITDEPTH 00342 #define YYINITDEPTH 200 00343 #endif 00344 00345 /* YYMAXDEPTH is the maximum size the stacks can grow to 00346 (effective only if the built-in stack extension method is used). */ 00347 00348 #if YYMAXDEPTH == 0 00349 #undef YYMAXDEPTH 00350 #endif 00351 00352 #ifndef YYMAXDEPTH 00353 #define YYMAXDEPTH 10000 00354 #endif 00355 00356 /* Define __yy_memcpy. Note that the size argument 00357 should be passed with type unsigned int, because that is what the non-GCC 00358 definitions require. With GCC, __builtin_memcpy takes an arg 00359 of type size_t, but it can handle unsigned int. */ 00360 00361 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ 00362 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) 00363 #else /* not GNU C or C++ */ 00364 #ifndef __cplusplus 00365 00366 /* This is the most reliable way to avoid incompatibilities 00367 in available built-in functions on various systems. */ 00368 static void 00369 __yy_memcpy (to, from, count) 00370 char *to; 00371 char *from; 00372 unsigned int count; 00373 { 00374 register char *f = from; 00375 register char *t = to; 00376 register int i = count; 00377 00378 while (i-- > 0) 00379 *t++ = *f++; 00380 } 00381 00382 #else /* __cplusplus */ 00383 00384 /* This is the most reliable way to avoid incompatibilities 00385 in available built-in functions on various systems. */ 00386 static void 00387 __yy_memcpy (char *to, char *from, unsigned int count) 00388 { 00389 register char *t = to; 00390 register char *f = from; 00391 register int i = count; 00392 00393 while (i-- > 0) 00394 *t++ = *f++; 00395 } 00396 00397 #endif 00398 #endif 00399 00400 #line 217 "/usr/lib/bison.simple" 00401 00402 /* The user can define YYPARSE_PARAM as the name of an argument to be passed 00403 into yyparse. The argument should have type void *. 00404 It should actually point to an object. 00405 Grammar actions can access the variable by casting it 00406 to the proper pointer type. */ 00407 00408 #ifdef YYPARSE_PARAM 00409 #ifdef __cplusplus 00410 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 00411 #define YYPARSE_PARAM_DECL 00412 #else /* not __cplusplus */ 00413 #define YYPARSE_PARAM_ARG YYPARSE_PARAM 00414 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 00415 #endif /* not __cplusplus */ 00416 #else /* not YYPARSE_PARAM */ 00417 #define YYPARSE_PARAM_ARG 00418 #define YYPARSE_PARAM_DECL 00419 #endif /* not YYPARSE_PARAM */ 00420 00421 /* Prevent warning if -Wstrict-prototypes. */ 00422 #ifdef __GNUC__ 00423 #ifdef YYPARSE_PARAM 00424 int yyparse (void *); 00425 #else 00426 int yyparse (void); 00427 #endif 00428 #endif 00429 00430 int 00431 yyparse(YYPARSE_PARAM_ARG) 00432 YYPARSE_PARAM_DECL 00433 { 00434 register int yystate; 00435 register int yyn; 00436 register short *yyssp; 00437 register YYSTYPE *yyvsp; 00438 int yyerrstatus; /* number of tokens to shift before error messages enabled */ 00439 int yychar1 = 0; /* lookahead token as an internal (translated) token number */ 00440 00441 short yyssa[YYINITDEPTH]; /* the state stack */ 00442 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ 00443 00444 short *yyss = yyssa; /* refer to the stacks thru separate pointers */ 00445 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ 00446 00447 #ifdef YYLSP_NEEDED 00448 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ 00449 YYLTYPE *yyls = yylsa; 00450 YYLTYPE *yylsp; 00451 00452 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 00453 #else 00454 #define YYPOPSTACK (yyvsp--, yyssp--) 00455 #endif 00456 00457 int yystacksize = YYINITDEPTH; 00458 int yyfree_stacks = 0; 00459 00460 #ifdef YYPURE 00461 int yychar; 00462 YYSTYPE yylval; 00463 int yynerrs; 00464 #ifdef YYLSP_NEEDED 00465 YYLTYPE yylloc; 00466 #endif 00467 #endif 00468 00469 YYSTYPE yyval; /* the variable used to return */ 00470 /* semantic values from the action */ 00471 /* routines */ 00472 00473 int yylen; 00474 00475 #if YYDEBUG != 0 00476 if (yydebug) 00477 fprintf(stderr, "Starting parse\n"); 00478 #endif 00479 00480 yystate = 0; 00481 yyerrstatus = 0; 00482 yynerrs = 0; 00483 yychar = YYEMPTY; /* Cause a token to be read. */ 00484 00485 /* Initialize stack pointers. 00486 Waste one element of value and location stack 00487 so that they stay on the same level as the state stack. 00488 The wasted elements are never initialized. */ 00489 00490 yyssp = yyss - 1; 00491 yyvsp = yyvs; 00492 #ifdef YYLSP_NEEDED 00493 yylsp = yyls; 00494 #endif 00495 00496 /* Push a new state, which is found in yystate . */ 00497 /* In all cases, when you get here, the value and location stacks 00498 have just been pushed. so pushing a state here evens the stacks. */ 00499 yynewstate: 00500 00501 *++yyssp = yystate; 00502 00503 if (yyssp >= yyss + yystacksize - 1) 00504 { 00505 /* Give user a chance to reallocate the stack */ 00506 /* Use copies of these so that the &'s don't force the real ones into memory. */ 00507 YYSTYPE *yyvs1 = yyvs; 00508 short *yyss1 = yyss; 00509 #ifdef YYLSP_NEEDED 00510 YYLTYPE *yyls1 = yyls; 00511 #endif 00512 00513 /* Get the current used size of the three stacks, in elements. */ 00514 int size = yyssp - yyss + 1; 00515 00516 #ifdef yyoverflow 00517 /* Each stack pointer address is followed by the size of 00518 the data in use in that stack, in bytes. */ 00519 #ifdef YYLSP_NEEDED 00520 /* This used to be a conditional around just the two extra args, 00521 but that might be undefined if yyoverflow is a macro. */ 00522 yyoverflow("parser stack overflow", 00523 &yyss1, size * sizeof (*yyssp), 00524 &yyvs1, size * sizeof (*yyvsp), 00525 &yyls1, size * sizeof (*yylsp), 00526 &yystacksize); 00527 #else 00528 yyoverflow("parser stack overflow", 00529 &yyss1, size * sizeof (*yyssp), 00530 &yyvs1, size * sizeof (*yyvsp), 00531 &yystacksize); 00532 #endif 00533 00534 yyss = yyss1; yyvs = yyvs1; 00535 #ifdef YYLSP_NEEDED 00536 yyls = yyls1; 00537 #endif 00538 #else /* no yyoverflow */ 00539 /* Extend the stack our own way. */ 00540 if (yystacksize >= YYMAXDEPTH) 00541 { 00542 yyerror("parser stack overflow"); 00543 if (yyfree_stacks) 00544 { 00545 free (yyss); 00546 free (yyvs); 00547 #ifdef YYLSP_NEEDED 00548 free (yyls); 00549 #endif 00550 } 00551 return 2; 00552 } 00553 yystacksize *= 2; 00554 if (yystacksize > YYMAXDEPTH) 00555 yystacksize = YYMAXDEPTH; 00556 #ifndef YYSTACK_USE_ALLOCA 00557 yyfree_stacks = 1; 00558 #endif 00559 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); 00560 __yy_memcpy ((char *)yyss, (char *)yyss1, 00561 size * (unsigned int) sizeof (*yyssp)); 00562 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); 00563 __yy_memcpy ((char *)yyvs, (char *)yyvs1, 00564 size * (unsigned int) sizeof (*yyvsp)); 00565 #ifdef YYLSP_NEEDED 00566 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); 00567 __yy_memcpy ((char *)yyls, (char *)yyls1, 00568 size * (unsigned int) sizeof (*yylsp)); 00569 #endif 00570 #endif /* no yyoverflow */ 00571 00572 yyssp = yyss + size - 1; 00573 yyvsp = yyvs + size - 1; 00574 #ifdef YYLSP_NEEDED 00575 yylsp = yyls + size - 1; 00576 #endif 00577 00578 #if YYDEBUG != 0 00579 if (yydebug) 00580 fprintf(stderr, "Stack size increased to %d\n", yystacksize); 00581 #endif 00582 00583 if (yyssp >= yyss + yystacksize - 1) 00584 YYABORT; 00585 } 00586 00587 #if YYDEBUG != 0 00588 if (yydebug) 00589 fprintf(stderr, "Entering state %d\n", yystate); 00590 #endif 00591 00592 goto yybackup; 00593 yybackup: 00594 00595 /* Do appropriate processing given the current state. */ 00596 /* Read a lookahead token if we need one and don't already have one. */ 00597 /* yyresume: */ 00598 00599 /* First try to decide what to do without reference to lookahead token. */ 00600 00601 yyn = yypact[yystate]; 00602 if (yyn == YYFLAG) 00603 goto yydefault; 00604 00605 /* Not known => get a lookahead token if don't already have one. */ 00606 00607 /* yychar is either YYEMPTY or YYEOF 00608 or a valid token in external form. */ 00609 00610 if (yychar == YYEMPTY) 00611 { 00612 #if YYDEBUG != 0 00613 if (yydebug) 00614 fprintf(stderr, "Reading a token: "); 00615 #endif 00616 yychar = YYLEX; 00617 } 00618 00619 /* Convert token to internal form (in yychar1) for indexing tables with */ 00620 00621 if (yychar <= 0) /* This means end of input. */ 00622 { 00623 yychar1 = 0; 00624 yychar = YYEOF; /* Don't call YYLEX any more */ 00625 00626 #if YYDEBUG != 0 00627 if (yydebug) 00628 fprintf(stderr, "Now at end of input.\n"); 00629 #endif 00630 } 00631 else 00632 { 00633 yychar1 = YYTRANSLATE(yychar); 00634 00635 #if YYDEBUG != 0 00636 if (yydebug) 00637 { 00638 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); 00639 /* Give the individual parser a way to print the precise meaning 00640 of a token, for further debugging info. */ 00641 #ifdef YYPRINT 00642 YYPRINT (stderr, yychar, yylval); 00643 #endif 00644 fprintf (stderr, ")\n"); 00645 } 00646 #endif 00647 } 00648 00649 yyn += yychar1; 00650 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 00651 goto yydefault; 00652 00653 yyn = yytable[yyn]; 00654 00655 /* yyn is what to do for this token type in this state. 00656 Negative => reduce, -yyn is rule number. 00657 Positive => shift, yyn is new state. 00658 New state is final state => don't bother to shift, 00659 just return success. 00660 0, or most negative number => error. */ 00661 00662 if (yyn < 0) 00663 { 00664 if (yyn == YYFLAG) 00665 goto yyerrlab; 00666 yyn = -yyn; 00667 goto yyreduce; 00668 } 00669 else if (yyn == 0) 00670 goto yyerrlab; 00671 00672 if (yyn == YYFINAL) 00673 YYACCEPT; 00674 00675 /* Shift the lookahead token. */ 00676 00677 #if YYDEBUG != 0 00678 if (yydebug) 00679 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); 00680 #endif 00681 00682 /* Discard the token being shifted unless it is eof. */ 00683 if (yychar != YYEOF) 00684 yychar = YYEMPTY; 00685 00686 *++yyvsp = yylval; 00687 #ifdef YYLSP_NEEDED 00688 *++yylsp = yylloc; 00689 #endif 00690 00691 /* count tokens shifted since error; after three, turn off error status. */ 00692 if (yyerrstatus) yyerrstatus--; 00693 00694 yystate = yyn; 00695 goto yynewstate; 00696 00697 /* Do the default action for the current state. */ 00698 yydefault: 00699 00700 yyn = yydefact[yystate]; 00701 if (yyn == 0) 00702 goto yyerrlab; 00703 00704 /* Do a reduction. yyn is the number of a rule to reduce with. */ 00705 yyreduce: 00706 yylen = yyr2[yyn]; 00707 if (yylen > 0) 00708 yyval = yyvsp[1-yylen]; /* implement default value of the action */ 00709 00710 #if YYDEBUG != 0 00711 if (yydebug) 00712 { 00713 int i; 00714 00715 fprintf (stderr, "Reducing via rule %d (line %d), ", 00716 yyn, yyrline[yyn]); 00717 00718 /* Print the symbols being reduced, and their result. */ 00719 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) 00720 fprintf (stderr, "%s ", yytname[yyrhs[i]]); 00721 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); 00722 } 00723 #endif 00724 00725 00726 switch (yyn) { 00727 00728 case 3: 00729 #line 46 "./fooparser.y" 00730 { static_cast<Foomatic2Loader*>(fooloader)->m_foodata.insert("VAR",yyvsp[-2]); ; 00731 break;} 00732 case 4: 00733 #line 47 "./fooparser.y" 00734 { static_cast<Foomatic2Loader*>(fooloader)->m_foodata.insert("POSTPIPE",yyvsp[-1]); ; 00735 break;} 00736 case 5: 00737 #line 50 "./fooparser.y" 00738 { yyval = yyvsp[0]; ; 00739 break;} 00740 case 6: 00741 #line 51 "./fooparser.y" 00742 { QMap<QString,QVariant>::ConstIterator it = yyvsp[0].mapBegin(); yyvsp[-2].asMap().insert(it.key(), it.data()); yyval = yyvsp[-2]; ; 00743 break;} 00744 case 7: 00745 #line 54 "./fooparser.y" 00746 { yyval.asMap().insert(yyvsp[-3].toString(), yyvsp[0]); ; 00747 break;} 00748 case 8: 00749 #line 57 "./fooparser.y" 00750 { yyval.asList().append(yyvsp[0]); ; 00751 break;} 00752 case 9: 00753 #line 58 "./fooparser.y" 00754 { yyvsp[-2].asList().append(yyvsp[0]); yyval = yyvsp[-2]; ; 00755 break;} 00756 case 10: 00757 #line 61 "./fooparser.y" 00758 { yyval = QVariant(); ; 00759 break;} 00760 case 11: 00761 #line 62 "./fooparser.y" 00762 { yyval = yyvsp[0]; ; 00763 break;} 00764 case 12: 00765 #line 63 "./fooparser.y" 00766 { yyval = yyvsp[0]; ; 00767 break;} 00768 case 13: 00769 #line 64 "./fooparser.y" 00770 { yyval = yyvsp[-1]; ; 00771 break;} 00772 case 14: 00773 #line 65 "./fooparser.y" 00774 { yyval = yyvsp[-1]; ; 00775 break;} 00776 case 15: 00777 #line 66 "./fooparser.y" 00778 { yyval = QVariant(); ; 00779 break;} 00780 case 16: 00781 #line 67 "./fooparser.y" 00782 { yyval = QVariant(); ; 00783 break;} 00784 } 00785 /* the action file gets copied in in place of this dollarsign */ 00786 #line 543 "/usr/lib/bison.simple" 00787 00788 yyvsp -= yylen; 00789 yyssp -= yylen; 00790 #ifdef YYLSP_NEEDED 00791 yylsp -= yylen; 00792 #endif 00793 00794 #if YYDEBUG != 0 00795 if (yydebug) 00796 { 00797 short *ssp1 = yyss - 1; 00798 fprintf (stderr, "state stack now"); 00799 while (ssp1 != yyssp) 00800 fprintf (stderr, " %d", *++ssp1); 00801 fprintf (stderr, "\n"); 00802 } 00803 #endif 00804 00805 *++yyvsp = yyval; 00806 00807 #ifdef YYLSP_NEEDED 00808 yylsp++; 00809 if (yylen == 0) 00810 { 00811 yylsp->first_line = yylloc.first_line; 00812 yylsp->first_column = yylloc.first_column; 00813 yylsp->last_line = (yylsp-1)->last_line; 00814 yylsp->last_column = (yylsp-1)->last_column; 00815 yylsp->text = 0; 00816 } 00817 else 00818 { 00819 yylsp->last_line = (yylsp+yylen-1)->last_line; 00820 yylsp->last_column = (yylsp+yylen-1)->last_column; 00821 } 00822 #endif 00823 00824 /* Now "shift" the result of the reduction. 00825 Determine what state that goes to, 00826 based on the state we popped back to 00827 and the rule number reduced by. */ 00828 00829 yyn = yyr1[yyn]; 00830 00831 yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 00832 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 00833 yystate = yytable[yystate]; 00834 else 00835 yystate = yydefgoto[yyn - YYNTBASE]; 00836 00837 goto yynewstate; 00838 00839 yyerrlab: /* here on detecting error */ 00840 00841 if (! yyerrstatus) 00842 /* If not already recovering from an error, report this error. */ 00843 { 00844 ++yynerrs; 00845 00846 #ifdef YYERROR_VERBOSE 00847 yyn = yypact[yystate]; 00848 00849 if (yyn > YYFLAG && yyn < YYLAST) 00850 { 00851 int size = 0; 00852 char *msg; 00853 int x, count; 00854 00855 count = 0; 00856 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ 00857 for (x = (yyn < 0 ? -yyn : 0); 00858 x < (sizeof(yytname) / sizeof(char *)); x++) 00859 if (yycheck[x + yyn] == x) 00860 size += strlen(yytname[x]) + 15, count++; 00861 msg = (char *) malloc(size + 15); 00862 if (msg != 0) 00863 { 00864 strcpy(msg, "parse error"); 00865 00866 if (count < 5) 00867 { 00868 count = 0; 00869 for (x = (yyn < 0 ? -yyn : 0); 00870 x < (sizeof(yytname) / sizeof(char *)); x++) 00871 if (yycheck[x + yyn] == x) 00872 { 00873 strcat(msg, count == 0 ? ", expecting `" : " or `"); 00874 strcat(msg, yytname[x]); 00875 strcat(msg, "'"); 00876 count++; 00877 } 00878 } 00879 yyerror(msg); 00880 free(msg); 00881 } 00882 else 00883 yyerror ("parse error; also virtual memory exceeded"); 00884 } 00885 else 00886 #endif /* YYERROR_VERBOSE */ 00887 yyerror("parse error"); 00888 } 00889 00890 goto yyerrlab1; 00891 yyerrlab1: /* here on error raised explicitly by an action */ 00892 00893 if (yyerrstatus == 3) 00894 { 00895 /* if just tried and failed to reuse lookahead token after an error, discard it. */ 00896 00897 /* return failure if at end of input */ 00898 if (yychar == YYEOF) 00899 YYABORT; 00900 00901 #if YYDEBUG != 0 00902 if (yydebug) 00903 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); 00904 #endif 00905 00906 yychar = YYEMPTY; 00907 } 00908 00909 /* Else will try to reuse lookahead token 00910 after shifting the error token. */ 00911 00912 yyerrstatus = 3; /* Each real token shifted decrements this */ 00913 00914 goto yyerrhandle; 00915 00916 yyerrdefault: /* current state does not do anything special for the error token. */ 00917 00918 #if 0 00919 /* This is wrong; only states that explicitly want error tokens 00920 should shift them. */ 00921 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ 00922 if (yyn) goto yydefault; 00923 #endif 00924 00925 yyerrpop: /* pop the current state because it cannot handle the error token */ 00926 00927 if (yyssp == yyss) YYABORT; 00928 yyvsp--; 00929 yystate = *--yyssp; 00930 #ifdef YYLSP_NEEDED 00931 yylsp--; 00932 #endif 00933 00934 #if YYDEBUG != 0 00935 if (yydebug) 00936 { 00937 short *ssp1 = yyss - 1; 00938 fprintf (stderr, "Error: state stack now"); 00939 while (ssp1 != yyssp) 00940 fprintf (stderr, " %d", *++ssp1); 00941 fprintf (stderr, "\n"); 00942 } 00943 #endif 00944 00945 yyerrhandle: 00946 00947 yyn = yypact[yystate]; 00948 if (yyn == YYFLAG) 00949 goto yyerrdefault; 00950 00951 yyn += YYTERROR; 00952 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 00953 goto yyerrdefault; 00954 00955 yyn = yytable[yyn]; 00956 if (yyn < 0) 00957 { 00958 if (yyn == YYFLAG) 00959 goto yyerrpop; 00960 yyn = -yyn; 00961 goto yyreduce; 00962 } 00963 else if (yyn == 0) 00964 goto yyerrpop; 00965 00966 if (yyn == YYFINAL) 00967 YYACCEPT; 00968 00969 #if YYDEBUG != 0 00970 if (yydebug) 00971 fprintf(stderr, "Shifting error token, "); 00972 #endif 00973 00974 *++yyvsp = yylval; 00975 #ifdef YYLSP_NEEDED 00976 *++yylsp = yylloc; 00977 #endif 00978 00979 yystate = yyn; 00980 goto yynewstate; 00981 00982 yyacceptlab: 00983 /* YYACCEPT comes here. */ 00984 if (yyfree_stacks) 00985 { 00986 free (yyss); 00987 free (yyvs); 00988 #ifdef YYLSP_NEEDED 00989 free (yyls); 00990 #endif 00991 } 00992 return 0; 00993 00994 yyabortlab: 00995 /* YYABORT comes here. */ 00996 if (yyfree_stacks) 00997 { 00998 free (yyss); 00999 free (yyvs); 01000 #ifdef YYLSP_NEEDED 01001 free (yyls); 01002 #endif 01003 } 01004 return 1; 01005 } 01006 #line 70 "./fooparser.y" 01007