Logo Search packages:      
Sourcecode: c++-annotations version File versions  Download package

parser.cc

#define YY_Parser_h_included

/*  A Bison parser, made from gramspec/grammar  */


#line 1 "/usr/local/lib/bison.cc"
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 1, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */

/* HEADER SECTION */
#ifndef _MSDOS
#ifdef MSDOS
#define _MSDOS
#endif
#endif
/* turboc */
#ifdef __MSDOS__
#ifndef _MSDOS
#define _MSDOS
#endif
#endif

#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc)
#include <alloca.h>
#else /* not sparc */
#if defined (_MSDOS)
#include <malloc.h>
#ifndef __TURBOC__
/* MS C runtime lib */
#define alloca _alloca
#endif
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
 #pragma alloca
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc.  */
#endif /* not GNU C.  */
#endif /* alloca not defined.  */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif
#ifdef __cplusplus
#ifndef YY_USE_CLASS
#define YY_USE_CLASS
#endif
#else
#ifndef __STDC__
#define const
#endif
#endif
#include <stdio.h>
#define YYBISON 1

/* #line 70 "/usr/local/lib/bison.cc" */
#line 2 "gramspec/grammar"

#line 2  "header.gr0"
    #include "../scanner/scanner.h"
    #include <cstdlib>
    #include <iostream>
    #include <sstream>
    #include <fbb/a2x.h>

    using FBB::A2x;
    using std::cerr;
    using std::cout;
    using std::endl;

#line 26 "gramspec/grammar"
typedef union {
#line 4  "tokens.gr0"
    int i;
    double d;
} yy_Parser_stype;
#define YY_Parser_STYPE yy_Parser_stype
#define YY_Parser_LEX_BODY  {return d_scanner.yylex();}
#define YY_Parser_ERROR_BODY  { std::cerr << "error encountered\n"; }
#define YY_Parser_MEMBERS                                          \
    virtual ~Parser()   {}                              \
    private:                                            \
        std::ostringstream d_rpn;                       \
        Scanner d_scanner;
#define YY_Parser_DEBUG  1

#line 70 "/usr/local/lib/bison.cc"
/* %{ and %header{ and %union, during decl */
#define YY_Parser_BISON 1
#ifndef YY_Parser_COMPATIBILITY
#ifndef YY_USE_CLASS
#define  YY_Parser_COMPATIBILITY 1
#else
#define  YY_Parser_COMPATIBILITY 0
#endif
#endif

#if YY_Parser_COMPATIBILITY != 0
/* backward compatibility */
#ifdef YYLTYPE
#ifndef YY_Parser_LTYPE
#define YY_Parser_LTYPE YYLTYPE
#endif
#endif
#ifdef YYSTYPE
#ifndef YY_Parser_STYPE
#define YY_Parser_STYPE YYSTYPE
#endif
#endif
#ifdef YYDEBUG
#ifndef YY_Parser_DEBUG
#define  YY_Parser_DEBUG YYDEBUG
#endif
#endif
#ifdef YY_Parser_STYPE
#ifndef yystype
#define yystype YY_Parser_STYPE
#endif
#endif
#endif

#ifndef YY_Parser_PURE

/* #line 105 "/usr/local/lib/bison.cc" */

#line 105 "/usr/local/lib/bison.cc"
/*  YY_Parser_PURE */
#endif

/* section apres lecture def, avant lecture grammaire S2 */

/* #line 109 "/usr/local/lib/bison.cc" */

#line 109 "/usr/local/lib/bison.cc"
/* prefix */
#ifndef YY_Parser_DEBUG

/* #line 111 "/usr/local/lib/bison.cc" */

#line 111 "/usr/local/lib/bison.cc"
/* YY_Parser_DEBUG */
#endif


#ifndef YY_Parser_LSP_NEEDED

/* #line 116 "/usr/local/lib/bison.cc" */

#line 116 "/usr/local/lib/bison.cc"
 /* YY_Parser_LSP_NEEDED*/
#endif



/* DEFAULT LTYPE*/
#ifdef YY_Parser_LSP_NEEDED
#ifndef YY_Parser_LTYPE
typedef
  struct yyltype
    {
      int timestamp;
      int first_line;
      int first_column;
      int last_line;
      int last_column;
      char *text;
   }
  yyltype;

