view Bison-Flex/Compiler-StackBase/UTF8/script-parser.cc @ 6:86c0a38332fe

update
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 17 May 2011 18:26:00 +0900
parents caede627f691
children
line wrap: on
line source

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

/* Skeleton implementation for Bison LALR(1) parsers in C++

   Copyright (C) 2002, 2003, 2004, 2005, 2006 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.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */


#include "script-parser.hh"

/* User implementation prologue.  */
#line 44 "script-parser.yy"

#include "compiler.h"


/* Line 317 of lalr1.cc.  */
#line 46 "script-parser.cc"

#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(msgid) msgid
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#define YYUSE(e) ((void) (e))

/* A pseudo ostream that takes yydebug_ into account.  */
# define YYCDEBUG							\
  for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false)	\
    (*yycdebug_)

/* Enable debugging if requested.  */
#if YYDEBUG

# define YY_SYMBOL_PRINT(Title, Type, Value, Location)	\
do {							\
  if (yydebug_)						\
    {							\
      *yycdebug_ << Title << ' ';			\
      yy_symbol_print_ ((Type), (Value), (Location));	\
      *yycdebug_ << std::endl;				\
    }							\
} while (false)

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug_)				\
    yy_reduce_print_ (Rule);		\
} while (false)

# define YY_STACK_PRINT()		\
do {					\
  if (yydebug_)				\
    yystack_print_ ();			\
} while (false)

#else /* !YYDEBUG */

# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_REDUCE_PRINT(Rule)
# define YY_STACK_PRINT()

#endif /* !YYDEBUG */

#define YYACCEPT	goto yyacceptlab
#define YYABORT		goto yyabortlab
#define YYERROR		goto yyerrorlab

namespace yy
{
#if YYERROR_VERBOSE

  /* Return YYSTR after stripping away unnecessary quotes and
     backslashes, so that it's suitable for yyerror.  The heuristic is
     that double-quoting is unnecessary unless the string contains an
     apostrophe, a comma, or backslash (other than backslash-backslash).
     YYSTR is taken from yytname.  */
  std::string
  script_parser::yytnamerr_ (const char *yystr)
  {
    if (*yystr == '"')
      {
        std::string yyr = "";
        char const *yyp = yystr;

        for (;;)
          switch (*++yyp)
            {
            case '\'':
            case ',':
              goto do_not_strip_quotes;

            case '\\':
              if (*++yyp != '\\')
                goto do_not_strip_quotes;
              /* Fall through.  */
            default:
              yyr += *yyp;
              break;

            case '"':
              return yyr;
            }
      do_not_strip_quotes: ;
      }

    return yystr;
  }

#endif

  /// Build a parser object.
  script_parser::script_parser (compiler& driver_yyarg)
    : yydebug_ (false),
      yycdebug_ (&std::cerr),
      driver (driver_yyarg)
  {
  }

  script_parser::~script_parser ()
  {
  }

#if YYDEBUG
  /*--------------------------------.
  | Print this symbol on YYOUTPUT.  |
  `--------------------------------*/

  inline void
  script_parser::yy_symbol_value_print_ (int yytype,
			   const semantic_type* yyvaluep, const location_type* yylocationp)
  {
    YYUSE (yylocationp);
    YYUSE (yyvaluep);
    switch (yytype)
      {
         default:
	  break;
      }
  }


  void
  script_parser::yy_symbol_print_ (int yytype,
			   const semantic_type* yyvaluep, const location_type* yylocationp)
  {
    *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
	       << ' ' << yytname_[yytype] << " ("
	       << *yylocationp << ": ";
    yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
    *yycdebug_ << ')';
  }
#endif /* ! YYDEBUG */

  void
  script_parser::yydestruct_ (const char* yymsg,
			   int yytype, semantic_type* yyvaluep, location_type* yylocationp)
  {
    YYUSE (yylocationp);
    YYUSE (yymsg);
    YYUSE (yyvaluep);

    YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

    switch (yytype)
      {
        case 4: /* "\"identifier\"" */
#line 95 "script-parser.yy"
	{ delete (yyvaluep->sval); };
#line 206 "script-parser.cc"
	break;
      case 5: /* "\"sval\"" */
#line 96 "script-parser.yy"
	{ delete (yyvaluep->sval); };
#line 211 "script-parser.cc"
	break;
      case 58: /* "value_list" */
#line 98 "script-parser.yy"
	{ delete (yyvaluep->value_list); };
#line 216 "script-parser.cc"
	break;
      case 59: /* "arglist" */
#line 99 "script-parser.yy"
	{ delete (yyvaluep->arglist); };
#line 221 "script-parser.cc"
	break;
      case 60: /* "arg" */
#line 100 "script-parser.yy"
	{ delete (yyvaluep->argdef); };
#line 226 "script-parser.cc"
	break;
      case 63: /* "block" */
#line 104 "script-parser.yy"
	{ delete (yyvaluep->block); };
#line 231 "script-parser.cc"
	break;
      case 64: /* "decl_list" */
#line 101 "script-parser.yy"
	{ delete (yyvaluep->decls); };
#line 236 "script-parser.cc"
	break;
      case 65: /* "state_list" */
#line 102 "script-parser.yy"
	{ delete (yyvaluep->states); };
#line 241 "script-parser.cc"
	break;
      case 66: /* "decls" */
#line 101 "script-parser.yy"
	{ delete (yyvaluep->decls); };
#line 246 "script-parser.cc"
	break;
      case 67: /* "states" */
#line 102 "script-parser.yy"
	{ delete (yyvaluep->states); };
#line 251 "script-parser.cc"
	break;
      case 68: /* "statement" */
#line 106 "script-parser.yy"
	{ delete (yyvaluep->statement); };
#line 256 "script-parser.cc"
	break;
      case 69: /* "assign" */
#line 105 "script-parser.yy"
	{ delete (yyvaluep->assign); };
#line 261 "script-parser.cc"
	break;
      case 70: /* "expr" */
#line 108 "script-parser.yy"
	{ delete (yyvaluep->expr); };
#line 266 "script-parser.cc"
	break;
      case 71: /* "value" */
#line 107 "script-parser.yy"
	{ delete (yyvaluep->value); };
#line 271 "script-parser.cc"
	break;
      case 72: /* "args" */
#line 103 "script-parser.yy"
	{ delete (yyvaluep->args); };
#line 276 "script-parser.cc"
	break;

	default:
	  break;
      }
  }

  void
  script_parser::yypop_ (unsigned int n)
  {
    yystate_stack_.pop (n);
    yysemantic_stack_.pop (n);
    yylocation_stack_.pop (n);
  }

  std::ostream&
  script_parser::debug_stream () const
  {
    return *yycdebug_;
  }

  void
  script_parser::set_debug_stream (std::ostream& o)
  {
    yycdebug_ = &o;
  }


