/* A Bison parser, made by GNU Bison 2.1.  */

/* C++ Skeleton parser for LALR(1) parsing with Bison,
   Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.

   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 2, 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., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.  */
/* FIXME: This is wrong, we want computed header guards.
   I don't know why the macros are missing now. :( */
#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H

#include <string>
#include <iostream>

/* Using locations.  */
#define YYLSP_NEEDED 1

namespace yy
{
  class position;
  class location;
}

/* Tokens.  */
   enum yytokentype {
     LEX_V_EOF = 0,
     LEX_V_NULL = 258,
     LEX_V_ERROR = 259,
     LEX_V_ABS = 260,
     LEX_V_ACCESS = 261,
     LEX_V_AFTER = 262,
     LEX_V_ALIAS = 263,
     LEX_V_ALL = 264,
     LEX_V_AND = 265,
     LEX_V_ARCHITECTURE = 266,
     LEX_V_ARRAY = 267,
     LEX_V_ASSERT = 268,
     LEX_V_ATTRIBUTE = 269,
     LEX_V_BEGIN = 270,
     LEX_V_BLOCK = 271,
     LEX_V_BODY = 272,
     LEX_V_BUFFER = 273,
     LEX_V_BUS = 274,
     LEX_V_CASE = 275,
     LEX_V_COMPONENT = 276,
     LEX_V_CONFIGURATION = 277,
     LEX_V_CONSTANT = 278,
     LEX_V_DISCONNECT = 279,
     LEX_V_DOWNTO = 280,
     LEX_V_ELSE = 281,
     LEX_V_ELSIF = 282,
     LEX_V_END = 283,
     LEX_V_ENTITY = 284,
     LEX_V_EXIT = 285,
     LEX_V_FILE = 286,
     LEX_V_FOR = 287,
     LEX_V_FUNCTION = 288,
     LEX_V_GENERATE = 289,
     LEX_V_GENERIC = 290,
     LEX_V_GROUP = 291,
     LEX_V_GUARDED = 292,
     LEX_V_IF = 293,
     LEX_V_IMPURE = 294,
     LEX_V_IN = 295,
     LEX_V_INERTIAL = 296,
     LEX_V_INOUT = 297,
     LEX_V_IS = 298,
     LEX_V_LABEL = 299,
     LEX_V_LIBRARY = 300,
     LEX_V_LINKAGE = 301,
     LEX_V_LITERAL = 302,
     LEX_V_LOOP = 303,
     LEX_V_MAP = 304,
     LEX_V_NAND = 305,
     LEX_V_NEW = 306,
     LEX_V_NEXT = 307,
     LEX_V_NOR = 308,
     LEX_V_NOT = 309,
     LEX_V_OF = 310,
     LEX_V_ON = 311,
     LEX_V_OPEN = 312,
     LEX_V_OR = 313,
     LEX_V_OTHERS = 314,
     LEX_V_OUT = 315,
     LEX_V_PACKAGE = 316,
     LEX_V_PORT = 317,
     LEX_V_POSTOPENED = 318,
     LEX_V_PROCEDURE = 319,
     LEX_V_PROCESS = 320,
     LEX_V_PROTECTED = 321,
     LEX_V_PURE = 322,
     LEX_V_RANGE = 323,
     LEX_V_RECORD = 324,
     LEX_V_REGISTER = 325,
     LEX_V_REJECT = 326,
     LEX_V_REM = 327,
     LEX_V_REPORT = 328,
     LEX_V_RETURN = 329,
     LEX_V_ROL = 330,
     LEX_V_ROR = 331,
     LEX_V_SELECT = 332,
     LEX_V_SEVERENITY = 333,
     LEX_V_SHARED = 334,
     LEX_V_SIGNAL = 335,
     LEX_V_SLA = 336,
     LEX_V_SLL = 337,
     LEX_V_SRA = 338,
     LEX_V_SRL = 339,
     LEX_V_SUBTYPE = 340,
     LEX_V_THEN = 341,
     LEX_V_TO = 342,
     LEX_V_TRANSPORT = 343,
     LEX_V_TYPE = 344,
     LEX_V_UNAFFECTED = 345,
     LEX_V_UNITS = 346,
     LEX_V_UNTIL = 347,
     LEX_V_USE = 348,
     LEX_V_VARIABLE = 349,
     LEX_V_WAIT = 350,
     LEX_V_WHEN = 351,
     LEX_V_WHILE = 352,
     LEX_V_WITH = 353,
     LEX_V_XNOR = 354,
     LEX_V_XOR = 355,
     LEX_V_LITCHAR = 356,
     LEX_V_LITSTRING = 357,
     LEX_V_LITBITSTR = 358,
     LEX_V_IDENT = 359,
     LEX_V_SLASH = 360,
     LEX_V_EQUAL = 361,
     LEX_V_GRT = 362,
     LEX_V_LESS = 363,
     LEX_V_AMPER = 364,
     LEX_V_QUOT = 365,
     LEX_V_SQUOT = 366,
     LEX_V_LPAR = 367,
     LEX_V_RPAR = 368,
     LEX_V_SLPAR = 369,
     LEX_V_SRPAR = 370,
     LEX_V_DOT = 371,
     LEX_V_COMMA = 372,
     LEX_V_CROSS = 373,
     LEX_V_VLINE = 374,
     LEX_V_LOEQ = 375,
     LEX_V_GOREQ = 376,
     LEX_V_NEQ = 377,
     LEX_V_RHOMB = 378,
     LEX_V_ASSIGN = 379,
     LEX_V_POWER = 380,
     LEX_V_DDOT = 381,
     LEX_V_ASR = 382,
     LEX_V_SEMICOL = 383,
     LEX_V_MINUS = 384,
     LEX_V_PLUS = 385,
     LEX_V_MOD = 386,
     LEX_V_ASTER = 387,
     LEX_V_NEG = 388,
     LEX_V_LITABSTR = 389
   };