#define YY_Parser_LTYPE yyltype
#endif
#endif
/* DEFAULT STYPE*/
      /* We used to use `unsigned long' as YY_Parser_STYPE on MSDOS,
         but it seems better to be consistent.
         Most programs should declare their own type anyway.  */

#ifndef YY_Parser_STYPE
#define YY_Parser_STYPE int
#endif
/* DEFAULT MISCELANEOUS */
#ifndef YY_Parser_PARSE
#define YY_Parser_PARSE yyparse
#endif
#ifndef YY_Parser_LEX
#define YY_Parser_LEX yylex
#endif
#ifndef YY_Parser_LVAL
#define YY_Parser_LVAL yylval
#endif
#ifndef YY_Parser_LLOC
#define YY_Parser_LLOC yylloc
#endif
#ifndef YY_Parser_CHAR
#define YY_Parser_CHAR yychar
#endif
#ifndef YY_Parser_NERRS
#define YY_Parser_NERRS yynerrs
#endif
#ifndef YY_Parser_DEBUG_FLAG
#define YY_Parser_DEBUG_FLAG yydebug
#endif
#ifndef YY_Parser_ERROR
#define YY_Parser_ERROR yyerror
#endif
#ifndef YY_Parser_PARSE_PARAM
#ifndef __STDC__
#ifndef __cplusplus
#ifndef YY_USE_CLASS
#define YY_Parser_PARSE_PARAM
#ifndef YY_Parser_PARSE_PARAM_DEF
#define YY_Parser_PARSE_PARAM_DEF
#endif
#endif
#endif
#endif
#ifndef YY_Parser_PARSE_PARAM
#define YY_Parser_PARSE_PARAM void
#endif
#endif
/* TOKEN C */
#if YY_Parser_COMPATIBILITY != 0
/* backward compatibility */
#ifdef YY_Parser_LTYPE
#ifndef YYLTYPE
#define YYLTYPE YY_Parser_LTYPE
#else
/* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */
#endif
#endif
#ifndef YYSTYPE
#define YYSTYPE YY_Parser_STYPE
#else
/* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */
#endif
#ifdef YY_Parser_PURE
#ifndef YYPURE
#define YYPURE YY_Parser_PURE
#endif
#endif
#ifdef YY_Parser_DEBUG
#ifndef YYDEBUG
#define YYDEBUG YY_Parser_DEBUG
#endif
#endif
#ifndef YY_Parser_ERROR_VERBOSE
#ifdef YYERROR_VERBOSE
#define YY_Parser_ERROR_VERBOSE YYERROR_VERBOSE
#endif
#endif
#ifndef YY_Parser_LSP_NEEDED
#ifdef YYLSP_NEEDED
#define YY_Parser_LSP_NEEDED YYLSP_NEEDED
#endif
#endif


/* #line 223 "/usr/local/lib/bison.cc" */
#define DONE    258
#define INT     259
#define DOUBLE  260
#define UnaryMinus      261


#line 223 "/usr/local/lib/bison.cc"
 /* #defines tokens */
#else
/* CLASS */
#ifndef YY_Parser_CLASS
#define YY_Parser_CLASS Parser
#endif
#ifndef YY_Parser_INHERIT
#define YY_Parser_INHERIT
#endif
#ifndef YY_Parser_MEMBERS
#define YY_Parser_MEMBERS
#endif
#ifndef YY_Parser_LEX_BODY
#define YY_Parser_LEX_BODY
#endif
#ifndef YY_Parser_ERROR_BODY
#define YY_Parser_ERROR_BODY
#endif
#ifndef YY_Parser_CONSTRUCTOR_PARAM
#define YY_Parser_CONSTRUCTOR_PARAM
#endif
#ifndef YY_Parser_CONSTRUCTOR_CODE
#define YY_Parser_CONSTRUCTOR_CODE
#endif
#ifndef YY_Parser_CONSTRUCTOR_INIT
#define YY_Parser_CONSTRUCTOR_INIT
#endif