  script_parser::debug_level_type
  script_parser::debug_level () const
  {
    return yydebug_;
  }

  void
  script_parser::set_debug_level (debug_level_type l)
  {
    yydebug_ = l;
  }


  int
  script_parser::parse ()
  {
    /// Look-ahead and look-ahead in internal form.
    int yychar = yyempty_;
    int yytoken = 0;

    /* State.  */
    int yyn;
    int yylen = 0;
    int yystate = 0;

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

    /// Semantic value of the look-ahead.
    semantic_type yylval;
    /// Location of the look-ahead.
    location_type yylloc;
    /// The locations where the error started and ended.
    location yyerror_range[2];

    /// $$.
    semantic_type yyval;
    /// @$.
    location_type yyloc;

    int yyresult;

    YYCDEBUG << "Starting parse" << std::endl;


    /* User initialization code.  */
    #line 19 "script-parser.yy"
{
	// ロケーション初期化
	yylloc.begin.filename = yylloc.end.filename = &driver.get_filename();
}
  /* Line 555 of yacc.c.  */
#line 358 "script-parser.cc"
    /* Initialize the stacks.  The initial state will be pushed in
       yynewstate, since the latter expects the semantical and the
       location values to have been already stored, initialize these
       stacks with a primary value.  */
    yystate_stack_ = state_stack_type (0);
    yysemantic_stack_ = semantic_stack_type (0);
    yylocation_stack_ = location_stack_type (0);
    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yylloc);

    /* New state.  */
  yynewstate:
    yystate_stack_.push (yystate);
    YYCDEBUG << "Entering state " << yystate << std::endl;
    goto yybackup;

    /* Backup.  */
  yybackup:

    /* Try to take a decision without look-ahead.  */
    yyn = yypact_[yystate];
    if (yyn == yypact_ninf_)
      goto yydefault;

    /* Read a look-ahead token.  */
    if (yychar == yyempty_)
      {
	YYCDEBUG << "Reading a token: ";
	yychar = yylex (&yylval, &yylloc, driver);
      }


    /* Convert token to internal form.  */
    if (yychar <= yyeof_)
      {
	yychar = yytoken = yyeof_;
	YYCDEBUG << "Now at end of input." << std::endl;
      }
    else
      {
	yytoken = yytranslate_ (yychar);
	YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
      }

    /* If the proper action on seeing token YYTOKEN is to reduce or to
       detect an error, take that action.  */
    yyn += yytoken;
    if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
      goto yydefault;

    /* Reduce or error.  */
    yyn = yytable_[yyn];
    if (yyn <= 0)
      {
	if (yyn == 0 || yyn == yytable_ninf_)
	goto yyerrlab;
	yyn = -yyn;
	goto yyreduce;
      }

    /* Accept?  */
    if (yyn == yyfinal_)
      goto yyacceptlab;

    /* Shift the look-ahead token.  */
    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

    /* Discard the token being shifted unless it is eof.  */
    if (yychar != yyeof_)
      yychar = yyempty_;

    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yylloc);

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

    yystate = yyn;
    goto yynewstate;

  /*-----------------------------------------------------------.
  | yydefault -- do the default action for the current state.  |
  `-----------------------------------------------------------*/
  yydefault:
    yyn = yydefact_[yystate];
    if (yyn == 0)
      goto yyerrlab;
    goto yyreduce;

  /*-----------------------------.
  | yyreduce -- Do a reduction.  |
  `-----------------------------*/
  yyreduce:
    yylen = yyr2_[yyn];
    /* If YYLEN is nonzero, implement the default value of the action:
       `$$ = $1'.  Otherwise, use the top of the stack.

       Otherwise, the following line sets YYVAL to garbage.
       This behavior is undocumented and Bison
       users should not rely upon it.  */
    if (yylen)
      yyval = yysemantic_stack_[yylen - 1];
    else
      yyval = yysemantic_stack_[0];

    {
      slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
      YYLLOC_DEFAULT (yyloc, slice, yylen);
    }
    YY_REDUCE_PRINT (yyn);
    switch (yyn)
      {
	  case 7:
#line 130 "script-parser.yy"
    { driver.DefineValue((yylocation_stack_[(3) - (2)]), (yysemantic_stack_[(3) - (1)].type), (yysemantic_stack_[(3) - (2)].value_list)); ;}
    break;

  case 8:
#line 131 "script-parser.yy"
    { driver.DefineFunction((yylocation_stack_[(5) - (2)]), (yysemantic_stack_[(5) - (1)].type), (yysemantic_stack_[(5) - (2)].sval), NULL); ;}
    break;

  case 9:
#line 132 "script-parser.yy"
    { driver.DefineFunction((yylocation_stack_[(6) - (2)]), (yysemantic_stack_[(6) - (1)].type), (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist)); ;}
    break;

  case 10:
#line 133 "script-parser.yy"
    { driver.DefineFunction((yylocation_stack_[(5) - (2)]), TYPE_VOID, (yysemantic_stack_[(5) - (2)].sval), NULL); ;}
    break;

  case 11:
#line 134 "script-parser.yy"
    { driver.DefineFunction((yylocation_stack_[(6) - (2)]), TYPE_VOID, (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist)); ;}
    break;

  case 12:
#line 135 "script-parser.yy"
    { driver.DefineFunction((yylocation_stack_[(5) - (2)]), TYPE_CODE, (yysemantic_stack_[(5) - (2)].sval), NULL); ;}
    break;

  case 13:
#line 136 "script-parser.yy"
    { driver.DefineFunction((yylocation_stack_[(6) - (2)]), TYPE_CODE, (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist)); ;}
    break;

  case 14:
#line 139 "script-parser.yy"
    { (yyval.value_list) = new CValueList((yysemantic_stack_[(1) - (1)].value)); ;}
    break;

  case 15:
#line 140 "script-parser.yy"
    { (yyval.value_list) = (yysemantic_stack_[(3) - (1)].value_list)->Add((yysemantic_stack_[(3) - (3)].value)); ;}
    break;

  case 16:
#line 143 "script-parser.yy"
    { (yyval.arglist) = new CArgList((yysemantic_stack_[(1) - (1)].argdef)); ;}
    break;

  case 17:
#line 144 "script-parser.yy"
    { (yyval.arglist) = (yysemantic_stack_[(3) - (1)].arglist)->Add((yysemantic_stack_[(3) - (3)].argdef)); ;}
    break;

  case 18:
#line 147 "script-parser.yy"
    { (yyval.argdef) = new CArgDef((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].type), NULL); ;}
    break;

  case 19:
#line 148 "script-parser.yy"
    { (yyval.argdef) = new CArgDef((yylocation_stack_[(2) - (1)]), TypeToRef((yysemantic_stack_[(2) - (1)].type)), NULL); ;}
    break;

  case 20:
#line 149 "script-parser.yy"
    { (yyval.argdef) = new CArgDef((yylocation_stack_[(2) - (1)]), (yysemantic_stack_[(2) - (1)].type), (yysemantic_stack_[(2) - (2)].sval)); ;}
    break;

  case 21:
#line 150 "script-parser.yy"
    { (yyval.argdef) = new CArgDef((yylocation_stack_[(3) - (1)]), TypeToRef((yysemantic_stack_[(3) - (1)].type)), (yysemantic_stack_[(3) - (3)].sval)); ;}
    break;

  case 22:
#line 151 "script-parser.yy"
    { (yyval.argdef) = new CArgDef((yylocation_stack_[(4) - (1)]), TypeToRef((yysemantic_stack_[(4) - (1)].type)), (yysemantic_stack_[(4) - (2)].sval)); ;}
    break;

  case 23:
#line 152 "script-parser.yy"
    { (yyval.argdef) = new CArgDef((yylocation_stack_[(5) - (1)]), TypeToRef((yysemantic_stack_[(5) - (1)].type)), (yysemantic_stack_[(5) - (3)].sval)); ;}
    break;

  case 24:
#line 155 "script-parser.yy"
    { driver.AddFunction((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (1)].type), (yysemantic_stack_[(5) - (2)].sval), NULL, (yysemantic_stack_[(5) - (5)].block)); ;}
    break;

  case 25:
#line 156 "script-parser.yy"
    { driver.AddFunction((yylocation_stack_[(6) - (1)]), (yysemantic_stack_[(6) - (1)].type), (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist), (yysemantic_stack_[(6) - (6)].block)); ;}
    break;

  case 26:
#line 157 "script-parser.yy"
    { driver.AddFunction((yylocation_stack_[(5) - (1)]), TYPE_VOID, (yysemantic_stack_[(5) - (2)].sval), NULL, (yysemantic_stack_[(5) - (5)].block)); ;}
    break;

  case 27:
#line 158 "script-parser.yy"
    { driver.AddFunction((yylocation_stack_[(6) - (1)]), TYPE_VOID, (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist), (yysemantic_stack_[(6) - (6)].block)); ;}
    break;

  case 28:
#line 159 "script-parser.yy"
    { driver.AddGotoFunction((yylocation_stack_[(5) - (1)]), TYPE_CODE, (yysemantic_stack_[(5) - (2)].sval), NULL, (yysemantic_stack_[(5) - (5)].block)); ;}
    break;

  case 29:
#line 160 "script-parser.yy"
    { driver.AddGotoFunction((yylocation_stack_[(6) - (1)]), TYPE_CODE, (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].arglist), (yysemantic_stack_[(6) - (6)].block)); ;}
    break;

  case 30:
#line 163 "script-parser.yy"
    { (yyval.type) = TYPE_INTEGER; ;}
    break;

  case 31:
#line 164 "script-parser.yy"
    { (yyval.type) = TYPE_STRING; ;}
    break;

  case 32:
#line 167 "script-parser.yy"
    { (yyval.block) = new CStateBlock((yysemantic_stack_[(4) - (2)].decls), (yysemantic_stack_[(4) - (3)].states)); ;}
    break;

  case 33:
#line 170 "script-parser.yy"
    { (yyval.decls) = NULL ;}
    break;

  case 34:
#line 171 "script-parser.yy"
    { (yyval.decls) = (yysemantic_stack_[(1) - (1)].decls) ;}
    break;

  case 35:
#line 174 "script-parser.yy"
    { (yyval.states) = NULL ;}
    break;

  case 36:
#line 175 "script-parser.yy"
    { (yyval.states) = (yysemantic_stack_[(1) - (1)].states) ;}
    break;

  case 37:
#line 178 "script-parser.yy"
    { (yyval.decls) = new CDeclList(new CDecl((yysemantic_stack_[(3) - (1)].type), (yysemantic_stack_[(3) - (2)].value_list))); ;}
    break;

  case 38:
#line 179 "script-parser.yy"
    { (yyval.decls) = (yysemantic_stack_[(4) - (1)].decls)->Add(new CDecl((yysemantic_stack_[(4) - (2)].type), (yysemantic_stack_[(4) - (3)].value_list))); ;}
    break;

  case 39:
#line 182 "script-parser.yy"
    { (yyval.states) = new CStateList((yysemantic_stack_[(1) - (1)].statement)); ;}
    break;

  case 40:
#line 183 "script-parser.yy"
    { (yyval.states) = (yysemantic_stack_[(2) - (1)].states)->Add((yysemantic_stack_[(2) - (2)].statement)); ;}
    break;

  case 41:
#line 186 "script-parser.yy"
    { (yyval.statement) = new CNopStatement((yylocation_stack_[(1) - (1)])); ;}
    break;

  case 42:
#line 187 "script-parser.yy"
    { (yyval.statement) = new CAssignStatement((yylocation_stack_[(2) - (1)]), (yysemantic_stack_[(2) - (1)].assign)); ;}
    break;

  case 43:
#line 188 "script-parser.yy"
    { (yyval.statement) = new CFunctionStatement((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (1)].sval), (yysemantic_stack_[(5) - (3)].args)); ;}
    break;

  case 44:
#line 189 "script-parser.yy"
    { (yyval.statement) = new CFunctionStatement((yylocation_stack_[(4) - (1)]), (yysemantic_stack_[(4) - (1)].sval), NULL); ;}
    break;

  case 45:
#line 190 "script-parser.yy"
    { driver.AddExit((yylocation_stack_[(4) - (1)]), TYPE_EXIT); ;}
    break;

  case 46:
#line 191 "script-parser.yy"
    { (yyval.statement) = new CGotoFunctionStatement((yylocation_stack_[(6) - (1)]), (yysemantic_stack_[(6) - (2)].sval), (yysemantic_stack_[(6) - (4)].args)); ;}
    break;

  case 47:
#line 192 "script-parser.yy"
    { (yyval.statement) = new CGotoFunctionStatement((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (2)].sval), NULL); ;}
    break;

  case 48:
#line 193 "script-parser.yy"
    { (yyval.statement) = new CCaseStatement((yylocation_stack_[(3) - (1)]), (yysemantic_stack_[(3) - (2)].expr)); ;}
    break;

  case 49:
#line 194 "script-parser.yy"
    { (yyval.statement) = new CDefaultStatement((yylocation_stack_[(2) - (1)])); ;}
    break;

  case 50:
#line 195 "script-parser.yy"
    { (yyval.statement) = new CBreakStatement((yylocation_stack_[(2) - (1)])); ;}
    break;

  case 51:
#line 196 "script-parser.yy"
    { (yyval.statement) = new CReturnStatement((yylocation_stack_[(2) - (1)]), NULL); ;}
    break;

  case 52:
#line 197 "script-parser.yy"
    { (yyval.statement) = new CReturnStatement((yylocation_stack_[(3) - (1)]), (yysemantic_stack_[(3) - (2)].expr)); ;}
    break;

  case 53:
#line 198 "script-parser.yy"
    { (yyval.statement) = new CIfStatement((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (3)].expr), (yysemantic_stack_[(5) - (5)].statement)); ;}
    break;

  case 54:
#line 199 "script-parser.yy"
    { (yyval.statement) = new CIfStatement((yylocation_stack_[(7) - (1)]), (yysemantic_stack_[(7) - (3)].expr), (yysemantic_stack_[(7) - (5)].statement), (yysemantic_stack_[(7) - (7)].statement)); ;}
    break;

  case 55:
#line 201 "script-parser.yy"
    { (yyval.statement) = new CForStatement((yylocation_stack_[(9) - (1)]), (yysemantic_stack_[(9) - (3)].assign), (yysemantic_stack_[(9) - (5)].expr), (yysemantic_stack_[(9) - (7)].assign), (yysemantic_stack_[(9) - (9)].statement)); ;}
    break;

  case 56:
#line 202 "script-parser.yy"
    { (yyval.statement) = new CWhileStatement((yylocation_stack_[(5) - (1)]), (yysemantic_stack_[(5) - (3)].expr), (yysemantic_stack_[(5) - (5)].statement)); ;}
    break;

  case 57:
#line 203 "script-parser.yy"
    { (yyval.statement) = new CSwitchStatement((yylocation_stack_[(7) - (1)]), (yysemantic_stack_[(7) - (3)].expr), (yysemantic_stack_[(7) - (6)].states)); ;}
    break;

  case 58:
#line 204 "script-parser.yy"
    { (yyval.statement) = new CBlockStatement((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].block)); ;}
    break;

  case 59:
#line 207 "script-parser.yy"
    { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '=', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 60:
#line 208 "script-parser.yy"
    { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '+', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 61:
#line 209 "script-parser.yy"
    { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '-', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 62:
#line 210 "script-parser.yy"
    { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '*', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 63:
#line 211 "script-parser.yy"
    { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '/', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 64:
#line 212 "script-parser.yy"
    { (yyval.assign) = new CAssign((yylocation_stack_[(3) - (1)]), '%', (yysemantic_stack_[(3) - (1)].value), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 65:
#line 215 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LOGAND, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 66:
#line 216 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LOGOR, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 67:
#line 217 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_EQ, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 68:
#line 218 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_NE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 69:
#line 219 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_GT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 70:
#line 220 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_GE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 71:
#line 221 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 72:
#line 222 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 73:
#line 223 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_AND, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 74:
#line 224 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_OR, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 75:
#line 225 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_LSHIFT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 76:
#line 226 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_RSHIFT, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 77:
#line 227 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_MINUS, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 78:
#line 228 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_PLUS, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 79:
#line 229 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_TIMES, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 80:
#line 230 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_DIVIDE, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 81:
#line 231 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(3) - (2)]), OP_MOD, (yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); ;}
    break;

  case 82:
#line 232 "script-parser.yy"
    { (yyval.expr) = CNode::MakeNode(driver, (yylocation_stack_[(2) - (2)]), OP_NEG, (yysemantic_stack_[(2) - (2)].expr)); ;}
    break;

  case 83:
#line 233 "script-parser.yy"
    { (yyval.expr) = (yysemantic_stack_[(3) - (2)].expr); ;}
    break;

  case 84:
#line 234 "script-parser.yy"
    { (yyval.expr) = (yysemantic_stack_[(1) - (1)].value); ;}
    break;

  case 85:
#line 235 "script-parser.yy"
    { (yyval.expr) = new CNode((yylocation_stack_[(1) - (1)]), OP_CONST, (yysemantic_stack_[(1) - (1)].ival)); ;}
    break;

  case 86:
#line 236 "script-parser.yy"
    { (yyval.expr) = new CNode((yylocation_stack_[(1) - (1)]), OP_STRING, (yysemantic_stack_[(1) - (1)].sval)); ;}
    break;

  case 87:
#line 237 "script-parser.yy"
    { (yyval.expr) = new CFunctionNode((yylocation_stack_[(4) - (1)]), (yysemantic_stack_[(4) - (1)].sval), (yysemantic_stack_[(4) - (3)].args)); ;}
    break;

  case 88:
#line 238 "script-parser.yy"
    { (yyval.expr) = new CFunctionNode((yylocation_stack_[(3) - (1)]), (yysemantic_stack_[(3) - (1)].sval), NULL); ;}
    break;

  case 89:
#line 241 "script-parser.yy"
    { (yyval.value) = new CValueNode((yylocation_stack_[(1) - (1)]), (yysemantic_stack_[(1) - (1)].sval)); ;}
    break;

  case 90:
#line 242 "script-parser.yy"
    { (yyval.value) = new CValueNode((yylocation_stack_[(4) - (1)]), (yysemantic_stack_[(4) - (1)].sval), (yysemantic_stack_[(4) - (3)].expr)); ;}
    break;

  case 91:
#line 245 "script-parser.yy"
    { (yyval.args) = new CArgs((yysemantic_stack_[(1) - (1)].expr)); ;}
    break;

  case 92:
#line 246 "script-parser.yy"
    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args)->Add((yysemantic_stack_[(3) - (3)].expr)); ;}
    break;


    /* Line 675 of lalr1.cc.  */
#line 905 "script-parser.cc"
	default: break;
      }
    YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);

    yypop_ (yylen);
    yylen = 0;
    YY_STACK_PRINT ();

    yysemantic_stack_.push (yyval);
    yylocation_stack_.push (yyloc);

    /* Shift the result of the reduction.  */
    yyn = yyr1_[yyn];
    yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
    if (0 <= yystate && yystate <= yylast_
	&& yycheck_[yystate] == yystate_stack_[0])
      yystate = yytable_[yystate];
    else
      yystate = yydefgoto_[yyn - yyntokens_];
    goto yynewstate;

  /*------------------------------------.
  | yyerrlab -- here on detecting error |
  `------------------------------------*/
  yyerrlab:
    /* If not already recovering from an error, report this error.  */
    if (!yyerrstatus_)
      {
	++yynerrs_;
	error (yylloc, yysyntax_error_ (yystate, yytoken));
      }

    yyerror_range[0] = yylloc;
    if (yyerrstatus_ == 3)
      {
	/* If just tried and failed to reuse look-ahead token after an
	 error, discard it.  */

	if (yychar <= yyeof_)
	  {
	  /* Return failure if at end of input.  */
	  if (yychar == yyeof_)
	    YYABORT;
	  }
	else
	  {
	    yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
	    yychar = yyempty_;
	  }
      }

    /* Else will try to reuse look-ahead token after shifting the error
       token.  */
    goto yyerrlab1;


  /*---------------------------------------------------.
  | yyerrorlab -- error raised explicitly by YYERROR.  |
  `---------------------------------------------------*/
  yyerrorlab:

    /* Pacify compilers like GCC when the user code never invokes
       YYERROR and the label yyerrorlab therefore never appears in user
       code.  */
    if (false)
      goto yyerrorlab;

    yyerror_range[0] = yylocation_stack_[yylen - 1];
    /* Do not reclaim the symbols of the rule which action triggered
       this YYERROR.  */
    yypop_ (yylen);
    yylen = 0;
    yystate = yystate_stack_[0];
    goto yyerrlab1;

  /*-------------------------------------------------------------.
  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  `-------------------------------------------------------------*/
  yyerrlab1:
    yyerrstatus_ = 3;	/* Each real token shifted decrements this.  */

    for (;;)
      {
	yyn = yypact_[yystate];
	if (yyn != yypact_ninf_)
	{
	  yyn += yyterror_;
	  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
	    {
	      yyn = yytable_[yyn];
	      if (0 < yyn)
		break;
	    }
	}

	/* Pop the current state because it cannot handle the error token.  */
	if (yystate_stack_.height () == 1)
	YYABORT;

	yyerror_range[0] = yylocation_stack_[0];
	yydestruct_ ("Error: popping",
		     yystos_[yystate],
		     &yysemantic_stack_[0], &yylocation_stack_[0]);
	yypop_ ();
	yystate = yystate_stack_[0];
	YY_STACK_PRINT ();
      }

    if (yyn == yyfinal_)
      goto yyacceptlab;

    yyerror_range[1] = yylloc;
    // Using YYLLOC is tempting, but would change the location of
    // the look-ahead.  YYLOC is available though.
    YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yyloc);

    /* Shift the error token.  */
    YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
		   &yysemantic_stack_[0], &yylocation_stack_[0]);

    yystate = yyn;
    goto yynewstate;

    /* Accept.  */
  yyacceptlab:
    yyresult = 0;
    goto yyreturn;

    /* Abort.  */
  yyabortlab:
    yyresult = 1;
    goto yyreturn;

  yyreturn:
    if (yychar != yyeof_ && yychar != yyempty_)
      yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);

    /* Do not reclaim the symbols of the rule which action triggered
       this YYABORT or YYACCEPT.  */
    yypop_ (yylen);
    while (yystate_stack_.height () != 1)
      {
	yydestruct_ ("Cleanup: popping",
		   yystos_[yystate_stack_[0]],
		   &yysemantic_stack_[0],
		   &yylocation_stack_[0]);
	yypop_ ();
      }

    return yyresult;
  }

  // Generate an error message.
  std::string
  script_parser::yysyntax_error_ (int yystate, int tok)
  {
    std::string res;
    YYUSE (yystate);
#if YYERROR_VERBOSE
    int yyn = yypact_[yystate];
    if (yypact_ninf_ < yyn && yyn <= yylast_)
      {
	/* Start YYX at -YYN if negative to avoid negative indexes in
	   YYCHECK.  */
	int yyxbegin = yyn < 0 ? -yyn : 0;

	/* Stay within bounds of both yycheck and yytname.  */
	int yychecklim = yylast_ - yyn + 1;
	int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
	int count = 0;
	for (int x = yyxbegin; x < yyxend; ++x)
	  if (yycheck_[x + yyn] == x && x != yyterror_)
	    ++count;

	// FIXME: This method of building the message is not compatible
	// with internationalization.  It should work like yacc.c does it.
	// That is, first build a string that looks like this:
	// "syntax error, unexpected %s or %s or %s"
	// Then, invoke YY_ on this string.
	// Finally, use the string as a format to output
	// yytname_[tok], etc.
	// Until this gets fixed, this message appears in English only.
	res = "syntax error, unexpected ";
	res += yytnamerr_ (yytname_[tok]);
	if (count < 5)
	  {
	    count = 0;
	    for (int x = yyxbegin; x < yyxend; ++x)
	      if (yycheck_[x + yyn] == x && x != yyterror_)
		{
		  res += (!count++) ? ", expecting " : " or ";
		  res += yytnamerr_ (yytname_[x]);
		}
	  }
      }
    else
#endif
      res = YY_("syntax error");
    return res;
  }


  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     STATE-NUM.  */
  const short int script_parser::yypact_ninf_ = -133;
  const short int
  script_parser::yypact_[] =
  {
        78,   -32,  -133,  -133,    21,    33,     1,  -133,  -133,  -133,
      57,  -133,    18,    27,  -133,  -133,   -37,    46,  -133,   108,
     151,   156,    70,  -133,    77,   -35,    51,  -133,     2,   -34,
     196,    45,   208,  -133,    81,  -133,    70,    70,   183,  -133,
      64,  -133,  -133,   228,  -133,   105,   228,    80,   134,  -133,
    -133,   107,  -133,  -133,   154,    23,  -133,   199,    70,    70,
      70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
      70,    70,    70,    70,    70,  -133,    77,    61,   228,  -133,
    -133,  -133,    91,   104,  -133,  -133,  -133,  -133,  -133,   357,
     221,  -133,   366,   401,   410,   410,   410,   410,   -18,   -18,
     410,   410,   188,   188,   173,   173,  -133,  -133,  -133,   106,
     113,   121,   158,   171,   186,    70,   147,   200,   120,   254,
     251,  -133,  -133,   222,    61,  -133,   241,    86,    77,  -133,
     248,  -133,    70,  -133,    31,    70,    70,    77,    70,   135,
    -133,  -133,  -133,   307,   264,   252,  -133,  -133,  -133,    70,
      70,    70,    70,    70,    70,   139,  -133,   357,   266,   223,
     240,   253,   267,   294,  -133,  -133,   117,   268,   357,   357,
     357,   357,   357,   357,  -133,  -133,   277,    61,    61,    70,
     258,   278,   225,  -133,  -133,   303,  -133,   346,    61,  -133,
     280,    61,    77,   274,  -133,  -133,   281,  -133,    61,  -133
  };

  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
     doesn't specify something else to do.  Zero means the default is an
     error.  */
  const unsigned char
  script_parser::yydefact_[] =
  {
         0,     0,    30,    31,     0,     0,     0,     2,     6,     5,
       0,     4,     0,     0,     1,     3,    89,     0,    14,     0,
       0,     0,     0,     7,     0,     0,     0,    16,    18,     0,
       0,     0,     0,    85,    89,    86,     0,     0,     0,    84,
      89,    15,    10,    33,    26,     0,     0,    20,    19,    12,
      28,     0,     8,    24,     0,     0,    82,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,    90,     0,    35,    34,    11,
      27,    17,     0,    21,    13,    29,     9,    25,    88,    91,
       0,    83,    66,    65,    67,    68,    70,    72,    75,    76,
      69,    71,    73,    74,    78,    77,    79,    80,    81,     0,
      89,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,    41,    58,     0,    36,    39,     0,     0,     0,    22,
       0,    87,     0,    37,     0,     0,     0,     0,     0,     0,
      49,    50,    51,     0,     0,     0,    32,    40,    42,     0,
       0,     0,     0,     0,     0,     0,    23,    92,     0,     0,
       0,     0,     0,     0,    48,    52,     0,     0,    60,    61,
      62,    63,    64,    59,    38,    44,     0,     0,     0,     0,
       0,     0,     0,    45,    43,    53,    56,     0,    35,    47,
       0,     0,     0,     0,    46,    54,     0,    57,     0,    55
  };

  /* YYPGOTO[NTERM-NUM].  */
  const short int
  script_parser::yypgoto_[] =
  {
      -133,  -133,   320,  -133,   -69,   263,   291,  -133,    13,   428,
    -133,   150,  -133,  -133,  -120,  -132,   -19,   -10,  -102
  };

  /* YYDEFGOTO[NTERM-NUM].  */
  const signed char
  script_parser::yydefgoto_[] =
  {
        -1,     6,     7,     8,    17,    26,    27,     9,    28,   122,
      77,   123,    78,   124,   125,   126,    89,    39,    90
  };

  /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
     positive, shift that token.  If negative, reduce the rule which
     number is the opposite.  If zero, do what YYDEFACT says.  */
  const signed char script_parser::yytable_ninf_ = -1;
  const short int
  script_parser::yytable_[] =
  {
        18,    14,     1,    38,   147,   162,    47,   109,    21,    42,
      49,    22,    11,    10,    41,    43,    43,    56,    57,    10,
      70,    71,    72,    73,    74,    12,    33,    34,    35,     2,
       3,     4,   159,     5,    33,    34,    35,    13,    48,    92,
      93,    94,    95,    96,    97,    98,    99,   100,   101,   102,
     103,   104,   105,   106,   107,   108,    76,   185,   186,   155,
     196,    16,    36,    19,   182,   110,    18,   127,    37,    88,
      36,   195,    20,    33,    34,    35,    37,   158,   199,     1,
     111,    40,   112,   113,   114,   115,   116,   117,   118,    52,
      23,   128,   119,    24,   120,    43,   139,    45,    46,   143,
     149,   150,   151,   152,   153,   121,     2,     3,     4,    36,
       5,    43,    22,   157,   127,    37,   160,   161,    18,   163,
      33,    34,    35,    33,    34,    35,    55,   127,    82,    22,
     168,   169,   170,   171,   172,   173,     2,     3,    83,   154,
     129,    58,    59,    60,    61,    62,    63,    64,    65,    79,
     133,    84,   130,    24,    25,    43,    36,    43,   134,    36,
     187,    22,    37,   181,   142,    37,   135,   127,   127,    66,
      67,    68,    69,    70,    71,    72,    73,    74,   127,     2,
       3,   127,   127,   174,     2,     3,    24,   164,   127,    58,
      59,    60,    61,    62,    63,    64,    65,    29,    86,   140,
      64,    65,    31,   136,    43,    58,    59,    60,    61,    62,
      63,    64,    65,    72,    73,    74,   137,    66,    67,    68,
      69,    70,    71,    72,    73,    74,    70,    71,    72,    73,
      74,   138,    75,    66,    67,    68,    69,    70,    71,    72,
      73,    74,    51,    46,   141,    91,    58,    59,    60,    61,
      62,    63,    64,    65,    54,    46,     2,     3,   144,    58,
      59,    60,    61,    62,    63,    64,    65,   131,   132,   176,
     132,   190,   132,   146,    66,    67,    68,    69,    70,    71,
      72,    73,    74,    30,    32,   148,   177,    66,    67,    68,
      69,    70,    71,    72,    73,    74,   145,   156,   167,   178,
      58,    59,    60,    61,    62,    63,    64,    65,   188,   166,
     175,   179,   183,    58,    59,    60,    61,    62,    63,    64,
      65,   184,   189,   191,   194,   197,    15,   198,    66,    67,
      68,    69,    70,    71,    72,    73,    74,    81,   193,     0,
     180,    66,    67,    68,    69,    70,    71,    72,    73,    74,
       0,   165,    58,    59,    60,    61,    62,    63,    64,    65,
       0,     0,     0,    58,    59,    60,    61,    62,    63,    64,
      65,     0,     0,    59,    60,    61,    62,    63,    64,    65,
      66,    67,    68,    69,    70,    71,    72,    73,    74,     0,
     192,    66,    67,    68,    69,    70,    71,    72,    73,    74,
      66,    67,    68,    69,    70,    71,    72,    73,    74,    60,
      61,    62,    63,    64,    65,     0,     0,     0,    -1,    -1,
      -1,    -1,    64,    65,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,    66,    67,    68,    69,    70,
      71,    72,    73,    74,    -1,    -1,    68,    69,    70,    71,
      72,    73,    74,    44,     0,     0,     0,    50,     0,    53,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    80,     0,     0,     0,     0,     0,    85,
       0,     0,    87
  };

  /* YYCHECK.  */
  const short int
  script_parser::yycheck_[] =
  {
        10,     0,     1,    22,   124,   137,     4,    76,    45,    44,
      44,    48,    44,     0,    24,    50,    50,    36,    37,     6,
      38,    39,    40,    41,    42,     4,     3,     4,     5,    28,
      29,    30,   134,    32,     3,     4,     5,     4,    36,    58,
      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
      69,    70,    71,    72,    73,    74,    43,   177,   178,   128,
     192,     4,    39,    45,   166,     4,    76,    77,    45,    46,
      39,   191,    45,     3,     4,     5,    45,    46,   198,     1,
      19,     4,    21,    22,    23,    24,    25,    26,    27,    44,
      44,    78,    31,    47,    33,    50,   115,    46,    47,   118,
      14,    15,    16,    17,    18,    44,    28,    29,    30,    39,
      32,    50,    48,   132,   124,    45,   135,   136,   128,   138,
       3,     4,     5,     3,     4,     5,    45,   137,    48,    48,
     149,   150,   151,   152,   153,   154,    28,    29,     4,    53,
      49,     6,     7,     8,     9,    10,    11,    12,    13,    44,
      44,    44,    48,    47,    46,    50,    39,    50,    45,    39,
     179,    48,    45,    46,    44,    45,    45,   177,   178,    34,
      35,    36,    37,    38,    39,    40,    41,    42,   188,    28,
      29,   191,   192,    44,    28,    29,    47,    52,   198,     6,
       7,     8,     9,    10,    11,    12,    13,    46,    44,    52,
      12,    13,    46,    45,    50,     6,     7,     8,     9,    10,
      11,    12,    13,    40,    41,    42,    45,    34,    35,    36,
      37,    38,    39,    40,    41,    42,    38,    39,    40,    41,
      42,    45,    49,    34,    35,    36,    37,    38,    39,    40,
      41,    42,    46,    47,    44,    46,     6,     7,     8,     9,
      10,    11,    12,    13,    46,    47,    28,    29,     4,     6,
       7,     8,     9,    10,    11,    12,    13,    46,    47,    46,
      47,    46,    47,    51,    34,    35,    36,    37,    38,    39,
      40,    41,    42,    20,    21,    44,    46,    34,    35,    36,
      37,    38,    39,    40,    41,    42,    45,    49,    46,    46,
       6,     7,     8,     9,    10,    11,    12,    13,    50,    45,
      44,    44,    44,     6,     7,     8,     9,    10,    11,    12,
      13,    44,    44,    20,    44,    51,     6,    46,    34,    35,
      36,    37,    38,    39,    40,    41,    42,    46,   188,    -1,
      46,    34,    35,    36,    37,    38,    39,    40,    41,    42,
      -1,    44,     6,     7,     8,     9,    10,    11,    12,    13,
      -1,    -1,    -1,     6,     7,     8,     9,    10,    11,    12,
      13,    -1,    -1,     7,     8,     9,    10,    11,    12,    13,
      34,    35,    36,    37,    38,    39,    40,    41,    42,    -1,
      44,    34,    35,    36,    37,    38,    39,    40,    41,    42,
      34,    35,    36,    37,    38,    39,    40,    41,    42,     8,
       9,    10,    11,    12,    13,    -1,    -1,    -1,     8,     9,
      10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    34,    35,    36,    37,    38,
      39,    40,    41,    42,    34,    35,    36,    37,    38,    39,
      40,    41,    42,    25,    -1,    -1,    -1,    29,    -1,    31,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    45,    -1,    -1,    -1,    -1,    -1,    51,
      -1,    -1,    54
  };

  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
     symbol of state STATE-NUM.  */
  const unsigned char
  script_parser::yystos_[] =
  {
         0,     1,    28,    29,    30,    32,    55,    56,    57,    61,
      62,    44,     4,     4,     0,    56,     4,    58,    71,    45,
      45,    45,    48,    44,    47,    46,    59,    60,    62,    46,
      59,    46,    59,     3,     4,     5,    39,    45,    70,    71,
       4,    71,    44,    50,    63,    46,    47,     4,    36,    44,
      63,    46,    44,    63,    46,    45,    70,    70,     6,     7,
       8,     9,    10,    11,    12,    13,    34,    35,    36,    37,
      38,    39,    40,    41,    42,    49,    62,    64,    66,    44,
      63,    60,    48,     4,    44,    63,    44,    63,    46,    70,
      72,    46,    70,    70,    70,    70,    70,    70,    70,    70,
      70,    70,    70,    70,    70,    70,    70,    70,    70,    58,
       4,    19,    21,    22,    23,    24,    25,    26,    27,    31,
      33,    44,    63,    65,    67,    68,    69,    71,    62,    49,
      48,    46,    47,    44,    45,    45,    45,    45,    45,    70,
      52,    44,    44,    70,     4,    45,    51,    68,    44,    14,
      15,    16,    17,    18,    53,    58,    49,    70,    46,    72,
      70,    70,    69,    70,    52,    44,    45,    46,    70,    70,
      70,    70,    70,    70,    44,    44,    46,    46,    46,    44,
      46,    46,    72,    44,    44,    68,    68,    70,    50,    44,
      46,    20,    44,    65,    44,    68,    69,    51,    46,    68
  };