/* Copy the first part of user declarations.  */
#line 9 "vhdl_bison_parser.ypp"

#define yylex(yylval, location) lex.NextToken( (yylval) , (location) )
#include <string>
#include <iostream>


#include "vhdl_parser_struct.h"
#define YYSTYPE vhdl_types

#include "vhdl_parser.h"
#include "vhdl_err.h"

using namespace std;


/* Line 321 of lalr1.cc.  */
#line 194 "vhdl_bison_parser.hpp"

#include "stack.hh"
#include "location.hh"

/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 1
#endif

#if YYERROR_VERBOSE
# define YYERROR_VERBOSE_IF(x) x
#else
# define YYERROR_VERBOSE_IF(x) /* empty */
#endif

/* Enabling the token table.  */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
#endif

#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif

/* Copy the second part of user declarations.  */


/* Line 321 of lalr1.cc.  */
#line 234 "vhdl_bison_parser.hpp"
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
   If N is 0, then set CURRENT to the empty location which ends
   the previous symbol: RHS[0] (always defined).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)		\
do {							\
  if (N)						\
    {							\
      (Current).begin = (Rhs)[1].begin;			\
      (Current).end   = (Rhs)[N].end;			\
    }							\
  else							\
    {							\
      (Current).begin = (Current).end = (Rhs)[0].end;	\
    }							\
} while (0)
#endif

namespace yy
{
  class VhdlBisonParser;

  template <typename P>
  struct traits
  {
  };

  template <>
  struct traits<VhdlBisonParser>
  {
    typedef unsigned char token_number_type;
    typedef short int       rhs_number_type;
    typedef int state_type;
    typedef YYSTYPE semantic_type;
    typedef location location_type;
  };
}

namespace yy
{
  /// A Bison parser.
  class VhdlBisonParser
  {
    /// Symbol semantic values.
    typedef traits<VhdlBisonParser>::semantic_type semantic_type;
    /// Symbol locations.
    typedef traits<VhdlBisonParser>::location_type location_type;

  public:
    /// Build a parser object.
    VhdlBisonParser (LexanVhdl& lex_yyarg, VhdlParser& driver_yyarg) :
      yydebug_ (false),
      yycdebug_ (&std::cerr),
      lex (lex_yyarg),
      driver (driver_yyarg)
    {
    }

    virtual ~VhdlBisonParser ()
    {
    }

    /// Parse.
    /// \returns  0 iff parsing succeeded.
    virtual int parse ();

    /// The current debugging stream.
    std::ostream& debug_stream () const;
    /// Set the current debugging stream.
    void set_debug_stream (std::ostream &);

    /// Type for debugging levels.
    typedef int debug_level_type;
    /// The current debugging level.
    debug_level_type debug_level () const;
    /// Set the current debugging level.
    void set_debug_level (debug_level_type l);

  private:
    /// Report a syntax error.
    /// \param loc    where the syntax error is found.
    /// \param msg    a description of the syntax error.
    virtual void error (const location_type& loc, const std::string& msg);