class YY_Parser_CLASS YY_Parser_INHERIT
{
public: /* static const int token ... */

/* #line 254 "/usr/local/lib/bison.cc" */
static const int DONE;
static const int INT;
static const int DOUBLE;
static const int UnaryMinus;


#line 254 "/usr/local/lib/bison.cc"
 /* decl const */
public:
 int YY_Parser_PARSE (YY_Parser_PARSE_PARAM);
 virtual void YY_Parser_ERROR(char *msg) YY_Parser_ERROR_BODY;
#ifdef YY_Parser_PURE
#ifdef YY_Parser_LSP_NEEDED
 virtual int  YY_Parser_LEX (YY_Parser_STYPE *YY_Parser_LVAL,YY_Parser_LTYPE *YY_Parser_LLOC) YY_Parser_LEX_BODY;
#else
 virtual int  YY_Parser_LEX (YY_Parser_STYPE *YY_Parser_LVAL) YY_Parser_LEX_BODY;
#endif
#else
 virtual int YY_Parser_LEX() YY_Parser_LEX_BODY;
 YY_Parser_STYPE YY_Parser_LVAL;
#ifdef YY_Parser_LSP_NEEDED
 YY_Parser_LTYPE YY_Parser_LLOC;
#endif
 int   YY_Parser_NERRS;
 int    YY_Parser_CHAR;
#endif
#if YY_Parser_DEBUG != 0
 int YY_Parser_DEBUG_FLAG;   /*  nonzero means print parse trace     */
#endif
public:
 YY_Parser_CLASS(YY_Parser_CONSTRUCTOR_PARAM);
public:
 YY_Parser_MEMBERS
};
/* other declare folow */

/* #line 282 "/usr/local/lib/bison.cc" */
const int YY_Parser_CLASS::DONE=258;
const int YY_Parser_CLASS::INT=259;
const int YY_Parser_CLASS::DOUBLE=260;
const int YY_Parser_CLASS::UnaryMinus=261;


#line 282 "/usr/local/lib/bison.cc"
 /* const YY_Parser_CLASS::token */
/*apres const  */
YY_Parser_CLASS::YY_Parser_CLASS(YY_Parser_CONSTRUCTOR_PARAM) YY_Parser_CONSTRUCTOR_INIT
{
#if YY_Parser_DEBUG != 0
YY_Parser_DEBUG_FLAG=0;
#endif
YY_Parser_CONSTRUCTOR_CODE;
};
#endif

/* #line 292 "/usr/local/lib/bison.cc" */


#define YYFINAL         34
#define YYFLAG          -32768
#define YYNTBASE        13

#define YYTRANSLATE(x) ((size_t)(x) <= 261 ? yytranslate[x] : 17)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     9,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,    10,
    11,     7,     6,     2,    12,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
     8
};

#if YY_Parser_DEBUG != 0
static const short yyprhs[] = {     0,
     0,     3,     5,     8,    11,    13,    16,    20,    24,    28,
    31,    33,    37,    41,    45,    49,    53,    57,    61,    64
};

#endif

static const short yyrhs[] = {    13,
    14,     0,    14,     0,    15,     9,     0,    16,     9,     0,
     9,     0,     1,     9,     0,    15,     7,    15,     0,    15,
     6,    15,     0,    10,    15,    11,     0,    12,    15,     0,
     4,     0,    16,     7,    16,     0,    16,     6,    16,     0,
    16,     7,    15,     0,    16,     6,    15,     0,    15,     7,
    16,     0,    15,     6,    16,     0,    10,    16,    11,     0,
    12,    16,     0,     5,     0
};

#if YY_Parser_DEBUG != 0
static const short yyrline[] = { 0,
    60,    63,    67,    76,    85,    92,   102,   109,   116,   122,
   129,   138,   145,   152,   159,   166,   173,   180,   186,   193
};

static const char * const yytname[] = {   "$","error","$illegal.","DONE","INT",
"DOUBLE","'+'","'*'","UnaryMinus","'\\n'","'('","')'","'-'","lines","line","intExpr",
"doubleExpr",""
};
#endif