#if YYDEBUG
  /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
     to YYLEX-NUM.  */
  const unsigned short int
  script_parser::yytoken_number_[] =
  {
         0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,   287,   288,    62,    60,    38,   124,    43,    45,
      42,    47,    37,   289,    59,    40,    41,    44,    91,    93,
     123,   125,    58,    61
  };
#endif

  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
  const unsigned char
  script_parser::yyr1_[] =
  {
         0,    54,    55,    55,    56,    56,    56,    57,    57,    57,
      57,    57,    57,    57,    58,    58,    59,    59,    60,    60,
      60,    60,    60,    60,    61,    61,    61,    61,    61,    61,
      62,    62,    63,    64,    64,    65,    65,    66,    66,    67,
      67,    68,    68,    68,    68,    68,    68,    68,    68,    68,
      68,    68,    68,    68,    68,    68,    68,    68,    68,    69,
      69,    69,    69,    69,    69,    70,    70,    70,    70,    70,
      70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
      70,    70,    70,    70,    70,    70,    70,    70,    70,    71,
      71,    72,    72
  };

  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
  const unsigned char
  script_parser::yyr2_[] =
  {
         0,     2,     1,     2,     2,     1,     1,     3,     5,     6,
       5,     6,     5,     6,     1,     3,     1,     3,     1,     2,
       2,     3,     4,     5,     5,     6,     5,     6,     5,     6,
       1,     1,     4,     0,     1,     0,     1,     3,     4,     1,
       2,     1,     2,     5,     4,     4,     6,     5,     3,     2,
       2,     2,     3,     5,     7,     9,     5,     7,     1,     3,
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
       3,     3,     2,     3,     1,     1,     1,     4,     3,     1,
       4,     1,     3
  };

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
     First, the terminals, then, starting at \a yyntokens_, nonterminals.  */
  const char*
  const script_parser::yytname_[] =
  {
    "\"end of file\"", "error", "$undefined", "\"ival\"", "\"identifier\"",
  "\"sval\"", "\"||\"", "\"&&\"", "\"==\"", "\"!=\"", "\">=\"", "\"<=\"",
  "\"<<\"", "\">>\"", "\"+=\"", "\"-=\"", "\"*=\"", "\"/=\"", "\"%=\"",
  "\"if\"", "\"else\"", "\"while\"", "\"for\"", "\"switch\"", "\"case\"",
  "\"default\"", "\"break\"", "\"return\"", "\"int\"", "\"string\"",
  "\"void\"", "\"goto\"", "\"__code\"", "\"exit\"", "'>'", "'<'", "'&'",
  "'|'", "'+'", "'-'", "'*'", "'/'", "'%'", "NEG", "';'", "'('", "')'",
  "','", "'['", "']'", "'{'", "'}'", "':'", "'='", "$accept", "unit",
  "define_or_state", "declaration", "value_list", "arglist", "arg",
  "function", "type", "block", "decl_list", "state_list", "decls",
  "states", "statement", "assign", "expr", "value", "args", 0
  };