    /// Generate an error message.
    /// \param tok    the look-ahead token.
    virtual std::string yysyntax_error_ (YYERROR_VERBOSE_IF (int tok));

#if YYDEBUG
    /// \brief Report a symbol on the debug stream.
    /// \param yytype       The token type.
    /// \param yyvaluep     Its semantic value.
    /// \param yylocationp  Its location.
    virtual void yysymprint_ (int yytype,
			      const semantic_type* yyvaluep,
			      const location_type* yylocationp);
#endif /* ! YYDEBUG */


    /// State numbers.
    typedef traits<VhdlBisonParser>::state_type state_type;
    /// State stack type.
    typedef stack<state_type>    state_stack_type;
    /// Semantic value stack type.
    typedef stack<semantic_type> semantic_stack_type;
    /// location stack type.
    typedef stack<location_type> location_stack_type;

    /// The state stack.
    state_stack_type yystate_stack_;
    /// The semantic value stack.
    semantic_stack_type yysemantic_stack_;
    /// The location stack.
    location_stack_type yylocation_stack_;

    /// Internal symbol numbers.
    typedef traits<VhdlBisonParser>::token_number_type token_number_type;
    /* Tables.  */
    /// For a state, the index in \a yytable_ of its portion.
    static const short int yypact_[];
    static const short int yypact_ninf_;

    /// For a state, default rule to reduce.
    /// Unless\a  yytable_ specifies something else to do.
    /// Zero means the default is an error.
    static const unsigned short int yydefact_[];

    static const short int yypgoto_[];
    static const short int yydefgoto_[];

    /// What to do in a state.
    /// \a yytable_[yypact_[s]]: what to do in state \a s.
    /// - if positive, shift that token.
    /// - if negative, reduce the rule which number is the opposite.
    /// - if zero, do what YYDEFACT says.
    static const short int yytable_[];
    static const short int yytable_ninf_;

    static const short int yycheck_[];

    /// For a state, its accessing symbol.
    static const unsigned short int yystos_[];

    /// For a rule, its LHS.
    static const unsigned short int yyr1_[];
    /// For a rule, its RHS length.
    static const unsigned char yyr2_[];

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
    /// For a symbol, its name in clear.
    static const char* const yytname_[];
#endif

#if YYERROR_VERBOSE
    /// Convert the symbol name \a n to a form suitable for a diagnostic.
    virtual std::string yytnamerr_ (const char *n);
#endif

#if YYDEBUG
    /// A type to store symbol numbers and -1.
    typedef traits<VhdlBisonParser>::rhs_number_type rhs_number_type;
    /// A `-1'-separated list of the rules' RHS.
    static const rhs_number_type yyrhs_[];
    /// For each rule, the index of the first RHS symbol in \a yyrhs_.
    static const unsigned short int yyprhs_[];
    /// For each rule, its source line number.
    static const unsigned short int yyrline_[];
    /// For each scanner token number, its symbol number.
    static const unsigned short int yytoken_number_[];
    /// Report on the debug stream that the rule \a r is going to be reduced.
    virtual void yyreduce_print_ (int r);
    /// Print the state stack on the debug stream.
    virtual void yystack_print_ ();
#endif

    /// Convert a scanner token number to a symbol number.
    inline token_number_type yytranslate_ (int token);

    /// \brief Reclaim the memory associated to a symbol.
    /// \param yymsg        Why this token is reclaimed.
    /// \param yytype       The symbol type.
    /// \param yyvaluep     Its semantic value.
    /// \param yylocationp  Its location.
    inline void yydestruct_ (const char* yymsg,
                             int yytype,
                             semantic_type* yyvaluep,
                             location_type* yylocationp);

    /// Pop \a n symbols the three stacks.
    inline void yypop_ (unsigned int n = 1);

    /* Constants.  */
    static const int yyeof_;
    /* LAST_ -- Last index in TABLE_.  */
    static const int yylast_;
    static const int yynnts_;
    static const int yyempty_;
    static const int yyfinal_;
    static const int yyterror_;
    static const int yyerrcode_;
    static const int yyntokens_;
    static const unsigned int yyuser_token_number_max_;
    static const token_number_type yyundef_token_;

    /* State.  */
    int yyn_;
    int yylen_;
    int yystate_;

    /* Error handling. */
    int yynerrs_;
    int yyerrstatus_;

    /* Debugging.  */
    int yydebug_;
    std::ostream* yycdebug_;


    /* User arguments.  */
    LexanVhdl& lex;
    VhdlParser& driver;
  };
}

#endif /* ! defined PARSER_HEADER_H */