static const short yyr1[] = {     0,
    13,    13,    14,    14,    14,    14,    15,    15,    15,    15,
    15,    16,    16,    16,    16,    16,    16,    16,    16,    16
};

static const short yyr2[] = {     0,
     2,     1,     2,     2,     1,     2,     3,     3,     3,     2,
     1,     3,     3,     3,     3,     3,     3,     3,     2,     1
};

static const short yydefact[] = {     0,
     0,    11,    20,     5,     0,     0,     0,     2,     0,     0,
     6,     0,     0,    10,    19,     1,     0,     0,     3,     0,
     0,     4,     9,    18,     8,    17,     7,    16,    15,    13,
    14,    12,     0,     0
};

static const short yydefgoto[] = {     7,
     8,     9,    10
};

static const short yypact[] = {    32,
     2,-32768,-32768,-32768,    -2,    -2,    22,-32768,    42,    46,
-32768,    18,    39,-32768,-32768,-32768,    -2,    -2,-32768,    -2,
    -2,-32768,-32768,-32768,    -3,     7,-32768,-32768,    -3,     7,
-32768,-32768,     9,-32768
};

static const short yypgoto[] = {-32768,
    12,    -5,     0
};


#define YYLAST          55


static const short yytable[] = {    12,
    14,     2,     3,    18,    13,    15,     0,     5,    34,     6,
    11,    25,    27,    21,    29,    31,    26,    28,    16,    30,
    32,    33,     1,    17,    18,     2,     3,     0,    23,     0,
     4,     5,     1,     6,     0,     2,     3,     0,     0,     0,
     4,     5,     0,     6,    20,    21,     0,    17,    18,    24,
    19,    20,    21,     0,    22
};

static const short yycheck[] = {     5,
     6,     4,     5,     7,     5,     6,    -1,    10,     0,    12,
     9,    17,    18,     7,    20,    21,    17,    18,     7,    20,
    21,     0,     1,     6,     7,     4,     5,    -1,    11,    -1,
     9,    10,     1,    12,    -1,     4,     5,    -1,    -1,    -1,
     9,    10,    -1,    12,     6,     7,    -1,     6,     7,    11,
     9,     6,     7,    -1,     9
};

#line 292 "/usr/local/lib/bison.cc"
 /* fattrs + tables */

/* parser code folow  */


/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

/* Note: dollar marks section change
   the next  is replaced by the list of actions, each action
   as one case of the switch.  */

#define yyerrok         (yyerrstatus = 0)
#define yyclearin       (YY_Parser_CHAR = YYEMPTY)
#define YYEMPTY         -2
#define YYEOF           0
#define YYACCEPT        return(0)
#define YYABORT         return(1)
#define YYERROR         goto yyerrlab1
/* Like YYERROR except do call yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL          goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(token, value) \
do                                                              \
  if (YY_Parser_CHAR == YYEMPTY && yylen == 1)                               \
    { YY_Parser_CHAR = (token), YY_Parser_LVAL = (value);                 \
      yychar1 = YYTRANSLATE (YY_Parser_CHAR);                                \
      YYPOPSTACK;                                               \
      goto yybackup;                                            \
    }                                                           \
  else                                                          \
    { YY_Parser_ERROR ("syntax error: cannot back up"); YYERROR; }   \
while (0)

#define YYTERROR        1
#define YYERRCODE       256

#ifndef YY_Parser_PURE
/* UNPURE */
#define YYLEX           YY_Parser_LEX()
#ifndef YY_USE_CLASS
/* If nonreentrant, and not class , generate the variables here */
int     YY_Parser_CHAR;                      /*  the lookahead symbol        */
YY_Parser_STYPE      YY_Parser_LVAL;              /*  the semantic value of the */
                                /*  lookahead symbol    */
int YY_Parser_NERRS;                 /*  number of parse errors so far */
#ifdef YY_Parser_LSP_NEEDED
YY_Parser_LTYPE YY_Parser_LLOC;   /*  location data for the lookahead     */
                        /*  symbol                              */
#endif
#endif