#endif

#if YYDEBUG
  /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
  const script_parser::rhs_number_type
  script_parser::yyrhs_[] =
  {
        55,     0,    -1,    56,    -1,    55,    56,    -1,     1,    44,
      -1,    61,    -1,    57,    -1,    62,    58,    44,    -1,    62,
       4,    45,    46,    44,    -1,    62,     4,    45,    59,    46,
      44,    -1,    30,     4,    45,    46,    44,    -1,    30,     4,
      45,    59,    46,    44,    -1,    32,     4,    45,    46,    44,
      -1,    32,     4,    45,    59,    46,    44,    -1,    71,    -1,
      58,    47,    71,    -1,    60,    -1,    59,    47,    60,    -1,
      62,    -1,    62,    36,    -1,    62,     4,    -1,    62,    36,
       4,    -1,    62,     4,    48,    49,    -1,    62,    36,     4,
      48,    49,    -1,    62,     4,    45,    46,    63,    -1,    62,
       4,    45,    59,    46,    63,    -1,    30,     4,    45,    46,
      63,    -1,    30,     4,    45,    59,    46,    63,    -1,    32,
       4,    45,    46,    63,    -1,    32,     4,    45,    59,    46,
      63,    -1,    28,    -1,    29,    -1,    50,    64,    65,    51,
      -1,    -1,    66,    -1,    -1,    67,    -1,    62,    58,    44,
      -1,    66,    62,    58,    44,    -1,    68,    -1,    67,    68,
      -1,    44,    -1,    69,    44,    -1,     4,    45,    72,    46,
      44,    -1,     4,    45,    46,    44,    -1,    33,    45,    46,
      44,    -1,    31,     4,    45,    72,    46,    44,    -1,    31,
       4,    45,    46,    44,    -1,    24,    70,    52,    -1,    25,
      52,    -1,    26,    44,    -1,    27,    44,    -1,    27,    70,
      44,    -1,    19,    45,    70,    46,    68,    -1,    19,    45,
      70,    46,    68,    20,    68,    -1,    22,    45,    69,    44,
      70,    44,    69,    46,    68,    -1,    21,    45,    70,    46,
      68,    -1,    23,    45,    70,    46,    50,    65,    51,    -1,
      63,    -1,    71,    53,    70,    -1,    71,    14,    70,    -1,
      71,    15,    70,    -1,    71,    16,    70,    -1,    71,    17,
      70,    -1,    71,    18,    70,    -1,    70,     7,    70,    -1,
      70,     6,    70,    -1,    70,     8,    70,    -1,    70,     9,
      70,    -1,    70,    34,    70,    -1,    70,    10,    70,    -1,
      70,    35,    70,    -1,    70,    11,    70,    -1,    70,    36,
      70,    -1,    70,    37,    70,    -1,    70,    12,    70,    -1,
      70,    13,    70,    -1,    70,    39,    70,    -1,    70,    38,
      70,    -1,    70,    40,    70,    -1,    70,    41,    70,    -1,
      70,    42,    70,    -1,    39,    70,    -1,    45,    70,    46,
      -1,    71,    -1,     3,    -1,     5,    -1,     4,    45,    72,
      46,    -1,     4,    45,    46,    -1,     4,    -1,     4,    48,
      70,    49,    -1,    70,    -1,    72,    47,    70,    -1
  };

  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
     YYRHS.  */
  const unsigned short int
  script_parser::yyprhs_[] =
  {
         0,     0,     3,     5,     8,    11,    13,    15,    19,    25,
      32,    38,    45,    51,    58,    60,    64,    66,    70,    72,
      75,    78,    82,    87,    93,    99,   106,   112,   119,   125,
     132,   134,   136,   141,   142,   144,   145,   147,   151,   156,
     158,   161,   163,   166,   172,   177,   182,   189,   195,   199,
     202,   205,   208,   212,   218,   226,   236,   242,   250,   252,
     256,   260,   264,   268,   272,   276,   280,   284,   288,   292,
     296,   300,   304,   308,   312,   316,   320,   324,   328,   332,
     336,   340,   344,   347,   351,   353,   355,   357,   362,   366,
     368,   373,   375
  };

  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
  const unsigned char
  script_parser::yyrline_[] =
  {
         0,   121,   121,   122,   125,   126,   127,   130,   131,   132,
     133,   134,   135,   136,   139,   140,   143,   144,   147,   148,
     149,   150,   151,   152,   155,   156,   157,   158,   159,   160,
     163,   164,   167,   170,   171,   174,   175,   178,   179,   182,
     183,   186,   187,   188,   189,   190,   191,   192,   193,   194,
     195,   196,   197,   198,   199,   200,   202,   203,   204,   207,
     208,   209,   210,   211,   212,   215,   216,   217,   218,   219,
     220,   221,   222,   223,   224,   225,   226,   227,   228,   229,
     230,   231,   232,   233,   234,   235,   236,   237,   238,   241,
     242,   245,   246
  };

  // Print the state stack on the debug stream.
  void
  script_parser::yystack_print_ ()
  {
    *yycdebug_ << "Stack now";
    for (state_stack_type::const_iterator i = yystate_stack_.begin ();
	 i != yystate_stack_.end (); ++i)
      *yycdebug_ << ' ' << *i;
    *yycdebug_ << std::endl;
  }

  // Report on the debug stream that the rule \a yyrule is going to be reduced.
  void
  script_parser::yy_reduce_print_ (int yyrule)
  {
    unsigned int yylno = yyrline_[yyrule];
    int yynrhs = yyr2_[yyrule];
    /* Print the symbols being reduced, and their result.  */
    *yycdebug_ << "Reducing stack by rule " << yyrule - 1
	       << " (line " << yylno << "), ";
    /* The symbols being reduced.  */
    for (int yyi = 0; yyi < yynrhs; yyi++)
      YY_SYMBOL_PRINT ("   $" << yyi + 1 << " =",
		       yyrhs_[yyprhs_[yyrule] + yyi],
		       &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
		       &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
  }
#endif // YYDEBUG

  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
  script_parser::token_number_type
  script_parser::yytranslate_ (int t)
  {
    static
    const token_number_type
    translate_table[] =
    {
           0,     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,    42,    36,     2,
      45,    46,    40,    38,    47,    39,     2,    41,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,    52,    44,
      35,    53,    34,     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,    48,     2,    49,     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,    50,    37,    51,     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,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    33,    43
    };
    if ((unsigned int) t <= yyuser_token_number_max_)
      return translate_table[t];
    else
      return yyundef_token_;
  }

  const int script_parser::yyeof_ = 0;
  const int script_parser::yylast_ = 482;
  const int script_parser::yynnts_ = 19;
  const int script_parser::yyempty_ = -2;
  const int script_parser::yyfinal_ = 14;
  const int script_parser::yyterror_ = 1;
  const int script_parser::yyerrcode_ = 256;
  const int script_parser::yyntokens_ = 54;

  const unsigned int script_parser::yyuser_token_number_max_ = 289;
  const script_parser::token_number_type script_parser::yyundef_token_ = 2;

} // namespace yy

#line 249 "script-parser.yy"

void yy::script_parser::error(const yy::script_parser::location_type& l, const std::string& m)
{
	driver.error(l, m);
}