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