#else
/* PURE */
#ifdef YY_Parser_LSP_NEEDED
#define YYLEX           YY_Parser_LEX(&YY_Parser_LVAL, &YY_Parser_LLOC)
#else
#define YYLEX           YY_Parser_LEX(&YY_Parser_LVAL)
#endif
#endif
#ifndef YY_USE_CLASS
#if YY_Parser_DEBUG != 0
int YY_Parser_DEBUG_FLAG;                    /*  nonzero means print parse trace     */
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif
#endif



/*  YYINITDEPTH indicates the initial size of the parser's stacks       */

#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif

/*  YYMAXDEPTH is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif


#if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
#define __yy_bcopy(FROM,TO,COUNT)       __builtin_memcpy(TO,FROM,COUNT)
#else                           /* not GNU C or C++ */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */

#ifdef __cplusplus
static void __yy_bcopy (char *from, char *to, int count)
#else
#ifdef __STDC__
static void __yy_bcopy (char *from, char *to, int count)
#else
static void __yy_bcopy (from, to, count)
     char *from;
     char *to;
     int count;
#endif
#endif
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}
#endif

int
#ifdef YY_USE_CLASS
 YY_Parser_CLASS::
#endif
     YY_Parser_PARSE(YY_Parser_PARSE_PARAM)
#ifndef __STDC__
#ifndef __cplusplus
#ifndef YY_USE_CLASS
/* parameter definition without protypes */
YY_Parser_PARSE_PARAM_DEF
#endif
#endif
#endif
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YY_Parser_STYPE *yyvsp;
  int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
  int yychar1;          /*  lookahead token as an internal (translated) token number */

  short yyssa[YYINITDEPTH];     /*  the state stack                     */
  YY_Parser_STYPE yyvsa[YYINITDEPTH];        /*  the semantic value stack            */

  short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
  YY_Parser_STYPE *yyvs = yyvsa;     /*  to allow yyoverflow to reallocate them elsewhere */

#ifdef YY_Parser_LSP_NEEDED
  YY_Parser_LTYPE yylsa[YYINITDEPTH];        /*  the location stack                  */
  YY_Parser_LTYPE *yyls = yylsa;
  YY_Parser_LTYPE *yylsp;

#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  int yystacksize = YYINITDEPTH;

#ifdef YY_Parser_PURE
  int YY_Parser_CHAR;
  YY_Parser_STYPE YY_Parser_LVAL;
  int YY_Parser_NERRS;
#ifdef YY_Parser_LSP_NEEDED
  YY_Parser_LTYPE YY_Parser_LLOC;
#endif
#endif

  YY_Parser_STYPE yyval;             /*  the variable used to return         */
                                /*  semantic values from the action     */
                                /*  routines                            */

  int yylen;

#if YY_Parser_DEBUG != 0
  if (YY_Parser_DEBUG_FLAG)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  YY_Parser_NERRS = 0;
  YY_Parser_CHAR = YYEMPTY;          /* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
#ifdef YY_Parser_LSP_NEEDED
  yylsp = yyls;
#endif

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YY_Parser_STYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
#ifdef YY_Parser_LSP_NEEDED
      YY_Parser_LTYPE *yyls1 = yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
         the data in use in that stack, in bytes.  */
      yyoverflow("parser stack overflow",
                 &yyss1, size * sizeof (*yyssp),
                 &yyvs1, size * sizeof (*yyvsp),
#ifdef YY_Parser_LSP_NEEDED
                 &yyls1, size * sizeof (*yylsp),
#endif
                 &yystacksize);

      yyss = yyss1; yyvs = yyvs1;
#ifdef YY_Parser_LSP_NEEDED
      yyls = yyls1;
#endif
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
        {
          YY_Parser_ERROR("parser stack overflow");
          return 2;
        }
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
        yystacksize = YYMAXDEPTH;
      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
      __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
      yyvs = (YY_Parser_STYPE *) alloca (yystacksize * sizeof (*yyvsp));
      __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
#ifdef YY_Parser_LSP_NEEDED
      yyls = (YY_Parser_LTYPE *) alloca (yystacksize * sizeof (*yylsp));
      __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YY_Parser_LSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YY_Parser_DEBUG != 0
      if (YY_Parser_DEBUG_FLAG)
        fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif

      if (yyssp >= yyss + yystacksize - 1)
        YYABORT;
    }

