Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

dotty_parser.cc

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 1.875c.  */
00002 
00003 /* Skeleton parser for Yacc-like parsing with Bison,
00004    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.  */
00020 
00021 /* As a special exception, when this file is copied by Bison into a
00022    Bison output file, you may use that output file without restriction.
00023    This special exception was added by the Free Software Foundation
00024    in version 1.24 of Bison.  */
00025 
00026 /* Written by Richard Stallman by simplifying the original so called
00027    ``semantic'' parser.  */
00028 
00029 /* All symbols defined below should begin with yy or YY, to avoid
00030    infringing on user name space.  This should be done even for local
00031    variables, as they might otherwise be expanded by user macros.
00032    There are some unavoidable exceptions within include files to
00033    define necessary library symbols; they are noted "INFRINGES ON
00034    USER NAME SPACE" below.  */
00035 
00036 /* Identify Bison output.  */
00037 #define YYBISON 1
00038 
00039 /* Skeleton name.  */
00040 #define YYSKELETON_NAME "yacc.c"
00041 
00042 /* Pure parsers.  */
00043 #define YYPURE 0
00044 
00045 /* Using locations.  */
00046 #define YYLSP_NEEDED 0
00047 
00048 
00049 
00050 /* Tokens.  */
00051 #ifndef YYTOKENTYPE
00052 # define YYTOKENTYPE
00053    /* Put the tokens into the symbol table, so that GDB and other debuggers
00054       know about them.  */
00055    enum yytokentype {
00056      INTEGER = 258,
00057      STRING = 259
00058    };
00059 #endif
00060 #define INTEGER 258
00061 #define STRING 259
00062 
00063 
00064 
00065 
00066 /* Copy the first part of user declarations.  */
00067 #line 11 "dotty_parser.y"
00068 
00069 /* $Id */
00070 #include <sys/types.h>
00071 #include "dotdefs.h"
00072 #include <stdio.h>
00073 #include <iostream>
00074 
00075 using std::ostream;
00076 using std::cerr;
00077 using std::endl;
00078 
00079 int yylineno = 1;
00080 int yyprev = 0;
00081 int yyerrors = 0;
00082 const char* yyfilename = "";
00083 
00084 void yyerror(char*);
00085 int yylex();
00086 
00087 static ostream* g_errorStream = &cerr;
00088 
00089 
00090 
00091 /* Enabling traces.  */
00092 #ifndef YYDEBUG
00093 # define YYDEBUG 0
00094 #endif
00095 
00096 /* Enabling verbose error messages.  */
00097 #ifdef YYERROR_VERBOSE
00098 # undef YYERROR_VERBOSE
00099 # define YYERROR_VERBOSE 1
00100 #else
00101 # define YYERROR_VERBOSE 0
00102 #endif
00103 
00104 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
00105 #line 34 "dotty_parser.y"
00106 typedef union YYSTYPE {
00107   int n;
00108   char* s;
00109 } YYSTYPE;
00110 /* Line 191 of yacc.c.  */
00111 #line 112 "y.tab.c"
00112 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00113 # define YYSTYPE_IS_DECLARED 1
00114 # define YYSTYPE_IS_TRIVIAL 1
00115 #endif
00116 
00117 
00118 
00119 /* Copy the second part of user declarations.  */
00120 
00121 
00122 /* Line 214 of yacc.c.  */
00123 #line 124 "y.tab.c"
00124 
00125 #if ! defined (yyoverflow) || YYERROR_VERBOSE
00126 
00127 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00128 
00129 # ifdef YYSTACK_USE_ALLOCA
00130 #  if YYSTACK_USE_ALLOCA
00131 #   define YYSTACK_ALLOC alloca
00132 #  endif
00133 # else
00134 #  if defined (alloca) || defined (_ALLOCA_H)
00135 #   define YYSTACK_ALLOC alloca
00136 #  else
00137 #   ifdef __GNUC__
00138 #    define YYSTACK_ALLOC __builtin_alloca
00139 #   endif
00140 #  endif
00141 # endif
00142 
00143 # ifdef YYSTACK_ALLOC
00144    /* Pacify GCC's `empty if-body' warning. */
00145 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
00146 # else
00147 #  if defined (__STDC__) || defined (__cplusplus)
00148 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00149 #   define YYSIZE_T size_t
00150 #  endif
00151 #  define YYSTACK_ALLOC malloc
00152 #  define YYSTACK_FREE free
00153 # endif
00154 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
00155 
00156 
00157 #if (! defined (yyoverflow) \
00158      && (! defined (__cplusplus) \
00159          || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
00160 
00161 /* A type that is properly aligned for any stack member.  */
00162 union yyalloc
00163 {
00164   short yyss;
00165   YYSTYPE yyvs;
00166   };
00167 
00168 /* The size of the maximum gap between one aligned stack and the next.  */
00169 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00170 
00171 /* The size of an array large to enough to hold all stacks, each with
00172    N elements.  */
00173 # define YYSTACK_BYTES(N) \
00174      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
00175       + YYSTACK_GAP_MAXIMUM)
00176 
00177 /* Copy COUNT objects from FROM to TO.  The source and destination do
00178    not overlap.  */
00179 # ifndef YYCOPY
00180 #  if defined (__GNUC__) && 1 < __GNUC__
00181 #   define YYCOPY(To, From, Count) \
00182       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00183 #  else
00184 #   define YYCOPY(To, From, Count)              \
00185       do                                        \
00186         {                                       \
00187           register YYSIZE_T yyi;                \
00188           for (yyi = 0; yyi < (Count); yyi++)   \
00189             (To)[yyi] = (From)[yyi];            \
00190         }                                       \
00191       while (0)
00192 #  endif
00193 # endif
00194 
00195 /* Relocate STACK from its old location to the new one.  The
00196    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00197    elements in the stack, and YYPTR gives the new location of the
00198    stack.  Advance YYPTR to a properly aligned location for the next
00199    stack.  */
00200 # define YYSTACK_RELOCATE(Stack)                                        \
00201     do                                                                  \
00202       {                                                                 \
00203         YYSIZE_T yynewbytes;                                            \
00204         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
00205         Stack = &yyptr->Stack;                                          \
00206         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00207         yyptr += yynewbytes / sizeof (*yyptr);                          \
00208       }                                                                 \
00209     while (0)
00210 
00211 #endif
00212 
00213 #if defined (__STDC__) || defined (__cplusplus)
00214    typedef signed char yysigned_char;
00215 #else
00216    typedef short yysigned_char;
00217 #endif
00218 
00219 /* YYFINAL -- State number of the termination state. */
00220 #define YYFINAL  2
00221 /* YYLAST -- Last index in YYTABLE.  */
00222 #define YYLAST   6
00223 
00224 /* YYNTOKENS -- Number of terminals. */
00225 #define YYNTOKENS  6
00226 /* YYNNTS -- Number of nonterminals. */
00227 #define YYNNTS  3
00228 /* YYNRULES -- Number of rules. */
00229 #define YYNRULES  5
00230 /* YYNRULES -- Number of states. */
00231 #define YYNSTATES  8
00232 
00233 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00234 #define YYUNDEFTOK  2
00235 #define YYMAXUTOK   259
00236 
00237 #define YYTRANSLATE(YYX)                                                \
00238   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00239 
00240 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00241 static const unsigned char yytranslate[] =
00242 {
00243        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00244        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00245        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00246        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00247        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00248        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00249        2,     5,     2,     2,     2,     2,     2,     2,     2,     2,
00250        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00251        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00252        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00253        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00254        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00255        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00256        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00257        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00258        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00259        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00260        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00261        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00262        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00263        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00264        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00265        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00266        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00267        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00268        2,     2,     2,     2,     2,     2,     1,     2,     3,     4
00269 };
00270 
00271 #if YYDEBUG
00272 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00273    YYRHS.  */
00274 static const unsigned char yyprhs[] =
00275 {
00276        0,     0,     3,     4,     7,    11
00277 };
00278 
00279 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
00280 static const yysigned_char yyrhs[] =
00281 {
00282        7,     0,    -1,    -1,     7,     8,    -1,     4,     5,     4,
00283       -1,     4,     5,     3,    -1
00284 };
00285 
00286 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00287 static const unsigned char yyrline[] =
00288 {
00289        0,    43,    43,    44,    47,    49
00290 };
00291 #endif
00292 
00293 #if YYDEBUG || YYERROR_VERBOSE
00294 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00295    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
00296 static const char *const yytname[] =
00297 {
00298   "$end", "error", "$undefined", "INTEGER", "STRING", "'='", "$accept",
00299   "input", "option", 0
00300 };
00301 #endif
00302 
00303 # ifdef YYPRINT
00304 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00305    token YYLEX-NUM.  */
00306 static const unsigned short yytoknum[] =
00307 {
00308        0,   256,   257,   258,   259,    61
00309 };
00310 # endif
00311 
00312 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00313 static const unsigned char yyr1[] =
00314 {
00315        0,     6,     7,     7,     8,     8
00316 };
00317 
00318 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00319 static const unsigned char yyr2[] =
00320 {
00321        0,     2,     0,     2,     3,     3
00322 };
00323 
00324 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
00325    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
00326    means the default is an error.  */
00327 static const unsigned char yydefact[] =
00328 {
00329        2,     0,     1,     0,     3,     0,     5,     4
00330 };
00331 
00332 /* YYDEFGOTO[NTERM-NUM]. */
00333 static const yysigned_char yydefgoto[] =
00334 {
00335       -1,     1,     4
00336 };
00337 
00338 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00339    STATE-NUM.  */
00340 #define YYPACT_NINF -3
00341 static const yysigned_char yypact[] =
00342 {
00343       -3,     0,    -3,     1,    -3,    -2,    -3,    -3
00344 };
00345 
00346 /* YYPGOTO[NTERM-NUM].  */
00347 static const yysigned_char yypgoto[] =
00348 {
00349       -3,    -3,    -3
00350 };
00351 
00352 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00353    positive, shift that token.  If negative, reduce the rule which
00354    number is the opposite.  If zero, do what YYDEFACT says.
00355    If YYTABLE_NINF, syntax error.  */
00356 #define YYTABLE_NINF -1
00357 static const unsigned char yytable[] =
00358 {
00359        2,     6,     7,     0,     3,     0,     5
00360 };
00361 
00362 static const yysigned_char yycheck[] =
00363 {
00364        0,     3,     4,    -1,     4,    -1,     5
00365 };
00366 
00367 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
00368    symbol of state STATE-NUM.  */
00369 static const unsigned char yystos[] =
00370 {
00371        0,     7,     0,     4,     8,     5,     3,     4
00372 };
00373 
00374 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
00375 # define YYSIZE_T __SIZE_TYPE__
00376 #endif
00377 #if ! defined (YYSIZE_T) && defined (size_t)
00378 # define YYSIZE_T size_t
00379 #endif
00380 #if ! defined (YYSIZE_T)
00381 # if defined (__STDC__) || defined (__cplusplus)
00382 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00383 #  define YYSIZE_T size_t
00384 # endif
00385 #endif
00386 #if ! defined (YYSIZE_T)
00387 # define YYSIZE_T unsigned int
00388 #endif
00389 
00390 #define yyerrok         (yyerrstatus = 0)
00391 #define yyclearin       (yychar = YYEMPTY)
00392 #define YYEMPTY         (-2)
00393 #define YYEOF           0
00394 
00395 #define YYACCEPT        goto yyacceptlab
00396 #define YYABORT         goto yyabortlab
00397 #define YYERROR         goto yyerrorlab
00398 
00399 
00400 /* Like YYERROR except do call yyerror.  This remains here temporarily
00401    to ease the transition to the new meaning of YYERROR, for GCC.
00402    Once GCC version 2 has supplanted version 1, this can go.  */
00403 
00404 #define YYFAIL          goto yyerrlab
00405 
00406 #define YYRECOVERING()  (!!yyerrstatus)
00407 
00408 #define YYBACKUP(Token, Value)                                  \
00409 do                                                              \
00410   if (yychar == YYEMPTY && yylen == 1)                          \
00411     {                                                           \
00412       yychar = (Token);                                         \
00413       yylval = (Value);                                         \
00414       yytoken = YYTRANSLATE (yychar);                           \
00415       YYPOPSTACK;                                               \
00416       goto yybackup;                                            \
00417     }                                                           \
00418   else                                                          \
00419     {                                                           \
00420       yyerror ("syntax error: cannot back up");\
00421       YYERROR;                                                  \
00422     }                                                           \
00423 while (0)
00424 
00425 #define YYTERROR        1
00426 #define YYERRCODE       256
00427 
00428 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
00429    are run).  */
00430 
00431 #ifndef YYLLOC_DEFAULT
00432 # define YYLLOC_DEFAULT(Current, Rhs, N)                \
00433    ((Current).first_line   = (Rhs)[1].first_line,       \
00434     (Current).first_column = (Rhs)[1].first_column,     \
00435     (Current).last_line    = (Rhs)[N].last_line,        \
00436     (Current).last_column  = (Rhs)[N].last_column)
00437 #endif
00438 
00439 /* YYLEX -- calling `yylex' with the right arguments.  */
00440 
00441 #ifdef YYLEX_PARAM
00442 # define YYLEX yylex (YYLEX_PARAM)
00443 #else
00444 # define YYLEX yylex ()
00445 #endif
00446 
00447 /* Enable debugging if requested.  */
00448 #if YYDEBUG
00449 
00450 # ifndef YYFPRINTF
00451 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00452 #  define YYFPRINTF fprintf
00453 # endif
00454 
00455 # define YYDPRINTF(Args)                        \
00456 do {                                            \
00457   if (yydebug)                                  \
00458     YYFPRINTF Args;                             \
00459 } while (0)
00460 
00461 # define YYDSYMPRINT(Args)                      \
00462 do {                                            \
00463   if (yydebug)                                  \
00464     yysymprint Args;                            \
00465 } while (0)
00466 
00467 # define YYDSYMPRINTF(Title, Token, Value, Location)            \
00468 do {                                                            \
00469   if (yydebug)                                                  \
00470     {                                                           \
00471       YYFPRINTF (stderr, "%s ", Title);                         \
00472       yysymprint (stderr,                                       \
00473                   Token, Value);        \
00474       YYFPRINTF (stderr, "\n");                                 \
00475     }                                                           \
00476 } while (0)
00477 
00478 /*------------------------------------------------------------------.
00479 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
00480 | TOP (included).                                                   |
00481 `------------------------------------------------------------------*/
00482 
00483 #if defined (__STDC__) || defined (__cplusplus)
00484 static void
00485 yy_stack_print (short *bottom, short *top)
00486 #else
00487 static void
00488 yy_stack_print (bottom, top)
00489     short *bottom;
00490     short *top;
00491 #endif
00492 {
00493   YYFPRINTF (stderr, "Stack now");
00494   for (/* Nothing. */; bottom <= top; ++bottom)
00495     YYFPRINTF (stderr, " %d", *bottom);
00496   YYFPRINTF (stderr, "\n");
00497 }
00498 
00499 # define YY_STACK_PRINT(Bottom, Top)                            \
00500 do {                                                            \
00501   if (yydebug)                                                  \
00502     yy_stack_print ((Bottom), (Top));                           \
00503 } while (0)
00504 
00505 
00506 /*------------------------------------------------.
00507 | Report that the YYRULE is going to be reduced.  |
00508 `------------------------------------------------*/
00509 
00510 #if defined (__STDC__) || defined (__cplusplus)
00511 static void
00512 yy_reduce_print (int yyrule)
00513 #else
00514 static void
00515 yy_reduce_print (yyrule)
00516     int yyrule;
00517 #endif
00518 {
00519   int yyi;
00520   unsigned int yylno = yyrline[yyrule];
00521   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
00522              yyrule - 1, yylno);
00523   /* Print the symbols being reduced, and their result.  */
00524   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
00525     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
00526   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
00527 }
00528 
00529 # define YY_REDUCE_PRINT(Rule)          \
00530 do {                                    \
00531   if (yydebug)                          \
00532     yy_reduce_print (Rule);             \
00533 } while (0)
00534 
00535 /* Nonzero means print parse trace.  It is left uninitialized so that
00536    multiple parsers can coexist.  */
00537 int yydebug;
00538 #else /* !YYDEBUG */
00539 # define YYDPRINTF(Args)
00540 # define YYDSYMPRINT(Args)
00541 # define YYDSYMPRINTF(Title, Token, Value, Location)
00542 # define YY_STACK_PRINT(Bottom, Top)
00543 # define YY_REDUCE_PRINT(Rule)
00544 #endif /* !YYDEBUG */
00545 
00546 
00547 /* YYINITDEPTH -- initial size of the parser's stacks.  */
00548 #ifndef YYINITDEPTH
00549 # define YYINITDEPTH 200
00550 #endif
00551 
00552 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
00553    if the built-in stack extension method is used).
00554 
00555    Do not make this value too large; the results are undefined if
00556    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
00557    evaluated with infinite-precision integer arithmetic.  */
00558 
00559 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
00560 # undef YYMAXDEPTH
00561 #endif
00562 
00563 #ifndef YYMAXDEPTH
00564 # define YYMAXDEPTH 10000
00565 #endif
00566 
00567 
00568 
00569 #if YYERROR_VERBOSE
00570 
00571 # ifndef yystrlen
00572 #  if defined (__GLIBC__) && defined (_STRING_H)
00573 #   define yystrlen strlen
00574 #  else
00575 /* Return the length of YYSTR.  */
00576 static YYSIZE_T
00577 #   if defined (__STDC__) || defined (__cplusplus)
00578 yystrlen (const char *yystr)
00579 #   else
00580 yystrlen (yystr)
00581      const char *yystr;
00582 #   endif
00583 {
00584   register const char *yys = yystr;
00585 
00586   while (*yys++ != '\0')
00587     continue;
00588 
00589   return yys - yystr - 1;
00590 }
00591 #  endif
00592 # endif
00593 
00594 # ifndef yystpcpy
00595 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
00596 #   define yystpcpy stpcpy
00597 #  else
00598 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
00599    YYDEST.  */
00600 static char *
00601 #   if defined (__STDC__) || defined (__cplusplus)
00602 yystpcpy (char *yydest, const char *yysrc)
00603 #   else
00604 yystpcpy (yydest, yysrc)
00605      char *yydest;
00606      const char *yysrc;
00607 #   endif
00608 {
00609   register char *yyd = yydest;
00610   register const char *yys = yysrc;
00611 
00612   while ((*yyd++ = *yys++) != '\0')
00613     continue;
00614 
00615   return yyd - 1;
00616 }
00617 #  endif
00618 # endif
00619 
00620 #endif /* !YYERROR_VERBOSE */
00621 
00622 
00623 
00624 #if YYDEBUG
00625 /*--------------------------------.
00626 | Print this symbol on YYOUTPUT.  |
00627 `--------------------------------*/
00628 
00629 #if defined (__STDC__) || defined (__cplusplus)
00630 static void
00631 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
00632 #else
00633 static void
00634 yysymprint (yyoutput, yytype, yyvaluep)
00635     FILE *yyoutput;
00636     int yytype;
00637     YYSTYPE *yyvaluep;
00638 #endif
00639 {
00640   /* Pacify ``unused variable'' warnings.  */
00641   (void) yyvaluep;
00642 
00643   if (yytype < YYNTOKENS)
00644     {
00645       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00646 # ifdef YYPRINT
00647       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00648 # endif
00649     }
00650   else
00651     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00652 
00653   switch (yytype)
00654     {
00655       default:
00656         break;
00657     }
00658   YYFPRINTF (yyoutput, ")");
00659 }
00660 
00661 #endif /* ! YYDEBUG */
00662 /*-----------------------------------------------.
00663 | Release the memory associated to this symbol.  |
00664 `-----------------------------------------------*/
00665 
00666 #if defined (__STDC__) || defined (__cplusplus)
00667 static void
00668 yydestruct (int yytype, YYSTYPE *yyvaluep)
00669 #else
00670 static void
00671 yydestruct (yytype, yyvaluep)
00672     int yytype;
00673     YYSTYPE *yyvaluep;
00674 #endif
00675 {
00676   /* Pacify ``unused variable'' warnings.  */
00677   (void) yyvaluep;
00678 
00679   switch (yytype)
00680     {
00681 
00682       default:
00683         break;
00684     }
00685 }
00686 
00687 
00688 /* Prevent warnings from -Wmissing-prototypes.  */
00689 
00690 #ifdef YYPARSE_PARAM
00691 # if defined (__STDC__) || defined (__cplusplus)
00692 int yyparse (void *YYPARSE_PARAM);
00693 # else
00694 int yyparse ();
00695 # endif
00696 #else /* ! YYPARSE_PARAM */
00697 #if defined (__STDC__) || defined (__cplusplus)
00698 int yyparse (void);
00699 #else
00700 int yyparse ();
00701 #endif
00702 #endif /* ! YYPARSE_PARAM */
00703 
00704 
00705 
00706 /* The lookahead symbol.  */
00707 int yychar;
00708 
00709 /* The semantic value of the lookahead symbol.  */
00710 YYSTYPE yylval;
00711 
00712 /* Number of syntax errors so far.  */
00713 int yynerrs;
00714 
00715 
00716 
00717 /*----------.
00718 | yyparse.  |
00719 `----------*/
00720 
00721 #ifdef YYPARSE_PARAM
00722 # if defined (__STDC__) || defined (__cplusplus)
00723 int yyparse (void *YYPARSE_PARAM)
00724 # else
00725 int yyparse (YYPARSE_PARAM)
00726   void *YYPARSE_PARAM;
00727 # endif
00728 #else /* ! YYPARSE_PARAM */
00729 #if defined (__STDC__) || defined (__cplusplus)
00730 int
00731 yyparse (void)
00732 #else
00733 int
00734 yyparse ()
00735 
00736 #endif
00737 #endif
00738 {
00739   
00740   register int yystate;
00741   register int yyn;
00742   int yyresult;
00743   /* Number of tokens to shift before error messages enabled.  */
00744   int yyerrstatus;
00745   /* Lookahead token as an internal (translated) token number.  */
00746   int yytoken = 0;
00747 
00748   /* Three stacks and their tools:
00749      `yyss': related to states,
00750      `yyvs': related to semantic values,
00751      `yyls': related to locations.
00752 
00753      Refer to the stacks thru separate pointers, to allow yyoverflow
00754      to reallocate them elsewhere.  */
00755 
00756   /* The state stack.  */
00757   short yyssa[YYINITDEPTH];
00758   short *yyss = yyssa;
00759   register short *yyssp;
00760 
00761   /* The semantic value stack.  */
00762   YYSTYPE yyvsa[YYINITDEPTH];
00763   YYSTYPE *yyvs = yyvsa;
00764   register YYSTYPE *yyvsp;
00765 
00766 
00767 
00768 #define YYPOPSTACK   (yyvsp--, yyssp--)
00769 
00770   YYSIZE_T yystacksize = YYINITDEPTH;
00771 
00772   /* The variables used to return semantic value and location from the
00773      action routines.  */
00774   YYSTYPE yyval;
00775 
00776 
00777   /* When reducing, the number of symbols on the RHS of the reduced
00778      rule.  */
00779   int yylen;
00780 
00781   YYDPRINTF ((stderr, "Starting parse\n"));
00782 
00783   yystate = 0;
00784   yyerrstatus = 0;
00785   yynerrs = 0;
00786   yychar = YYEMPTY;             /* Cause a token to be read.  */
00787 
00788   /* Initialize stack pointers.
00789      Waste one element of value and location stack
00790      so that they stay on the same level as the state stack.
00791      The wasted elements are never initialized.  */
00792 
00793   yyssp = yyss;
00794   yyvsp = yyvs;
00795 
00796   goto yysetstate;
00797 
00798 /*------------------------------------------------------------.
00799 | yynewstate -- Push a new state, which is found in yystate.  |
00800 `------------------------------------------------------------*/
00801  yynewstate:
00802   /* In all cases, when you get here, the value and location stacks
00803      have just been pushed. so pushing a state here evens the stacks.
00804      */
00805   yyssp++;
00806 
00807  yysetstate:
00808   *yyssp = yystate;
00809 
00810   if (yyss + yystacksize - 1 <= yyssp)
00811     {
00812       /* Get the current used size of the three stacks, in elements.  */
00813       YYSIZE_T yysize = yyssp - yyss + 1;
00814 
00815 #ifdef yyoverflow
00816       {
00817         /* Give user a chance to reallocate the stack. Use copies of
00818            these so that the &'s don't force the real ones into
00819            memory.  */
00820         YYSTYPE *yyvs1 = yyvs;
00821         short *yyss1 = yyss;
00822 
00823 
00824         /* Each stack pointer address is followed by the size of the
00825            data in use in that stack, in bytes.  This used to be a
00826            conditional around just the two extra args, but that might
00827            be undefined if yyoverflow is a macro.  */
00828         yyoverflow ("parser stack overflow",
00829                     &yyss1, yysize * sizeof (*yyssp),
00830                     &yyvs1, yysize * sizeof (*yyvsp),
00831 
00832                     &yystacksize);
00833 
00834         yyss = yyss1;
00835         yyvs = yyvs1;
00836       }
00837 #else /* no yyoverflow */
00838 # ifndef YYSTACK_RELOCATE
00839       goto yyoverflowlab;
00840 # else
00841       /* Extend the stack our own way.  */
00842       if (YYMAXDEPTH <= yystacksize)
00843         goto yyoverflowlab;
00844       yystacksize *= 2;
00845       if (YYMAXDEPTH < yystacksize)
00846         yystacksize = YYMAXDEPTH;
00847 
00848       {
00849         short *yyss1 = yyss;
00850         union yyalloc *yyptr =
00851           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
00852         if (! yyptr)
00853           goto yyoverflowlab;
00854         YYSTACK_RELOCATE (yyss);
00855         YYSTACK_RELOCATE (yyvs);
00856 
00857 #  undef YYSTACK_RELOCATE
00858         if (yyss1 != yyssa)
00859           YYSTACK_FREE (yyss1);
00860       }
00861 # endif
00862 #endif /* no yyoverflow */
00863 
00864       yyssp = yyss + yysize - 1;
00865       yyvsp = yyvs + yysize - 1;
00866 
00867 
00868       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
00869                   (unsigned long int) yystacksize));
00870 
00871       if (yyss + yystacksize - 1 <= yyssp)
00872         YYABORT;
00873     }
00874 
00875   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
00876 
00877   goto yybackup;
00878 
00879 /*-----------.
00880 | yybackup.  |
00881 `-----------*/
00882 yybackup:
00883 
00884 /* Do appropriate processing given the current state.  */
00885 /* Read a lookahead token if we need one and don't already have one.  */
00886 /* yyresume: */
00887 
00888   /* First try to decide what to do without reference to lookahead token.  */
00889 
00890   yyn = yypact[yystate];
00891   if (yyn == YYPACT_NINF)
00892     goto yydefault;
00893 
00894   /* Not known => get a lookahead token if don't already have one.  */
00895 
00896   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
00897   if (yychar == YYEMPTY)
00898     {
00899       YYDPRINTF ((stderr, "Reading a token: "));
00900       yychar = YYLEX;
00901     }
00902 
00903   if (yychar <= YYEOF)
00904     {
00905       yychar = yytoken = YYEOF;
00906       YYDPRINTF ((stderr, "Now at end of input.\n"));
00907     }
00908   else
00909     {
00910       yytoken = YYTRANSLATE (yychar);
00911       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
00912     }
00913 
00914   /* If the proper action on seeing token YYTOKEN is to reduce or to
00915      detect an error, take that action.  */
00916   yyn += yytoken;
00917   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
00918     goto yydefault;
00919   yyn = yytable[yyn];
00920   if (yyn <= 0)
00921     {
00922       if (yyn == 0 || yyn == YYTABLE_NINF)
00923         goto yyerrlab;
00924       yyn = -yyn;
00925       goto yyreduce;
00926     }
00927 
00928   if (yyn == YYFINAL)
00929     YYACCEPT;
00930 
00931   /* Shift the lookahead token.  */
00932   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
00933 
00934   /* Discard the token being shifted unless it is eof.  */
00935   if (yychar != YYEOF)
00936     yychar = YYEMPTY;
00937 
00938   *++yyvsp = yylval;
00939 
00940 
00941   /* Count tokens shifted since error; after three, turn off error
00942      status.  */
00943   if (yyerrstatus)
00944     yyerrstatus--;
00945 
00946   yystate = yyn;
00947   goto yynewstate;
00948 
00949 
00950 /*-----------------------------------------------------------.
00951 | yydefault -- do the default action for the current state.  |
00952 `-----------------------------------------------------------*/
00953 yydefault:
00954   yyn = yydefact[yystate];
00955   if (yyn == 0)
00956     goto yyerrlab;
00957   goto yyreduce;
00958 
00959 
00960 /*-----------------------------.
00961 | yyreduce -- Do a reduction.  |
00962 `-----------------------------*/
00963 yyreduce:
00964   /* yyn is the number of a rule to reduce with.  */
00965   yylen = yyr2[yyn];
00966 
00967   /* If YYLEN is nonzero, implement the default value of the action:
00968      `$$ = $1'.
00969 
00970      Otherwise, the following line sets YYVAL to garbage.
00971      This behavior is undocumented and Bison
00972      users should not rely upon it.  Assigning to YYVAL
00973      unconditionally makes the parser a bit smaller, and it avoids a
00974      GCC warning that YYVAL may be used uninitialized.  */
00975   yyval = yyvsp[1-yylen];
00976 
00977 
00978   YY_REDUCE_PRINT (yyn);
00979   switch (yyn)
00980     {
00981         case 4:
00982 #line 48 "dotty_parser.y"
00983     { addOptionString(yyvsp[-2].s, yyvsp[0].s); }
00984     break;
00985 
00986   case 5:
00987 #line 50 "dotty_parser.y"
00988     { addOptionInteger(yyvsp[-2].s, yyvsp[0].n); }
00989     break;
00990 
00991 
00992     }
00993 
00994 /* Line 993 of yacc.c.  */
00995 #line 996 "y.tab.c"
00996 
00997   yyvsp -= yylen;
00998   yyssp -= yylen;
00999 
01000 
01001   YY_STACK_PRINT (yyss, yyssp);
01002 
01003   *++yyvsp = yyval;
01004 
01005 
01006   /* Now `shift' the result of the reduction.  Determine what state
01007      that goes to, based on the state we popped back to and the rule
01008      number reduced by.  */
01009 
01010   yyn = yyr1[yyn];
01011 
01012   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01013   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01014     yystate = yytable[yystate];
01015   else
01016     yystate = yydefgoto[yyn - YYNTOKENS];
01017 
01018   goto yynewstate;
01019 
01020 
01021 /*------------------------------------.
01022 | yyerrlab -- here on detecting error |
01023 `------------------------------------*/
01024 yyerrlab:
01025   /* If not already recovering from an error, report this error.  */
01026   if (!yyerrstatus)
01027     {
01028       ++yynerrs;
01029 #if YYERROR_VERBOSE
01030       yyn = yypact[yystate];
01031 
01032       if (YYPACT_NINF < yyn && yyn < YYLAST)
01033         {
01034           YYSIZE_T yysize = 0;
01035           int yytype = YYTRANSLATE (yychar);
01036           const char* yyprefix;
01037           char *yymsg;
01038           int yyx;
01039 
01040           /* Start YYX at -YYN if negative to avoid negative indexes in
01041              YYCHECK.  */
01042           int yyxbegin = yyn < 0 ? -yyn : 0;
01043 
01044           /* Stay within bounds of both yycheck and yytname.  */
01045           int yychecklim = YYLAST - yyn;
01046           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01047           int yycount = 0;
01048 
01049           yyprefix = ", expecting ";
01050           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01051             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01052               {
01053                 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
01054                 yycount += 1;
01055                 if (yycount == 5)
01056                   {
01057                     yysize = 0;
01058                     break;
01059                   }
01060               }
01061           yysize += (sizeof ("syntax error, unexpected ")
01062                      + yystrlen (yytname[yytype]));
01063           yymsg = (char *) YYSTACK_ALLOC (yysize);
01064           if (yymsg != 0)
01065             {
01066               char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
01067               yyp = yystpcpy (yyp, yytname[yytype]);
01068 
01069               if (yycount < 5)
01070                 {
01071                   yyprefix = ", expecting ";
01072                   for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01073                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01074                       {
01075                         yyp = yystpcpy (yyp, yyprefix);
01076                         yyp = yystpcpy (yyp, yytname[yyx]);
01077                         yyprefix = " or ";
01078                       }
01079                 }
01080               yyerror (yymsg);
01081               YYSTACK_FREE (yymsg);
01082             }
01083           else
01084             yyerror ("syntax error; also virtual memory exhausted");
01085         }
01086       else
01087 #endif /* YYERROR_VERBOSE */
01088         yyerror ("syntax error");
01089     }
01090 
01091 
01092 
01093   if (yyerrstatus == 3)
01094     {
01095       /* If just tried and failed to reuse lookahead token after an
01096          error, discard it.  */
01097 
01098       if (yychar <= YYEOF)
01099         {
01100           /* If at end of input, pop the error token,
01101              then the rest of the stack, then return failure.  */
01102           if (yychar == YYEOF)
01103              for (;;)
01104                {
01105                  YYPOPSTACK;
01106                  if (yyssp == yyss)
01107                    YYABORT;
01108                  YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
01109                  yydestruct (yystos[*yyssp], yyvsp);
01110                }
01111         }
01112       else
01113         {
01114           YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
01115           yydestruct (yytoken, &yylval);
01116           yychar = YYEMPTY;
01117 
01118         }
01119     }
01120 
01121   /* Else will try to reuse lookahead token after shifting the error
01122      token.  */
01123   goto yyerrlab1;
01124 
01125 
01126 /*---------------------------------------------------.
01127 | yyerrorlab -- error raised explicitly by YYERROR.  |
01128 `---------------------------------------------------*/
01129 yyerrorlab:
01130 
01131 #ifdef __GNUC__
01132   /* Pacify GCC when the user code never invokes YYERROR and the label
01133      yyerrorlab therefore never appears in user code.  */
01134   if (0)
01135      goto yyerrorlab;
01136 #endif
01137 
01138   yyvsp -= yylen;
01139   yyssp -= yylen;
01140   yystate = *yyssp;
01141   goto yyerrlab1;
01142 
01143 
01144 /*-------------------------------------------------------------.
01145 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
01146 `-------------------------------------------------------------*/
01147 yyerrlab1:
01148   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
01149 
01150   for (;;)
01151     {
01152       yyn = yypact[yystate];
01153       if (yyn != YYPACT_NINF)
01154         {
01155           yyn += YYTERROR;
01156           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
01157             {
01158               yyn = yytable[yyn];
01159               if (0 < yyn)
01160                 break;
01161             }
01162         }
01163 
01164       /* Pop the current state because it cannot handle the error token.  */
01165       if (yyssp == yyss)
01166         YYABORT;
01167 
01168       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
01169       yydestruct (yystos[yystate], yyvsp);
01170       YYPOPSTACK;
01171       yystate = *yyssp;
01172       YY_STACK_PRINT (yyss, yyssp);
01173     }
01174 
01175   if (yyn == YYFINAL)
01176     YYACCEPT;
01177 
01178   YYDPRINTF ((stderr, "Shifting error token, "));
01179 
01180   *++yyvsp = yylval;
01181 
01182 
01183   yystate = yyn;
01184   goto yynewstate;
01185 
01186 
01187 /*-------------------------------------.
01188 | yyacceptlab -- YYACCEPT comes here.  |
01189 `-------------------------------------*/
01190 yyacceptlab:
01191   yyresult = 0;
01192   goto yyreturn;
01193 
01194 /*-----------------------------------.
01195 | yyabortlab -- YYABORT comes here.  |
01196 `-----------------------------------*/
01197 yyabortlab:
01198   yyresult = 1;
01199   goto yyreturn;
01200 
01201 #ifndef yyoverflow
01202 /*----------------------------------------------.
01203 | yyoverflowlab -- parser overflow comes here.  |
01204 `----------------------------------------------*/
01205 yyoverflowlab:
01206   yyerror ("parser stack overflow");
01207   yyresult = 2;
01208   /* Fall through.  */
01209 #endif
01210 
01211 yyreturn:
01212 #ifndef yyoverflow
01213   if (yyss != yyssa)
01214     YYSTACK_FREE (yyss);
01215 #endif
01216   return yyresult;
01217 }
01218 
01219 
01220 #line 53 "dotty_parser.y"
01221 
01222 extern int yyparse();
01223 bool readDottyConfiguration(const char* f = 0, ostream& e = cerr)
01224 {
01225   g_errorStream = &e;
01226   
01227   if (f) {
01228     if (!freopen(f, "r", stdin)) {
01229       // perror(f);
01230       return false;
01231     }
01232     yyfilename = f;
01233   } else {
01234     yyfilename = "'stdin'";
01235   }
01236 
01237   yylineno = 1;
01238   yyprev = 0;
01239   yyerrors = 0;
01240   if (yyparse() || yyerrors)
01241     return false;
01242   return true;
01243 }
01244 
01245 void yyline(char* a, char* b="", char* c="", char* d="", char* e="")
01246 {
01247   const int maxErrorMsg = 20;
01248 
01249   if (yylineno == yyprev)
01250     return;
01251   yyprev = yylineno;
01252 
01253         ++yyerrors;
01254         if (yyerrors > maxErrorMsg)
01255                 return;
01256         if (yyerrors == maxErrorMsg) {
01257                 *g_errorStream << "Too many errors." << endl;
01258                 return;
01259         }
01260   *g_errorStream << "\"" << yyfilename << "\", ";
01261         *g_errorStream << "line " << yylineno << ": ";
01262   *g_errorStream << a << b << c << d << e << endl;
01263 }
01264 
01265 void yyline1(char* a)
01266 {
01267   yyline(a);
01268 }
01269 
01270 void yyerror(char* s)
01271 {
01272         yyline(s);
01273 }
01274 
01275 void yyrecovered(char* exp, char* act)
01276 {
01277         yyline("syntax error: ", exp, ", ", act);
01278         // yyline("syntax error: ", exp);
01279 }
01280 
01281 

Generated on Wed Feb 15 14:52:38 2006 for yapi by doxygen 1.3.2