#if YY_Parser_DEBUG != 0
  if (YY_Parser_DEBUG_FLAG)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

  goto yybackup;
 yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (YY_Parser_CHAR == YYEMPTY)
    {
#if YY_Parser_DEBUG != 0
      if (YY_Parser_DEBUG_FLAG)
        fprintf(stderr, "Reading a token: ");
#endif
      YY_Parser_CHAR = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (YY_Parser_CHAR <= 0)           /* This means end of input. */
    {
      yychar1 = 0;
      YY_Parser_CHAR = YYEOF;                /* Don't call YYLEX any more */

#if YY_Parser_DEBUG != 0
      if (YY_Parser_DEBUG_FLAG)
        fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(YY_Parser_CHAR);

#if YY_Parser_DEBUG != 0
      if (YY_Parser_DEBUG_FLAG)
        {
          fprintf (stderr, "Next token is %d (%s", YY_Parser_CHAR, yytname[yychar1]);
          /* Give the individual parser a way to print the precise meaning
             of a token, for further debugging info.  */
#ifdef YYPRINT
          YYPRINT (stderr, YY_Parser_CHAR, YY_Parser_LVAL);
#endif
          fprintf (stderr, ")\n");
        }
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YY_Parser_DEBUG != 0
  if (YY_Parser_DEBUG_FLAG)
    fprintf(stderr, "Shifting token %d (%s), ", YY_Parser_CHAR, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (YY_Parser_CHAR != YYEOF)
    YY_Parser_CHAR = YYEMPTY;

  *++yyvsp = YY_Parser_LVAL;
#ifdef YY_Parser_LSP_NEEDED
  *++yylsp = YY_Parser_LLOC;
#endif

  /* count tokens shifted since error; after three, turn off error status.  */
  if (yyerrstatus) yyerrstatus--;

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YY_Parser_DEBUG != 0
  if (YY_Parser_DEBUG_FLAG)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
               yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
        fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif


/* #line 697 "/usr/local/lib/bison.cc" */

  switch (yyn) {

case 3:
#line 70 "gramspec/grammar"
{
#line 12  "startrule.gr0"
            cerr << "RPN: " << d_rpn.str() << endl;
            cerr << "int: " << yyvsp[-1].i << endl;
            d_rpn.str(string());
        ;
    break;}
case 4:
#line 79 "gramspec/grammar"
{
#line 20  "startrule.gr0"
            cerr << "RPN: " << d_rpn.str() << endl;
            cerr << "double: " << yyvsp[-1].d << endl;
            d_rpn.str(string());
        ;
    break;}
case 5:
#line 87 "gramspec/grammar"
{
#line 27  "startrule.gr0"
            cout << "Good bye\n";
            YYACCEPT;
        ;
    break;}
case 6:
#line 95 "gramspec/grammar"
{
#line 34  "startrule.gr0"
            d_rpn.clear();
            d_rpn.str(string());
        ;
    break;}
case 7:
#line 104 "gramspec/grammar"
{
#line 42  "startrule.gr0"
            d_rpn << " * ";
            yyval.i = yyvsp[-2].i * yyvsp[0].i;
        ;
    break;}
case 8:
#line 111 "gramspec/grammar"
{
#line 48  "startrule.gr0"
            d_rpn << " + ";
            yyval.i = yyvsp[-2].i + yyvsp[0].i;
        ;
    break;}
case 9:
#line 118 "gramspec/grammar"
{
#line 54  "startrule.gr0"
            yyval.i = yyvsp[-1].i;
        ;
    break;}
case 10:
#line 124 "gramspec/grammar"
{
#line 59  "startrule.gr0"
            d_rpn << " n ";
            yyval.i = -yyvsp[0].i;
        ;
    break;}
case 11:
#line 131 "gramspec/grammar"
{
#line 65  "startrule.gr0"
            yyval.i = A2x(d_scanner.YYText());
            d_rpn << " " << yyval.i << " ";
        ;
    break;}
case 12:
#line 140 "gramspec/grammar"
{
#line 73  "startrule.gr0"
            d_rpn << " * ";
            yyval.d = yyvsp[-2].d * yyvsp[0].d;
        ;
    break;}
case 13:
#line 147 "gramspec/grammar"
{
#line 79  "startrule.gr0"
            d_rpn << " + ";
            yyval.d = yyvsp[-2].d + yyvsp[0].d;
        ;
    break;}
case 14:
#line 154 "gramspec/grammar"
{
#line 85  "startrule.gr0"
            d_rpn << " * ";
            yyval.d = yyvsp[-2].d * yyvsp[0].i;
        ;
    break;}
case 15:
#line 161 "gramspec/grammar"
{
#line 91  "startrule.gr0"
            d_rpn << " + ";
            yyval.d = yyvsp[-2].d + yyvsp[0].i;
        ;
    break;}
case 16:
#line 168 "gramspec/grammar"
{
#line 97  "startrule.gr0"
            d_rpn << " * ";
            yyval.d = yyvsp[-2].i * yyvsp[0].d;
        ;
    break;}
case 17:
#line 175 "gramspec/grammar"
{
#line 103  "startrule.gr0"
            d_rpn << " + ";
            yyval.d = yyvsp[-2].i + yyvsp[0].d;
        ;
    break;}
case 18:
#line 182 "gramspec/grammar"
{
#line 109  "startrule.gr0"
            yyval.d = yyvsp[-1].d;
        ;
    break;}
case 19:
#line 188 "gramspec/grammar"
{
#line 114  "startrule.gr0"
            d_rpn << " n ";
            yyval.d = -yyvsp[0].d;
        ;
    break;}
case 20:
#line 195 "gramspec/grammar"
{
#line 120  "startrule.gr0"
            yyval.d = A2x(d_scanner.YYText());
            d_rpn << " " << yyval.d << " ";
        ;
    break;}
}

#line 697 "/usr/local/lib/bison.cc"
   /* the action file gets copied in in place of this dollarsign  */
  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YY_Parser_LSP_NEEDED
  yylsp -= yylen;
#endif

#if YY_Parser_DEBUG != 0
  if (YY_Parser_DEBUG_FLAG)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
        fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YY_Parser_LSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = YY_Parser_LLOC.first_line;
      yylsp->first_column = YY_Parser_LLOC.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++YY_Parser_NERRS;

#ifdef YY_Parser_ERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
        {
          int size = 0;
          char *msg;
          int x, count;

          count = 0;
          for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
            if (yycheck[x + yyn] == x)
              size += strlen(yytname[x]) + 15, count++;
          msg = (char *) malloc(size + 15);
          if (msg != 0)
            {
              strcpy(msg, "parse error");

              if (count < 5)
                {
                  count = 0;
                  for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
                    if (yycheck[x + yyn] == x)
                      {
                        strcat(msg, count == 0 ? ", expecting `" : " or `");
                        strcat(msg, yytname[x]);
                        strcat(msg, "'");
                        count++;
                      }
                }
              YY_Parser_ERROR(msg);
              free(msg);
            }
          else
            YY_Parser_ERROR ("parse error; also virtual memory exceeded");
        }
      else
#endif /* YY_Parser_ERROR_VERBOSE */
        YY_Parser_ERROR("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (YY_Parser_CHAR == YYEOF)
        YYABORT;

#if YY_Parser_DEBUG != 0
      if (YY_Parser_DEBUG_FLAG)
        fprintf(stderr, "Discarding token %d (%s).\n", YY_Parser_CHAR, yytname[yychar1]);
#endif

      YY_Parser_CHAR = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;              /* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YY_Parser_LSP_NEEDED
  yylsp--;
#endif

#if YY_Parser_DEBUG != 0
  if (YY_Parser_DEBUG_FLAG)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
        fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
        goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YY_Parser_DEBUG != 0
  if (YY_Parser_DEBUG_FLAG)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = YY_Parser_LVAL;
#ifdef YY_Parser_LSP_NEEDED
  *++yylsp = YY_Parser_LLOC;
#endif

  yystate = yyn;
  goto yynewstate;
}

/* END */

/* #line 891 "/usr/local/lib/bison.cc" */
#line 203 "gramspec/grammar"

Generated by  Doxygen 1.6.0   Back to index