int
  Parser::parse ()
  {
    /// Lookahead and lookahead 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 lookahead.
    semantic_type yylval;
    /// Location of the lookahead.
    location_type yylloc;
    /// The locations where the error started and ended.
    location_type yyerror_range[2];

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

    int yyresult;

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


    /* 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;

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

    goto yybackup;

    /* Backup.  */
  yybackup:

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

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


    /* 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;
      }

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

    /* Discard the token being shifted.  */
    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 21:

/* Line 678 of lalr1.cc  */
#line 79 "parser.ypp"
    { std::vector<std::string>  line ;
						     line.push_back ( (yysemantic_stack_[(3) - (2)]) ) ;
						     configlines.push_back ( line ) ; }
    break;

  case 22:

/* Line 678 of lalr1.cc  */
#line 85 "parser.ypp"
    { std::vector<std::string>  line ;
						     line.push_back ( (yysemantic_stack_[(4) - (2)]) ) ;
						     line.push_back ( (yysemantic_stack_[(4) - (4)]) ) ; 
						     configlines.push_back ( line ) ; }
    break;

  case 23:

/* Line 678 of lalr1.cc  */
#line 93 "parser.ypp"
    { std::vector<std::string>  line ;
						     	    line.push_back ( (yysemantic_stack_[(5) - (2)]) ) ;
						            line.push_back ( (yysemantic_stack_[(5) - (4)]) ) ; 
						            line.push_back ( (yysemantic_stack_[(5) - (5)]) ) ; 
						     	    configlines.push_back ( line ) ; }
    break;

  case 24:

/* Line 678 of lalr1.cc  */
#line 101 "parser.ypp"
    { std::vector<std::string>  line ;
						     	    line.push_back ( (yysemantic_stack_[(6) - (2)]) ) ;
						            line.push_back ( (yysemantic_stack_[(6) - (4)]) ) ; 
						            line.push_back ( (yysemantic_stack_[(6) - (5)]) ) ;
						            line.push_back ( (yysemantic_stack_[(6) - (6)]) ) ;
						     	    configlines.push_back ( line ) ; }
    break;

  case 25:

/* Line 678 of lalr1.cc  */
#line 110 "parser.ypp"
    { std::vector<std::string>  line ;
								     	    line.push_back ( (yysemantic_stack_[(7) - (2)]) ) ;
								            line.push_back ( (yysemantic_stack_[(7) - (4)]) ) ; 
								            line.push_back ( (yysemantic_stack_[(7) - (5)]) ) ; 
								            line.push_back ( (yysemantic_stack_[(7) - (6)]) ) ; 
								            line.push_back ( (yysemantic_stack_[(7) - (7)]) ) ; 
								     	    configlines.push_back ( line ) ; }
    break;

  case 26:

/* Line 678 of lalr1.cc  */
#line 120 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    line.push_back ( (yysemantic_stack_[(8) - (2)]) ) ;
									            line.push_back ( (yysemantic_stack_[(8) - (4)]) ) ; 
									            line.push_back ( (yysemantic_stack_[(8) - (5)]) ) ; 
									            line.push_back ( (yysemantic_stack_[(8) - (6)]) ) ; 
									            line.push_back ( (yysemantic_stack_[(8) - (7)]) ) ; 
									            line.push_back ( (yysemantic_stack_[(8) - (8)]) ) ; 
						     	    			    configlines.push_back ( line ) ; }
    break;

  case 27:

/* Line 678 of lalr1.cc  */
#line 131 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    	line.push_back ( (yysemantic_stack_[(9) - (2)]) ) ;
									            	line.push_back ( (yysemantic_stack_[(9) - (4)]) ) ; 
									            	line.push_back ( (yysemantic_stack_[(9) - (5)]) ) ; 
									            	line.push_back ( (yysemantic_stack_[(9) - (6)]) ) ; 
									            	line.push_back ( (yysemantic_stack_[(9) - (7)]) ) ; 
									            	line.push_back ( (yysemantic_stack_[(9) - (8)]) ) ; 
									            	line.push_back ( (yysemantic_stack_[(9) - (9)]) ) ; 
						     	    			    	configlines.push_back ( line ) ; }
    break;

  case 28:

/* Line 678 of lalr1.cc  */
#line 143 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(10) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(10) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(10) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(10) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(10) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(10) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(10) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(10) - (10)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 29:

/* Line 678 of lalr1.cc  */
#line 157 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(11) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(11) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(11) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(11) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(11) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(11) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(11) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(11) - (10)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(11) - (11)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 30:

/* Line 678 of lalr1.cc  */
#line 172 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(12) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(12) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(12) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(12) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(12) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(12) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(12) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(12) - (10)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(12) - (11)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(12) - (12)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 31:

/* Line 678 of lalr1.cc  */
#line 189 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(13) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(13) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (10)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (11)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (12)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(13) - (13)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 32:

/* Line 678 of lalr1.cc  */
#line 207 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(14) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(14) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (10)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (11)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (12)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (13)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(14) - (14)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 33:

/* Line 678 of lalr1.cc  */
#line 227 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(15) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(15) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (10)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (11)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (12)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (13)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (14)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(15) - (15)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 34:

/* Line 678 of lalr1.cc  */
#line 248 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(16) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(16) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (10)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (11)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (12)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (13)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (14)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (15)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(16) - (16)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 35:

/* Line 678 of lalr1.cc  */
#line 270 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(17) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(17) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (10)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (11)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (12)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (13)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (14)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (15)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (16)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(17) - (17)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 36:

/* Line 678 of lalr1.cc  */
#line 293 "parser.ypp"
    { std::vector<std::string>  line ;
									     	    		line.push_back ( (yysemantic_stack_[(18) - (2)]) ) ;
									            		line.push_back ( (yysemantic_stack_[(18) - (4)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (5)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (6)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (7)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (8)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (9)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (10)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (11)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (12)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (13)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (14)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (15)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (16)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (17)]) ) ; 
									            		line.push_back ( (yysemantic_stack_[(18) - (18)]) ) ; 
												configlines.push_back ( line ) ; }
    break;

  case 37:

/* Line 678 of lalr1.cc  */
#line 317 "parser.ypp"
    { }
    break;



/* Line 678 of lalr1.cc  */
#line 695 "parser.tab.cpp"
	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));
      }

    yyerror_range[0] = yylloc;
    if (yyerrstatus_ == 3)
      {
	/* If just tried and failed to reuse lookahead 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 lookahead 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 ();
      }

    yyerror_range[1] = yylloc;
    // Using YYLLOC is tempting, but would change the location of
    // the lookahead.  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 != 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;
  }
int
YYPARSE_DECL()
{
    int yym, yyn, yystate, yyresult;
#if YYBTYACC
    int yynewerrflag;
    YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    YYLTYPE  yyerror_loc_range[2]; /* position of error start & end */
#endif
#if YYDEBUG
    const char *yys;

    if ((yys = getenv("YYDEBUG")) != 0)
    {
        yyn = *yys;
        if (yyn >= '0' && yyn <= '9')
            yydebug = yyn - '0';
    }
    if (yydebug)
        fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif

#if YYBTYACC
    yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
    yyps->save = 0;
#endif /* YYBTYACC */
    yynerrs = 0;
    yyerrflag = 0;
    yychar = YYEMPTY;
    yystate = 0;

#if YYPURE
    memset(&yystack, 0, sizeof(yystack));
#endif

    if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    yystack.s_mark = yystack.s_base;
    yystack.l_mark = yystack.l_base;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    yystack.p_mark = yystack.p_base;
#endif
    yystate = 0;
    *yystack.s_mark = 0;

yyloop:
    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
    if (yychar < 0)
    {
#if YYBTYACC
        do {
        if (yylvp < yylve)
        {
            /* we're currently re-reading tokens */
            yylval = *yylvp++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            yylloc = *yylpp++;
#endif
            yychar = *yylexp++;
            break;
        }
        if (yyps->save)
        {
            /* in trial mode; save scanner results for future parse attempts */
            if (yylvp == yylvlim)
            {   /* Enlarge lexical value queue */
                size_t p = (size_t) (yylvp - yylvals);
                size_t s = (size_t) (yylvlim - yylvals);

                s += YYLVQUEUEGROWTH;
                if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
                if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
                yylvp   = yylve = yylvals + p;
                yylvlim = yylvals + s;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                yylpp   = yylpe = yylpsns + p;
                yylplim = yylpsns + s;
#endif
                yylexp  = yylexemes + p;
            }
            *yylexp = (short) YYLEX;
            *yylvp++ = yylval;
            yylve++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            *yylpp++ = yylloc;
            yylpe++;
#endif
            yychar = *yylexp++;
            break;
        }
        /* normal operation, no conflict encountered */
#endif /* YYBTYACC */
        yychar = YYLEX;
#if YYBTYACC
        } while (0);
#endif /* YYBTYACC */
        if (yychar < 0) yychar = YYEOF;
        /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
#if YYDEBUG
        if (yydebug)
        {
            yys = yyname[YYTRANSLATE(yychar)];
            fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
                            YYDEBUGSTR, yydepth, yystate, yychar, yys);
#ifdef YYSTYPE_TOSTRING
#if YYBTYACC
            if (!yytrial)
#endif /* YYBTYACC */
                fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
#endif
            fputc('\n', stderr);
        }
#endif
    }
#if YYBTYACC

    /* Do we have a conflict? */
    if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
        yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
    {
        YYINT ctry;

        if (yypath)
        {
            YYParseState *save;
#if YYDEBUG
            if (yydebug)
                fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
                                YYDEBUGSTR, yydepth, yystate);
#endif
            /* Switch to the next conflict context */
            save = yypath;
            yypath = save->save;
            save->save = NULL;
            ctry = save->ctry;
            if (save->state != yystate) YYABORT;
            yyFreeState(save);

        }
        else
        {

            /* Unresolved conflict - start/continue trial parse */
            YYParseState *save;
#if YYDEBUG
            if (yydebug)
            {
                fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
                if (yyps->save)
                    fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
                else
                    fputs("Starting trial parse.\n", stderr);
            }
#endif
            save                  = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
            if (save == NULL) goto yyenomem;
            save->save            = yyps->save;
            save->state           = yystate;
            save->errflag         = yyerrflag;
            save->yystack.s_mark  = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
            memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
            save->yystack.l_mark  = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
            memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            save->yystack.p_mark  = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
            memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
            ctry                  = yytable[yyn];
            if (yyctable[ctry] == -1)
            {
#if YYDEBUG
                if (yydebug && yychar >= YYEOF)
                    fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
#endif
                ctry++;
            }
            save->ctry = ctry;
            if (yyps->save == NULL)
            {
                /* If this is a first conflict in the stack, start saving lexemes */
                if (!yylexemes)
                {
                    yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
                    if (yylexemes == NULL) goto yyenomem;
                    yylvals   = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
                    if (yylvals == NULL) goto yyenomem;
                    yylvlim   = yylvals + YYLVQUEUEGROWTH;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                    yylpsns   = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
                    if (yylpsns == NULL) goto yyenomem;
                    yylplim   = yylpsns + YYLVQUEUEGROWTH;
#endif
                }
                if (yylvp == yylve)
                {
                    yylvp  = yylve = yylvals;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                    yylpp  = yylpe = yylpsns;
#endif
                    yylexp = yylexemes;
                    if (yychar >= YYEOF)
                    {
                        *yylve++ = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                        *yylpe++ = yylloc;
#endif
                        *yylexp  = (short) yychar;
                        yychar   = YYEMPTY;
                    }
                }
            }
            if (yychar >= YYEOF)
            {
                yylvp--;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                yylpp--;
#endif
                yylexp--;
                yychar = YYEMPTY;
            }
            save->lexeme = (int) (yylvp - yylvals);
            yyps->save   = save;
        }
        if (yytable[yyn] == ctry)
        {
#if YYDEBUG
            if (yydebug)
                fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
                                YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
#endif
            if (yychar < 0)
            {
                yylvp++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                yylpp++;
#endif
                yylexp++;
            }
            if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
                goto yyoverflow;
            yystate = yyctable[ctry];
            *++yystack.s_mark = (short) yystate;
            *++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            *++yystack.p_mark = yylloc;
#endif
            yychar  = YYEMPTY;
            if (yyerrflag > 0) --yyerrflag;
            goto yyloop;
        }
        else
        {
            yyn = yyctable[ctry];
            goto yyreduce;
        }
    } /* End of code dealing with conflicts */
#endif /* YYBTYACC */
    if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
    {
#if YYDEBUG
        if (yydebug)
            fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
                            YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
#endif
        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
        yystate = yytable[yyn];
        *++yystack.s_mark = yytable[yyn];
        *++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
        *++yystack.p_mark = yylloc;
#endif
        yychar = YYEMPTY;
        if (yyerrflag > 0)  --yyerrflag;
        goto yyloop;
    }
    if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
    {
        yyn = yytable[yyn];
        goto yyreduce;
    }
    if (yyerrflag != 0) goto yyinrecovery;
#if YYBTYACC

    yynewerrflag = 1;
    goto yyerrhandler;
    goto yyerrlab;

yyerrlab:
    yynewerrflag = 0;
yyerrhandler:
    while (yyps->save)
    {
        int ctry;
        YYParseState *save = yyps->save;
#if YYDEBUG
        if (yydebug)
            fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
                            YYDEBUGSTR, yydepth, yystate, yyps->save->state,
                    (int)(yylvp - yylvals - yyps->save->lexeme));
#endif
        /* Memorize most forward-looking error state in case it's really an error. */
        if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
        {
            /* Free old saved error context state */
            if (yyerrctx) yyFreeState(yyerrctx);
            /* Create and fill out new saved error context state */
            yyerrctx                 = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
            if (yyerrctx == NULL) goto yyenomem;
            yyerrctx->save           = yyps->save;
            yyerrctx->state          = yystate;
            yyerrctx->errflag        = yyerrflag;
            yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
            memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
            yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
            memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
            memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
            yyerrctx->lexeme         = (int) (yylvp - yylvals);
        }
        yylvp          = yylvals   + save->lexeme;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
        yylpp          = yylpsns   + save->lexeme;
#endif
        yylexp         = yylexemes + save->lexeme;
        yychar         = YYEMPTY;
        yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
        memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
        yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
        memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
        yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
        memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
        ctry           = ++save->ctry;
        yystate        = save->state;
        /* We tried shift, try reduce now */
        if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
        yyps->save     = save->save;
        save->save     = NULL;
        yyFreeState(save);

        /* Nothing left on the stack -- error */
        if (!yyps->save)
        {
#if YYDEBUG
            if (yydebug)
                fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
                                YYPREFIX, yydepth);
#endif
            /* Restore state as it was in the most forward-advanced error */
            yylvp          = yylvals   + yyerrctx->lexeme;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            yylpp          = yylpsns   + yyerrctx->lexeme;
#endif
            yylexp         = yylexemes + yyerrctx->lexeme;
            yychar         = yylexp[-1];
            yylval         = yylvp[-1];
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            yylloc         = yylpp[-1];
#endif
            yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
            memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
            yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
            memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
            memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
            yystate        = yyerrctx->state;
            yyFreeState(yyerrctx);
            yyerrctx       = NULL;
        }
        yynewerrflag = 1;
    }
    if (yynewerrflag == 0) goto yyinrecovery;
#endif /* YYBTYACC */

    YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
#endif

#if !YYBTYACC
    goto yyerrlab;
yyerrlab:
#endif
    ++yynerrs;

yyinrecovery:
    if (yyerrflag < 3)
    {
        yyerrflag = 3;
        for (;;)
        {
            if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
                    yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
            {
#if YYDEBUG
                if (yydebug)
                    fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
                                    YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
#endif
                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
                yystate = yytable[yyn];
                *++yystack.s_mark = yytable[yyn];
                *++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                /* lookahead position is error end position */
                yyerror_loc_range[1] = yylloc;
                YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
                *++yystack.p_mark = yyloc;
#endif
                goto yyloop;
            }
            else
            {
#if YYDEBUG
                if (yydebug)
                    fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
                                    YYDEBUGSTR, yydepth, *yystack.s_mark);
#endif
                if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                /* the current TOS position is the error start position */
                yyerror_loc_range[0] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
                if (!yytrial)
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                    YYDESTRUCT_CALL("error: discarding state",
                                    yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
#else
                    YYDESTRUCT_CALL("error: discarding state",
                                    yystos[*yystack.s_mark], yystack.l_mark);
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
#endif /* defined(YYDESTRUCT_CALL) */
                --yystack.s_mark;
                --yystack.l_mark;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                --yystack.p_mark;
#endif
            }
        }
    }
    else
    {
        if (yychar == YYEOF) goto yyabort;
#if YYDEBUG
        if (yydebug)
        {
            yys = yyname[YYTRANSLATE(yychar)];
            fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
                            YYDEBUGSTR, yydepth, yystate, yychar, yys);
        }
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
        if (!yytrial)
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
            YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
#else
            YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
#endif /* defined(YYDESTRUCT_CALL) */
        yychar = YYEMPTY;
        goto yyloop;
    }

yyreduce:
    yym = yylen[yyn];
#if YYDEBUG
    if (yydebug)
    {
        fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
                        YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
#ifdef YYSTYPE_TOSTRING
#if YYBTYACC
        if (!yytrial)
#endif /* YYBTYACC */
            if (yym > 0)
            {
                int i;
                fputc('<', stderr);
                for (i = yym; i > 0; i--)
                {
                    if (i != yym) fputs(", ", stderr);
                    fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
                                           yystack.l_mark[1-i]), stderr);
                }
                fputc('>', stderr);
            }
#endif
        fputc('\n', stderr);
    }
#endif
    if (yym > 0)
        yyval = yystack.l_mark[1-yym];
    else
        memset(&yyval, 0, sizeof yyval);
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)

    /* Perform position reduction */
    memset(&yyloc, 0, sizeof(yyloc));
#if YYBTYACC
    if (!yytrial)
#endif /* YYBTYACC */
    {
        YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
        /* just in case YYERROR is invoked within the action, save
           the start of the rhs as the error start position */
        yyerror_loc_range[0] = yystack.p_mark[1-yym];
    }
#endif

    switch (yyn)
    {
case 1:
  if (!yytrial)
#line 62 "btyacc_destroy2.y"
	{ yyval.nlist = yystack.l_mark[-5].nlist; }
break;
case 2:
  if (!yytrial)
#line 64 "btyacc_destroy2.y"
	{ yyval.nlist = yystack.l_mark[-3].nlist; }
break;
case 3:
  if (!yytrial)
#line 67 "btyacc_destroy2.y"
	{ yyval.cval = cGLOBAL; }
break;
case 4:
  if (!yytrial)
#line 68 "btyacc_destroy2.y"
	{ yyval.cval = cLOCAL; }
break;
case 5:
  if (!yytrial)
#line 71 "btyacc_destroy2.y"
	{ yyval.tval = tREAL; }
break;
case 6:
  if (!yytrial)
#line 72 "btyacc_destroy2.y"
	{ yyval.tval = tINTEGER; }
break;
case 7:
  if (!yytrial)
#line 76 "btyacc_destroy2.y"
	{ yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
	      yyval.nlist->next = yystack.l_mark[-1].nlist;
	    }
break;
case 8:
  if (!yytrial)
#line 80 "btyacc_destroy2.y"
	{ yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id);
	      yyval.nlist->next = NULL;
	    }
break;
case 9:
  if (!yytrial)
#line 86 "btyacc_destroy2.y"
	{ yyval.nlist = yystack.l_mark[-5].nlist; }
break;
#line 1217 "btyacc_destroy2.tab.c"
    default:
        break;
    }
    yystack.s_mark -= yym;
    yystate = *yystack.s_mark;
    yystack.l_mark -= yym;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    yystack.p_mark -= yym;
#endif
    yym = yylhs[yyn];
    if (yystate == 0 && yym == 0)
    {
#if YYDEBUG
        if (yydebug)
        {
            fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
#ifdef YYSTYPE_TOSTRING
#if YYBTYACC
            if (!yytrial)
#endif /* YYBTYACC */
                fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
#endif
            fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
        }
#endif
        yystate = YYFINAL;
        *++yystack.s_mark = YYFINAL;
        *++yystack.l_mark = yyval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
        *++yystack.p_mark = yyloc;
#endif
        if (yychar < 0)
        {
#if YYBTYACC
            do {
            if (yylvp < yylve)
            {
                /* we're currently re-reading tokens */
                yylval = *yylvp++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                yylloc = *yylpp++;
#endif
                yychar = *yylexp++;
                break;
            }
            if (yyps->save)
            {
                /* in trial mode; save scanner results for future parse attempts */
                if (yylvp == yylvlim)
                {   /* Enlarge lexical value queue */
                    size_t p = (size_t) (yylvp - yylvals);
                    size_t s = (size_t) (yylvlim - yylvals);

                    s += YYLVQUEUEGROWTH;
                    if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL)
                        goto yyenomem;
                    if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
                        goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                    if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
                        goto yyenomem;
#endif
                    yylvp   = yylve = yylvals + p;
                    yylvlim = yylvals + s;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                    yylpp   = yylpe = yylpsns + p;
                    yylplim = yylpsns + s;
#endif
                    yylexp  = yylexemes + p;
                }
                *yylexp = (short) YYLEX;
                *yylvp++ = yylval;
                yylve++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
                *yylpp++ = yylloc;
                yylpe++;
#endif
                yychar = *yylexp++;
                break;
            }
            /* normal operation, no conflict encountered */
#endif /* YYBTYACC */
            yychar = YYLEX;
#if YYBTYACC
            } while (0);
#endif /* YYBTYACC */
            if (yychar < 0) yychar = YYEOF;
            /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
#if YYDEBUG
            if (yydebug)
            {
                yys = yyname[YYTRANSLATE(yychar)];
                fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
                                YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
            }
#endif
        }
        if (yychar == YYEOF) goto yyaccept;
        goto yyloop;
    }
    if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
        yystate = yytable[yyn];
    else
        yystate = yydgoto[yym];
#if YYDEBUG
    if (yydebug)
    {
        fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
#ifdef YYSTYPE_TOSTRING
#if YYBTYACC
        if (!yytrial)
#endif /* YYBTYACC */
            fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
#endif
        fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
    }
#endif
    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    *++yystack.s_mark = (short) yystate;
    *++yystack.l_mark = yyval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    *++yystack.p_mark = yyloc;
#endif
    goto yyloop;
#if YYBTYACC

    /* Reduction declares that this path is valid. Set yypath and do a full parse */
yyvalid:
    if (yypath) YYABORT;
    while (yyps->save)
    {
        YYParseState *save = yyps->save;
        yyps->save = save->save;
        save->save = yypath;
        yypath = save;
    }
#if YYDEBUG
    if (yydebug)
        fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
                        YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
#endif
    if (yyerrctx)
    {
        yyFreeState(yyerrctx);
        yyerrctx = NULL;
    }
    yylvp          = yylvals + yypath->lexeme;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    yylpp          = yylpsns + yypath->lexeme;
#endif
    yylexp         = yylexemes + yypath->lexeme;
    yychar         = YYEMPTY;
    yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
    memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
    yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
    memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
    memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
    yystate        = yypath->state;
    goto yyloop;
#endif /* YYBTYACC */

yyoverflow:
    YYERROR_CALL("yacc stack overflow");
#if YYBTYACC
    goto yyabort_nomem;
yyenomem:
    YYERROR_CALL("memory exhausted");
yyabort_nomem:
#endif /* YYBTYACC */
    yyresult = 2;
    goto yyreturn;

yyabort:
    yyresult = 1;
    goto yyreturn;

yyaccept:
#if YYBTYACC
    if (yyps->save) goto yyvalid;
#endif /* YYBTYACC */
    yyresult = 0;

yyreturn:
#if defined(YYDESTRUCT_CALL)
    if (yychar != YYEOF && yychar != YYEMPTY)
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
        YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
#else
        YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */

    {
        YYSTYPE *pv;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
        YYLTYPE *pp;

        for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
             YYDESTRUCT_CALL("cleanup: discarding state",
                             yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
#else
        for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
             YYDESTRUCT_CALL("cleanup: discarding state",
                             yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
    }
#endif /* defined(YYDESTRUCT_CALL) */

#if YYBTYACC
    if (yyerrctx)
    {
        yyFreeState(yyerrctx);
        yyerrctx = NULL;
    }
    while (yyps)
    {
        YYParseState *save = yyps;
        yyps = save->save;
        save->save = NULL;
        yyFreeState(save);
    }
    while (yypath)
    {
        YYParseState *save = yypath;
        yypath = save->save;
        save->save = NULL;
        yyFreeState(save);
    }
#endif /* YYBTYACC */
    yyfreestack(&yystack);
    return (yyresult);
}
Beispiel #3
0
  int
  config_parser::parse ()
  {
    /// Lookahead and lookahead 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 lookahead.
    semantic_type yylval;
    /// Location of the lookahead.
    location_type yylloc;
    /// The locations where the error started and ended.
    location_type yyerror_range[2];

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

    int yyresult;

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


    /* User initialization code.  */
    
{
// start
	// void
 yylloc.begin.filename = yylloc.end.filename = driver.getFileNamePtr(); //new string(driver.getFileName());
/* @$.begin.line = @$.end.line = 0;
 @$.begin.column = @$.end.column = 0;
*/
}


    /* 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;

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

    goto yybackup;

    /* Backup.  */
  yybackup:

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

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


    /* 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;
      }

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

    /* Discard the token being shifted.  */
    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 2:

    { driver.addBlockList((yysemantic_stack_[(1) - (1)].gc_block_list)); }
    break;

  case 4:

    { (yyval.gc_block_list) = new GConfigBlockList((yysemantic_stack_[(1) - (1)].gc_block)); }
    break;

  case 5:

    { (yysemantic_stack_[(2) - (1)].gc_block_list)->appendBlock((yysemantic_stack_[(2) - (2)].gc_block)); (yyval.gc_block_list) = (yysemantic_stack_[(2) - (1)].gc_block_list); }
    break;

  case 6:

    { (yyval.gc_block_header) = new GConfigBlockHeader((yysemantic_stack_[(5) - (1)].str_val), (yysemantic_stack_[(5) - (3)].gc_identifier), (yylocation_stack_[(5) - (1)])); free((yysemantic_stack_[(5) - (1)].str_val)); }
    break;

  case 7:

    { (yyval.gc_block_header) = new GConfigBlockHeader((yysemantic_stack_[(2) - (1)].str_val), (yylocation_stack_[(2) - (1)])); free((yysemantic_stack_[(2) - (1)].str_val)); }
    break;

  case 8:

    { (yyval.gc_block) = new GConfigBlock((yysemantic_stack_[(3) - (1)].gc_block_header), (yysemantic_stack_[(3) - (2)].gc_statement_list)); }
    break;

  case 9:

    { (yyval.gc_identifier) = new GConfigIdentifier((yysemantic_stack_[(1) - (1)].str_val), (yylocation_stack_[(1) - (1)])); free((yysemantic_stack_[(1) - (1)].str_val)); }
    break;

  case 10:

    { (yysemantic_stack_[(3) - (1)].gc_identifier)->appendString((yysemantic_stack_[(3) - (3)].str_val), (yylocation_stack_[(3) - (3)])); free((yysemantic_stack_[(3) - (3)].str_val)); (yyval.gc_identifier) = (yysemantic_stack_[(3) - (1)].gc_identifier); }
    break;

  case 11:

    { (yyval.gc_statement_list) = new GConfigStatementList((yysemantic_stack_[(1) - (1)].gc_statement)); }
    break;

  case 12:

    { (yysemantic_stack_[(2) - (1)].gc_statement_list)->appendStatement((yysemantic_stack_[(2) - (2)].gc_statement)); (yyval.gc_statement_list) = (yysemantic_stack_[(2) - (1)].gc_statement_list); }
    break;

  case 13:

    { (yyval.gc_statement) = (yysemantic_stack_[(1) - (1)].gc_block); }
    break;

  case 14:

    { (yyval.gc_statement) = (yysemantic_stack_[(1) - (1)].gc_function); }
    break;

  case 15:

    { (yyval.gc_statement) = (yysemantic_stack_[(1) - (1)].gc_variable); }
    break;

  case 16:

    { (yyval.gc_statement) = (yysemantic_stack_[(1) - (1)].gc_define); }
    break;

  case 17:

    { (yyval.gc_variable) = new GConfigVariableStatement((yysemantic_stack_[(4) - (1)].gc_identifier), (yysemantic_stack_[(4) - (3)].gc_argument)); }
    break;

  case 18:

    { (yyval.gc_define) = new GConfigDefineStatement((yysemantic_stack_[(2) - (1)].gc_identifier)); }
    break;

  case 19:

    { (yyval.gc_function) = new GConfigFunctionStatement((yysemantic_stack_[(5) - (1)].gc_identifier), (yysemantic_stack_[(5) - (3)].gc_argument_list)); }
    break;

  case 20:

    { (yyval.gc_argument) = new GConfigArgument((yysemantic_stack_[(1) - (1)].gc_scalar_val)); }
    break;

  case 21:

    { (yyval.gc_argument) = new GConfigArgument((yysemantic_stack_[(3) - (2)].gc_argument_list)); }
    break;

  case 22:

    { (yyval.gc_argument_list) = new GConfigArgumentList((yysemantic_stack_[(1) - (1)].gc_scalar_val)); }
    break;

  case 23:

    { (yysemantic_stack_[(3) - (1)].gc_argument_list)->appendArgument((yysemantic_stack_[(3) - (3)].gc_scalar_val)); (yyval.gc_argument_list) = (yysemantic_stack_[(3) - (1)].gc_argument_list); }
    break;

  case 24:

    { (yyval.gc_scalar_val) = new GConfigScalarVal((yysemantic_stack_[(1) - (1)].long_val), (yylocation_stack_[(1) - (1)])); }
    break;

  case 25:

    { (yyval.gc_scalar_val) = new GConfigScalarVal((yysemantic_stack_[(1) - (1)].double_val), (yylocation_stack_[(1) - (1)])); }
    break;

  case 26:

    { (yyval.gc_scalar_val) = new GConfigScalarVal((yysemantic_stack_[(1) - (1)].str_val), (yylocation_stack_[(1) - (1)])); free((yysemantic_stack_[(1) - (1)].str_val)); }
    break;

  case 27:

    { (yyval.gc_scalar_val) = new GConfigScalarVal((yysemantic_stack_[(1) - (1)].gc_identifier)); }
    break;



	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 lookahead 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 lookahead 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 ();
      }

    yyerror_range[1] = yylloc;
    // Using YYLLOC is tempting, but would change the location of
    // the lookahead.  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 != 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;
  }
Beispiel #4
0
  int
  obj_parser::parse ()
  {
    /// Lookahead and lookahead 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 lookahead.
    static semantic_type yyval_default;
    semantic_type yylval = yyval_default;
    /// Location of the lookahead.
    location_type yylloc;
    /// The locations where the error started and ended.
    location_type yyerror_range[3];

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

    int yyresult;

    // FIXME: This shoud be completely indented.  It is not yet to
    // avoid gratuitous conflicts when merging into the master branch.
    try
      {
    YYCDEBUG << "Starting parse" << std::endl;


    /* 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_.clear ();
    yysemantic_stack_.clear ();
    yylocation_stack_.clear ();
    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yylloc);

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

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

    goto yybackup;

    /* Backup.  */
  yybackup:

    /* Try to take a decision without lookahead.  */
    yyn = yypact_[yystate];
    if (yy_pact_value_is_default_ (yyn))
      goto yydefault;

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

    /* 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 (yy_table_value_is_error_ (yyn))
	  goto yyerrlab;
	yyn = -yyn;
	goto yyreduce;
      }

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

    /* Discard the token being shifted.  */
    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];

    // Compute the default @$.
    {
      slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
      YYLLOC_DEFAULT (yyloc, slice, yylen);
    }

    // Perform the reduction.
    YY_REDUCE_PRINT (yyn);
    switch (yyn)
      {
          case 6:
/* Line 664 of lalr1.cc  */
#line 174 "obj_parser.y"
    { reader.parse_mtl(*(yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 7:
/* Line 664 of lalr1.cc  */
#line 175 "obj_parser.y"
    { reader.set_mtl_name((yysemantic_stack_[(1) - (1)].sval)); }
    break;

  case 8:
/* Line 664 of lalr1.cc  */
#line 176 "obj_parser.y"
    { reader.add((yysemantic_stack_[(1) - (1)].v)); }
    break;

  case 9:
/* Line 664 of lalr1.cc  */
#line 177 "obj_parser.y"
    { reader.add((yysemantic_stack_[(1) - (1)].vn)); }
    break;

  case 10:
/* Line 664 of lalr1.cc  */
#line 178 "obj_parser.y"
    { reader.add((yysemantic_stack_[(1) - (1)].vt)); }
    break;

  case 11:
/* Line 664 of lalr1.cc  */
#line 179 "obj_parser.y"
    { reader.add((yysemantic_stack_[(1) - (1)].f)); }
    break;

  case 12:
/* Line 664 of lalr1.cc  */
#line 180 "obj_parser.y"
    { reader.add((yysemantic_stack_[(1) - (1)].obj)); }
    break;

  case 14:
/* Line 664 of lalr1.cc  */
#line 182 "obj_parser.y"
    { reader.add((yysemantic_stack_[(1) - (1)].obj)); }
    break;

  case 15:
/* Line 664 of lalr1.cc  */
#line 185 "obj_parser.y"
    { reader.add((yysemantic_stack_[(1) - (1)].mtl)); }
    break;

  case 16:
/* Line 664 of lalr1.cc  */
#line 186 "obj_parser.y"
    { reader.set_mtl_Ka((yysemantic_stack_[(1) - (1)].color)); }
    break;

  case 17:
/* Line 664 of lalr1.cc  */
#line 187 "obj_parser.y"
    { reader.set_mtl_Kd((yysemantic_stack_[(1) - (1)].color)); }
    break;

  case 18:
/* Line 664 of lalr1.cc  */
#line 188 "obj_parser.y"
    { reader.set_mtl_Ks((yysemantic_stack_[(1) - (1)].color)); }
    break;

  case 19:
/* Line 664 of lalr1.cc  */
#line 189 "obj_parser.y"
    { reader.set_mtl_Ns((yysemantic_stack_[(1) - (1)].fval)); }
    break;

  case 20:
/* Line 664 of lalr1.cc  */
#line 190 "obj_parser.y"
    { reader.set_mtl_Ke((yysemantic_stack_[(1) - (1)].color)); }
    break;

  case 21:
/* Line 664 of lalr1.cc  */
#line 191 "obj_parser.y"
    { reader.set_mtl_d((yysemantic_stack_[(1) - (1)].fval)); }
    break;

  case 22:
/* Line 664 of lalr1.cc  */
#line 192 "obj_parser.y"
    { reader.set_mtl_illum((yysemantic_stack_[(1) - (1)].ival)); }
    break;

  case 23:
/* Line 664 of lalr1.cc  */
#line 193 "obj_parser.y"
    { reader.set_mtl_map_Ka((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 24:
/* Line 664 of lalr1.cc  */
#line 194 "obj_parser.y"
    { reader.set_mtl_map_Kd((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 25:
/* Line 664 of lalr1.cc  */
#line 195 "obj_parser.y"
    { reader.set_mtl_map_Ks((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 26:
/* Line 664 of lalr1.cc  */
#line 196 "obj_parser.y"
    { reader.set_mtl_map_Ns((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 27:
/* Line 664 of lalr1.cc  */
#line 197 "obj_parser.y"
    { reader.set_mtl_map_bump((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 28:
/* Line 664 of lalr1.cc  */
#line 198 "obj_parser.y"
    { reader.set_mtl_map_d((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 29:
/* Line 664 of lalr1.cc  */
#line 199 "obj_parser.y"
    { reader.set_mtl_disp((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 30:
/* Line 664 of lalr1.cc  */
#line 200 "obj_parser.y"
    { reader.set_mtl_decal((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 31:
/* Line 664 of lalr1.cc  */
#line 201 "obj_parser.y"
    { reader.set_mtl_refl((yysemantic_stack_[(1) - (1)].tex)); }
    break;

  case 32:
/* Line 664 of lalr1.cc  */
#line 202 "obj_parser.y"
    { reader.set_mtl_Tf((yysemantic_stack_[(1) - (1)].color)); }
    break;

  case 33:
/* Line 664 of lalr1.cc  */
#line 203 "obj_parser.y"
    { reader.set_mtl_Ni((yysemantic_stack_[(1) - (1)].fval)); }
    break;

  case 35:
/* Line 664 of lalr1.cc  */
#line 208 "obj_parser.y"
    { (yyval.sval) = (yysemantic_stack_[(2) - (2)].sval); }
    break;

  case 36:
/* Line 664 of lalr1.cc  */
#line 212 "obj_parser.y"
    { (yyval.v) = new obj::vertex((yysemantic_stack_[(5) - (2)].fval), (yysemantic_stack_[(5) - (3)].fval), (yysemantic_stack_[(5) - (4)].fval), (yysemantic_stack_[(5) - (5)].fval)); }
    break;

  case 37:
/* Line 664 of lalr1.cc  */
#line 213 "obj_parser.y"
    { (yyval.v) = new obj::vertex((yysemantic_stack_[(4) - (2)].fval), (yysemantic_stack_[(4) - (3)].fval), (yysemantic_stack_[(4) - (4)].fval)); }
    break;

  case 38:
/* Line 664 of lalr1.cc  */
#line 217 "obj_parser.y"
    { (yyval.vn) = new obj::normal((yysemantic_stack_[(4) - (2)].fval), (yysemantic_stack_[(4) - (3)].fval), (yysemantic_stack_[(4) - (4)].fval)); }
    break;

  case 39:
/* Line 664 of lalr1.cc  */
#line 221 "obj_parser.y"
    { (yyval.vt) = new obj::texture((yysemantic_stack_[(4) - (2)].fval), (yysemantic_stack_[(4) - (3)].fval), (yysemantic_stack_[(4) - (4)].fval)); }
    break;

  case 40:
/* Line 664 of lalr1.cc  */
#line 222 "obj_parser.y"
    { (yyval.vt) = new obj::texture((yysemantic_stack_[(3) - (2)].fval), (yysemantic_stack_[(3) - (3)].fval)); }
    break;

  case 41:
/* Line 664 of lalr1.cc  */
#line 223 "obj_parser.y"
    { (yyval.vt) = new obj::texture((yysemantic_stack_[(2) - (2)].fval)); }
    break;

  case 42:
/* Line 664 of lalr1.cc  */
#line 227 "obj_parser.y"
    { (yyval.obj) = new obj::object((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 43:
/* Line 664 of lalr1.cc  */
#line 231 "obj_parser.y"
    { /*std::cout << "smoothing group: " << $2 << std::endl;*/ }
    break;

  case 44:
/* Line 664 of lalr1.cc  */
#line 232 "obj_parser.y"
    { /*std::cout << "smoothing group: " << $2 << std::endl;*/ }
    break;

  case 45:
/* Line 664 of lalr1.cc  */
#line 236 "obj_parser.y"
    { (yyval.iv) = new obj::ivertex((yysemantic_stack_[(5) - (1)].ival), (yysemantic_stack_[(5) - (3)].ival), (yysemantic_stack_[(5) - (5)].ival)); }
    break;

  case 46:
/* Line 664 of lalr1.cc  */
#line 237 "obj_parser.y"
    { (yyval.iv) = new obj::ivertex((yysemantic_stack_[(4) - (1)].ival), (yysemantic_stack_[(4) - (4)].ival)); }
    break;

  case 47:
/* Line 664 of lalr1.cc  */
#line 241 "obj_parser.y"
    { (yyval.f) = new obj::face((yysemantic_stack_[(5) - (2)].iv), (yysemantic_stack_[(5) - (3)].iv), (yysemantic_stack_[(5) - (4)].iv), (yysemantic_stack_[(5) - (5)].iv)); }
    break;

  case 48:
/* Line 664 of lalr1.cc  */
#line 242 "obj_parser.y"
    { (yyval.f) = new obj::face((yysemantic_stack_[(4) - (2)].iv), (yysemantic_stack_[(4) - (3)].iv), (yysemantic_stack_[(4) - (4)].iv)); }
    break;

  case 49:
/* Line 664 of lalr1.cc  */
#line 245 "obj_parser.y"
    { (yyval.obj) = new obj::object((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 50:
/* Line 664 of lalr1.cc  */
#line 249 "obj_parser.y"
    { (yyval.fval) = (yysemantic_stack_[(1) - (1)].ival); }
    break;

  case 51:
/* Line 664 of lalr1.cc  */
#line 250 "obj_parser.y"
    { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); }
    break;

  case 52:
/* Line 664 of lalr1.cc  */
#line 253 "obj_parser.y"
    { (yyval.sval) = (yysemantic_stack_[(1) - (1)].sval); }
    break;

  case 53:
/* Line 664 of lalr1.cc  */
#line 254 "obj_parser.y"
    { (yyval.sval) = (yysemantic_stack_[(1) - (1)].sval); }
    break;

  case 54:
/* Line 664 of lalr1.cc  */
#line 257 "obj_parser.y"
    { (yyval.mtl) = new obj::material((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 56:
/* Line 664 of lalr1.cc  */
#line 261 "obj_parser.y"
    { (yyval.color) = new obj::vec3((yysemantic_stack_[(4) - (2)].fval), (yysemantic_stack_[(4) - (3)].fval), (yysemantic_stack_[(4) - (4)].fval)); }
    break;

  case 58:
/* Line 664 of lalr1.cc  */
#line 265 "obj_parser.y"
    { (yyval.color) = new obj::vec3((yysemantic_stack_[(4) - (2)].fval), (yysemantic_stack_[(4) - (3)].fval), (yysemantic_stack_[(4) - (4)].fval)); }
    break;

  case 60:
/* Line 664 of lalr1.cc  */
#line 269 "obj_parser.y"
    { (yyval.color) = new obj::vec3((yysemantic_stack_[(4) - (2)].fval), (yysemantic_stack_[(4) - (3)].fval), (yysemantic_stack_[(4) - (4)].fval)); }
    break;

  case 62:
/* Line 664 of lalr1.cc  */
#line 273 "obj_parser.y"
    { (yyval.color) = new obj::vec3((yysemantic_stack_[(4) - (2)].fval), (yysemantic_stack_[(4) - (3)].fval), (yysemantic_stack_[(4) - (4)].fval)); }
    break;

  case 63:
/* Line 664 of lalr1.cc  */
#line 276 "obj_parser.y"
    { (yyval.fval) = (yysemantic_stack_[(2) - (2)].fval); }
    break;

  case 64:
/* Line 664 of lalr1.cc  */
#line 277 "obj_parser.y"
    { (yyval.fval) = (yysemantic_stack_[(2) - (2)].fval); }
    break;

  case 66:
/* Line 664 of lalr1.cc  */
#line 281 "obj_parser.y"
    { (yyval.fval) = (yysemantic_stack_[(2) - (2)].fval); }
    break;

  case 68:
/* Line 664 of lalr1.cc  */
#line 285 "obj_parser.y"
    { (yyval.ival) = (yysemantic_stack_[(2) - (2)].ival); }
    break;

  case 70:
/* Line 664 of lalr1.cc  */
#line 289 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 72:
/* Line 664 of lalr1.cc  */
#line 293 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 74:
/* Line 664 of lalr1.cc  */
#line 297 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 76:
/* Line 664 of lalr1.cc  */
#line 301 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 79:
/* Line 664 of lalr1.cc  */
#line 306 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 80:
/* Line 664 of lalr1.cc  */
#line 307 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 83:
/* Line 664 of lalr1.cc  */
#line 312 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 84:
/* Line 664 of lalr1.cc  */
#line 313 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 86:
/* Line 664 of lalr1.cc  */
#line 317 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 88:
/* Line 664 of lalr1.cc  */
#line 321 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 90:
/* Line 664 of lalr1.cc  */
#line 325 "obj_parser.y"
    { (yyval.tex) = new obj::tex_map((yysemantic_stack_[(2) - (2)].sval)); }
    break;

  case 91:
/* Line 664 of lalr1.cc  */
#line 327 "obj_parser.y"
    { (yyval.color) = new obj::vec3((yysemantic_stack_[(4) - (2)].fval), (yysemantic_stack_[(4) - (3)].fval), (yysemantic_stack_[(4) - (4)].fval)); }
    break;

  case 93:
/* Line 664 of lalr1.cc  */
#line 331 "obj_parser.y"
    { (yyval.fval) = (yysemantic_stack_[(2) - (2)].fval); }
    break;


/* Line 664 of lalr1.cc  */
#line 824 "obj_parser.cpp"
      default:
        break;
      }

    /* User semantic actions sometimes alter yychar, and that requires
       that yytoken be updated with the new translation.  We take the
       approach of translating immediately before every use of yytoken.
       One alternative is translating here after every semantic action,
       but that translation would be missed if the semantic action
       invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
       yychar.  In the case of YYABORT or YYACCEPT, an incorrect
       destructor might then be invoked immediately.  In the case of
       YYERROR, subsequent parser actions might lead to an incorrect
       destructor call or verbose syntax error message before the
       lookahead is translated.  */
    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:
    /* Make sure we have latest lookahead translation.  See comments at
       user semantic actions for why this is necessary.  */
    yytoken = yytranslate_ (yychar);

    /* If not already recovering from an error, report this error.  */
    if (!yyerrstatus_)
      {
	++yynerrs_;
	if (yychar == yyempty_)
	  yytoken = yyempty_;
	error (yylloc, yysyntax_error_ (yystate, yytoken));
      }

    yyerror_range[1] = yylloc;
    if (yyerrstatus_ == 3)
      {
        /* If just tried and failed to reuse lookahead 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 lookahead 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[1] = 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 (!yy_pact_value_is_default_ (yyn))
	{
	  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[1] = yylocation_stack_[0];
	yydestruct_ ("Error: popping",
		     yystos_[yystate],
		     &yysemantic_stack_[0], &yylocation_stack_[0]);
	yypop_ ();
	yystate = yystate_stack_[0];
	YY_STACK_PRINT ();
      }

    yyerror_range[2] = yylloc;
    // Using YYLLOC is tempting, but would change the location of
    // the lookahead.  YYLOC is available though.
    YYLLOC_DEFAULT (yyloc, yyerror_range, 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 != yyempty_)
      {
        /* Make sure we have latest lookahead translation.  See comments
           at user semantic actions for why this is necessary.  */
        yytoken = yytranslate_ (yychar);
        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 (1 < yystate_stack_.height ())
      {
        yydestruct_ ("Cleanup: popping",
                     yystos_[yystate_stack_[0]],
                     &yysemantic_stack_[0],
                     &yylocation_stack_[0]);
        yypop_ ();
      }

    return yyresult;
    }
    catch (...)
      {
        YYCDEBUG << "Exception caught: cleaning lookahead and stack"
                 << std::endl;
        // Do not try to display the values of the reclaimed symbols,
        // as their printer might throw an exception.
        if (yychar != yyempty_)
          {
            /* Make sure we have latest lookahead translation.  See
               comments at user semantic actions for why this is
               necessary.  */
            yytoken = yytranslate_ (yychar);
            yydestruct_ (YY_NULL, yytoken, &yylval, &yylloc);
          }

        while (1 < yystate_stack_.height ())
          {
            yydestruct_ (YY_NULL,
                         yystos_[yystate_stack_[0]],
                         &yysemantic_stack_[0],
                         &yylocation_stack_[0]);
            yypop_ ();
          }
        throw;
      }
  }
Beispiel #5
0
  int
  Parser::parse ()
  {
    /// Whether yyla contains a lookahead.
    bool yyempty = true;

    // State.
    int yyn;
    /// Length of the RHS of the rule being reduced.
    int yylen = 0;

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

    /// The lookahead symbol.
    symbol_type yyla;

    /// The locations where the error started and ended.
    stack_symbol_type yyerror_range[3];

    /// The return value of parse ().
    int yyresult;

    // FIXME: This shoud be completely indented.  It is not yet to
    // avoid gratuitous conflicts when merging into the master branch.
    try
      {
    YYCDEBUG << "Starting parse" << std::endl;


    // User initialization code.
    #line 36 "parser.yy" // lalr1.cc:725
{
    // initialize the initial location object
    yyla.location.begin.filename = yyla.location.end.filename = &driver.streamname;
}

#line 501 "parser.cpp" // lalr1.cc:725

    /* Initialize the stack.  The initial state will be set in
       yynewstate, since the latter expects the semantical and the
       location values to have been already stored, initialize these
       stacks with a primary value.  */
    yystack_.clear ();
    yypush_ (YY_NULLPTR, 0, yyla);

    // A new symbol was pushed on the stack.
  yynewstate:
    YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;

    // Accept?
    if (yystack_[0].state == yyfinal_)
      goto yyacceptlab;

    goto yybackup;

    // Backup.
  yybackup:

    // Try to take a decision without lookahead.
    yyn = yypact_[yystack_[0].state];
    if (yy_pact_value_is_default_ (yyn))
      goto yydefault;

    // Read a lookahead token.
    if (yyempty)
      {
        YYCDEBUG << "Reading a token: ";
        try
          {
            yyla.type = yytranslate_ (yylex (&yyla.value, &yyla.location));
          }
        catch (const syntax_error& yyexc)
          {
            error (yyexc);
            goto yyerrlab1;
          }
        yyempty = false;
      }
    YY_SYMBOL_PRINT ("Next token is", yyla);

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

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

    // Discard the token being shifted.
    yyempty = true;

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

    // Shift the lookahead token.
    yypush_ ("Shifting", yyn, yyla);
    goto yynewstate;

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

  /*-----------------------------.
  | yyreduce -- Do a reduction.  |
  `-----------------------------*/
  yyreduce:
    yylen = yyr2_[yyn];
    {
      stack_symbol_type yylhs;
      yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[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 YYLHS.VALUE to garbage.
         This behavior is undocumented and Bison users should not rely
         upon it.  */
      if (yylen)
        yylhs.value = yystack_[yylen - 1].value;
      else
        yylhs.value = yystack_[0].value;

      // Compute the default @$.
      {
        slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
        YYLLOC_DEFAULT (yylhs.location, slice, yylen);
      }

      // Perform the reduction.
      YY_REDUCE_PRINT (yyn);
      try
        {
          switch (yyn)
            {
  case 2:
#line 88 "parser.yy" // lalr1.cc:847
    {
          (yylhs.value.querynode) = new query_true();
        }
#line 617 "parser.cpp" // lalr1.cc:847
    break;

  case 3:
#line 92 "parser.yy" // lalr1.cc:847
    {
          (yylhs.value.querynode) = new query_true();
        }
#line 625 "parser.cpp" // lalr1.cc:847
    break;

  case 4:
#line 97 "parser.yy" // lalr1.cc:847
    {
              (yylhs.value.stringVal) = (yystack_[0].value.stringVal);
            }
#line 633 "parser.cpp" // lalr1.cc:847
    break;

  case 5:
#line 102 "parser.yy" // lalr1.cc:847
    {
              (yylhs.value.stringVal) = (yystack_[0].value.stringVal);
            }
#line 641 "parser.cpp" // lalr1.cc:847
    break;

  case 6:
#line 106 "parser.yy" // lalr1.cc:847
    {
              (yylhs.value.stringVal) = (yystack_[0].value.stringVal);
            }
#line 649 "parser.cpp" // lalr1.cc:847
    break;

  case 7:
#line 110 "parser.yy" // lalr1.cc:847
    {
              (yylhs.value.stringVal) = (yystack_[0].value.stringVal);
            }
#line 657 "parser.cpp" // lalr1.cc:847
    break;

  case 8:
#line 114 "parser.yy" // lalr1.cc:847
    {
              (yylhs.value.stringVal) = (yystack_[0].value.stringVal);
            }
#line 665 "parser.cpp" // lalr1.cc:847
    break;

  case 9:
#line 118 "parser.yy" // lalr1.cc:847
    {
              (yylhs.value.stringVal) = (yystack_[0].value.stringVal);
            }
#line 673 "parser.cpp" // lalr1.cc:847
    break;

  case 10:
#line 123 "parser.yy" // lalr1.cc:847
    {
            delete (yystack_[1].value.stringVal);
            (yylhs.value.querynode) = new query_tagged((yystack_[0].value.stringVal));
          }
#line 682 "parser.cpp" // lalr1.cc:847
    break;

  case 11:
#line 128 "parser.yy" // lalr1.cc:847
    {
            (yylhs.value.querynode) = new query_tagged((yystack_[0].value.stringVal));
          }
#line 690 "parser.cpp" // lalr1.cc:847
    break;

  case 12:
#line 132 "parser.yy" // lalr1.cc:847
    {
            delete (yystack_[1].value.stringVal);
            (yylhs.value.querynode) = new query_field((yystack_[2].value.unquotedstringVal));
          }
#line 699 "parser.cpp" // lalr1.cc:847
    break;

  case 13:
#line 138 "parser.yy" // lalr1.cc:847
    {
            (yylhs.value.querynode) = new query_field((yystack_[2].value.unquotedstringVal), (yystack_[0].value.stringVal), (yystack_[1].value.stringVal));
          }
#line 707 "parser.cpp" // lalr1.cc:847
    break;

  case 14:
#line 142 "parser.yy" // lalr1.cc:847
    {
            (yylhs.value.querynode) = new query_field((yystack_[2].value.unquotedstringVal), (yystack_[0].value.integerVal), (yystack_[1].value.stringVal));
          }
#line 715 "parser.cpp" // lalr1.cc:847
    break;

  case 15:
#line 146 "parser.yy" // lalr1.cc:847
    {
            (yylhs.value.querynode) = new query_field((yystack_[2].value.unquotedstringVal), (yystack_[0].value.doubleVal), (yystack_[1].value.stringVal));
          }
#line 723 "parser.cpp" // lalr1.cc:847
    break;

  case 16:
#line 151 "parser.yy" // lalr1.cc:847
    {
          (yylhs.value.querynode) = (yystack_[1].value.querynode);
        }
#line 731 "parser.cpp" // lalr1.cc:847
    break;

  case 17:
#line 155 "parser.yy" // lalr1.cc:847
    {
          (yylhs.value.querynode) = new query_and((yystack_[2].value.querynode), (yystack_[0].value.querynode));
        }
#line 739 "parser.cpp" // lalr1.cc:847
    break;

  case 18:
#line 159 "parser.yy" // lalr1.cc:847
    {
          (yylhs.value.querynode) = new query_or((yystack_[2].value.querynode), (yystack_[0].value.querynode));
        }
#line 747 "parser.cpp" // lalr1.cc:847
    break;

  case 19:
#line 163 "parser.yy" // lalr1.cc:847
    {
          (yylhs.value.querynode) = new query_not((yystack_[0].value.querynode));
        }
#line 755 "parser.cpp" // lalr1.cc:847
    break;

  case 20:
#line 167 "parser.yy" // lalr1.cc:847
    {
          (yylhs.value.querynode) = (yystack_[0].value.querynode);
        }
#line 763 "parser.cpp" // lalr1.cc:847
    break;

  case 21:
#line 172 "parser.yy" // lalr1.cc:847
    {
            driver.query.set_expression((yystack_[0].value.querynode));
          }
#line 771 "parser.cpp" // lalr1.cc:847
    break;

  case 22:
#line 176 "parser.yy" // lalr1.cc:847
    {
            driver.query.set_expression((yystack_[0].value.querynode));
          }
#line 779 "parser.cpp" // lalr1.cc:847
    break;


#line 783 "parser.cpp" // lalr1.cc:847
            default:
              break;
            }
        }
      catch (const syntax_error& yyexc)
        {
          error (yyexc);
          YYERROR;
        }
      YY_SYMBOL_PRINT ("-> $$ =", yylhs);
      yypop_ (yylen);
      yylen = 0;
      YY_STACK_PRINT ();

      // Shift the result of the reduction.
      yypush_ (YY_NULLPTR, yylhs);
    }
    goto yynewstate;

  /*--------------------------------------.
  | yyerrlab -- here on detecting error.  |
  `--------------------------------------*/
  yyerrlab:
    // If not already recovering from an error, report this error.
    if (!yyerrstatus_)
      {
        ++yynerrs_;
        error (yyla.location, yysyntax_error_ (yystack_[0].state,
                                           yyempty ? yyempty_ : yyla.type_get ()));
      }


    yyerror_range[1].location = yyla.location;
    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 (yyla.type_get () == yyeof_)
          YYABORT;
        else if (!yyempty)
          {
            yy_destroy_ ("Error: discarding", yyla);
            yyempty = true;
          }
      }

    // Else will try to reuse lookahead 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[1].location = yystack_[yylen - 1].location;
    /* Do not reclaim the symbols of the rule whose action triggered
       this YYERROR.  */
    yypop_ (yylen);
    yylen = 0;
    goto yyerrlab1;

  /*-------------------------------------------------------------.
  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  `-------------------------------------------------------------*/
  yyerrlab1:
    yyerrstatus_ = 3;   // Each real token shifted decrements this.
    {
      stack_symbol_type error_token;
      for (;;)
        {
          yyn = yypact_[yystack_[0].state];
          if (!yy_pact_value_is_default_ (yyn))
            {
              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 (yystack_.size () == 1)
            YYABORT;

          yyerror_range[1].location = yystack_[0].location;
          yy_destroy_ ("Error: popping", yystack_[0]);
          yypop_ ();
          YY_STACK_PRINT ();
        }

      yyerror_range[2].location = yyla.location;
      YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);

      // Shift the error token.
      error_token.state = yyn;
      yypush_ ("Shifting", error_token);
    }
    goto yynewstate;

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

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

  yyreturn:
    if (!yyempty)
      yy_destroy_ ("Cleanup: discarding lookahead", yyla);

    /* Do not reclaim the symbols of the rule whose action triggered
       this YYABORT or YYACCEPT.  */
    yypop_ (yylen);
    while (1 < yystack_.size ())
      {
        yy_destroy_ ("Cleanup: popping", yystack_[0]);
        yypop_ ();
      }

    return yyresult;
  }
    catch (...)
      {
        YYCDEBUG << "Exception caught: cleaning lookahead and stack"
                 << std::endl;
        // Do not try to display the values of the reclaimed symbols,
        // as their printer might throw an exception.
        if (!yyempty)
          yy_destroy_ (YY_NULLPTR, yyla);

        while (1 < yystack_.size ())
          {
            yy_destroy_ (YY_NULLPTR, yystack_[0]);
            yypop_ ();
          }
        throw;
      }
  }
  int
  xml_parser::parse ()
  {
    // State.
    int yyn;
    /// Length of the RHS of the rule being reduced.
    int yylen = 0;

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

    /// The lookahead symbol.
    symbol_type yyla;

    /// The locations where the error started and ended.
    stack_symbol_type yyerror_range[3];

    /// The return value of parse ().
    int yyresult;

    // FIXME: This shoud be completely indented.  It is not yet to
    // avoid gratuitous conflicts when merging into the master branch.
    try
      {
    YYCDEBUG << "Starting parse" << std::endl;


    /* Initialize the stack.  The initial state will be set in
       yynewstate, since the latter expects the semantical and the
       location values to have been already stored, initialize these
       stacks with a primary value.  */
    yystack_.clear ();
    yypush_ (YY_NULLPTR, 0, yyla);

    // A new symbol was pushed on the stack.
  yynewstate:
    YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;

    // Accept?
    if (yystack_[0].state == yyfinal_)
      goto yyacceptlab;

    goto yybackup;

    // Backup.
  yybackup:

    // Try to take a decision without lookahead.
    yyn = yypact_[yystack_[0].state];
    if (yy_pact_value_is_default_ (yyn))
      goto yydefault;

    // Read a lookahead token.
    if (yyla.empty ())
      {
        YYCDEBUG << "Reading a token: ";
        try
          {
            symbol_type yylookahead (yylex ());
            yyla.move (yylookahead);
          }
        catch (const syntax_error& yyexc)
          {
            error (yyexc);
            goto yyerrlab1;
          }
      }
    YY_SYMBOL_PRINT ("Next token is", yyla);

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

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

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

    // Shift the lookahead token.
    yypush_ ("Shifting", yyn, yyla);
    goto yynewstate;

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

  /*-----------------------------.
  | yyreduce -- Do a reduction.  |
  `-----------------------------*/
  yyreduce:
    yylen = yyr2_[yyn];
    {
      stack_symbol_type yylhs;
      yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);
      /* Variants are always initialized to an empty instance of the
         correct type. The default '$$ = $1' action is NOT applied
         when using variants.  */
        switch (yyr1_[yyn])
    {
      case 3: // NAME
      case 4: // TEXT
      case 5: // STRING
        yylhs.value.build< std::string > ();
        break;

      default:
        break;
    }


      // Compute the default @$.
      {
        slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
        YYLLOC_DEFAULT (yylhs.location, slice, yylen);
      }

      // Perform the reduction.
      YY_REDUCE_PRINT (yyn);
      try
        {
          switch (yyn)
            {
  case 2:
#line 38 "xml_parser/parser.ypp" // lalr1.cc:859
    { result = "OK"; }
#line 541 "xml_parser/parser.cpp" // lalr1.cc:859
    break;

  case 6:
    if (! (//#line 46 "xml_parser/parser.ypp" // lalr1.cc:859
     yystack_[5].value.as< std::string > () == yystack_[0].value.as< std::string > () )) YYERROR;
#line 547 "xml_parser/parser.cpp" // lalr1.cc:859
    break;


#line 551 "xml_parser/parser.cpp" // lalr1.cc:859
            default:
              break;
            }
        }
      catch (const syntax_error& yyexc)
        {
          error (yyexc);
          YYERROR;
        }
      YY_SYMBOL_PRINT ("-> $$ =", yylhs);
      yypop_ (yylen);
      yylen = 0;
      YY_STACK_PRINT ();

      // Shift the result of the reduction.
      yypush_ (YY_NULLPTR, yylhs);
    }
    goto yynewstate;

  /*--------------------------------------.
  | yyerrlab -- here on detecting error.  |
  `--------------------------------------*/
  yyerrlab:
    // If not already recovering from an error, report this error.
    if (!yyerrstatus_)
      {
        ++yynerrs_;
        error (yyla.location, yysyntax_error_ (yystack_[0].state, yyla));
      }


    yyerror_range[1].location = yyla.location;
    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 (yyla.type_get () == yyeof_)
          YYABORT;
        else if (!yyla.empty ())
          {
            yy_destroy_ ("Error: discarding", yyla);
            yyla.clear ();
          }
      }

    // Else will try to reuse lookahead 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[1].location = yystack_[yylen - 1].location;
    /* Do not reclaim the symbols of the rule whose action triggered
       this YYERROR.  */
    yypop_ (yylen);
    yylen = 0;
    goto yyerrlab1;

  /*-------------------------------------------------------------.
  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  `-------------------------------------------------------------*/
  yyerrlab1:
    yyerrstatus_ = 3;   // Each real token shifted decrements this.
    {
      stack_symbol_type error_token;
      for (;;)
        {
          yyn = yypact_[yystack_[0].state];
          if (!yy_pact_value_is_default_ (yyn))
            {
              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 (yystack_.size () == 1)
            YYABORT;

          yyerror_range[1].location = yystack_[0].location;
          yy_destroy_ ("Error: popping", yystack_[0]);
          yypop_ ();
          YY_STACK_PRINT ();
        }

      yyerror_range[2].location = yyla.location;
      YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);

      // Shift the error token.
      error_token.state = yyn;
      yypush_ ("Shifting", error_token);
    }
    goto yynewstate;

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

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

  yyreturn:
    if (!yyla.empty ())
      yy_destroy_ ("Cleanup: discarding lookahead", yyla);

    /* Do not reclaim the symbols of the rule whose action triggered
       this YYABORT or YYACCEPT.  */
    yypop_ (yylen);
    while (1 < yystack_.size ())
      {
        yy_destroy_ ("Cleanup: popping", yystack_[0]);
        yypop_ ();
      }

    return yyresult;
  }
    catch (...)
      {
        YYCDEBUG << "Exception caught: cleaning lookahead and stack"
                 << std::endl;
        // Do not try to display the values of the reclaimed symbols,
        // as their printer might throw an exception.
        if (!yyla.empty ())
          yy_destroy_ (YY_NULLPTR, yyla);

        while (1 < yystack_.size ())
          {
            yy_destroy_ (YY_NULLPTR, yystack_[0]);
            yypop_ ();
          }
        throw;
      }
  }
Beispiel #7
0
  int
  Parser::parse ()
  {
    /// Lookahead and lookahead 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 lookahead.
    semantic_type yylval;
    /// Location of the lookahead.
    location_type yylloc;
    /// The locations where the error started and ended.
    location_type yyerror_range[3];

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

    int yyresult;

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


    /* User initialization code.  */
    
/* Line 565 of lalr1.cc  */
#line 36 "parser.yy"
{
    // initialize the initial location object
    yylloc.begin.filename = yylloc.end.filename = &driver.streamname;
}

/* Line 565 of lalr1.cc  */
#line 352 "parser.cpp"

    /* 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;

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

    goto yybackup;

    /* Backup.  */
  yybackup:

    /* Try to take a decision without lookahead.  */
    yyn = yypact_[yystate];
    if (yy_pact_value_is_default_ (yyn))
      goto yydefault;

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


    /* 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 (yy_table_value_is_error_ (yyn))
	  goto yyerrlab;
	yyn = -yyn;
	goto yyreduce;
      }

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

    /* Discard the token being shifted.  */
    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 2:

/* Line 690 of lalr1.cc  */
#line 88 "parser.yy"
    {
          (yyval.querynode) = new query_true();
        }
    break;

  case 3:

/* Line 690 of lalr1.cc  */
#line 92 "parser.yy"
    {
          (yyval.querynode) = new query_true();
        }
    break;

  case 4:

/* Line 690 of lalr1.cc  */
#line 97 "parser.yy"
    {
              (yyval.stringVal) = (yysemantic_stack_[(1) - (1)].stringVal);
            }
    break;

  case 5:

/* Line 690 of lalr1.cc  */
#line 102 "parser.yy"
    {
              (yyval.stringVal) = (yysemantic_stack_[(1) - (1)].stringVal);
            }
    break;

  case 6:

/* Line 690 of lalr1.cc  */
#line 106 "parser.yy"
    {
              (yyval.stringVal) = (yysemantic_stack_[(1) - (1)].stringVal);
            }
    break;

  case 7:

/* Line 690 of lalr1.cc  */
#line 110 "parser.yy"
    {
              (yyval.stringVal) = (yysemantic_stack_[(1) - (1)].stringVal);
            }
    break;

  case 8:

/* Line 690 of lalr1.cc  */
#line 114 "parser.yy"
    {
              (yyval.stringVal) = (yysemantic_stack_[(1) - (1)].stringVal);
            }
    break;

  case 9:

/* Line 690 of lalr1.cc  */
#line 118 "parser.yy"
    {
              (yyval.stringVal) = (yysemantic_stack_[(1) - (1)].stringVal);
            }
    break;

  case 10:

/* Line 690 of lalr1.cc  */
#line 123 "parser.yy"
    {
            delete (yysemantic_stack_[(3) - (2)].stringVal);
            (yyval.querynode) = new query_tagged((yysemantic_stack_[(3) - (3)].stringVal));
          }
    break;

  case 11:

/* Line 690 of lalr1.cc  */
#line 128 "parser.yy"
    {
            delete (yysemantic_stack_[(3) - (2)].stringVal);
            (yyval.querynode) = new query_field((yysemantic_stack_[(3) - (1)].unquotedstringVal));
          }
    break;

  case 12:

/* Line 690 of lalr1.cc  */
#line 134 "parser.yy"
    {
            (yyval.querynode) = new query_field((yysemantic_stack_[(3) - (1)].unquotedstringVal), (yysemantic_stack_[(3) - (3)].stringVal), (yysemantic_stack_[(3) - (2)].stringVal));
          }
    break;

  case 13:

/* Line 690 of lalr1.cc  */
#line 138 "parser.yy"
    {
            (yyval.querynode) = new query_field((yysemantic_stack_[(3) - (1)].unquotedstringVal), (yysemantic_stack_[(3) - (3)].integerVal), (yysemantic_stack_[(3) - (2)].stringVal));
          }
    break;

  case 14:

/* Line 690 of lalr1.cc  */
#line 142 "parser.yy"
    {
            (yyval.querynode) = new query_field((yysemantic_stack_[(3) - (1)].unquotedstringVal), (yysemantic_stack_[(3) - (3)].doubleVal), (yysemantic_stack_[(3) - (2)].stringVal));
          }
    break;

  case 15:

/* Line 690 of lalr1.cc  */
#line 147 "parser.yy"
    {
          (yyval.querynode) = (yysemantic_stack_[(3) - (2)].querynode);
        }
    break;

  case 16:

/* Line 690 of lalr1.cc  */
#line 151 "parser.yy"
    {
          (yyval.querynode) = new query_and((yysemantic_stack_[(3) - (1)].querynode), (yysemantic_stack_[(3) - (3)].querynode));
        }
    break;

  case 17:

/* Line 690 of lalr1.cc  */
#line 155 "parser.yy"
    {
          (yyval.querynode) = new query_or((yysemantic_stack_[(3) - (1)].querynode), (yysemantic_stack_[(3) - (3)].querynode));
        }
    break;

  case 18:

/* Line 690 of lalr1.cc  */
#line 159 "parser.yy"
    {
          (yyval.querynode) = new query_not((yysemantic_stack_[(2) - (2)].querynode));
        }
    break;

  case 19:

/* Line 690 of lalr1.cc  */
#line 163 "parser.yy"
    {
          (yyval.querynode) = (yysemantic_stack_[(1) - (1)].querynode);
        }
    break;

  case 20:

/* Line 690 of lalr1.cc  */
#line 168 "parser.yy"
    {
            driver.query.set_expression((yysemantic_stack_[(1) - (1)].querynode));
          }
    break;

  case 21:

/* Line 690 of lalr1.cc  */
#line 172 "parser.yy"
    {
            driver.query.set_expression((yysemantic_stack_[(1) - (1)].querynode));
          }
    break;



/* Line 690 of lalr1.cc  */
#line 653 "parser.cpp"
	default:
          break;
      }
    /* User semantic actions sometimes alter yychar, and that requires
       that yytoken be updated with the new translation.  We take the
       approach of translating immediately before every use of yytoken.
       One alternative is translating here after every semantic action,
       but that translation would be missed if the semantic action
       invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
       yychar.  In the case of YYABORT or YYACCEPT, an incorrect
       destructor might then be invoked immediately.  In the case of
       YYERROR, subsequent parser actions might lead to an incorrect
       destructor call or verbose syntax error message before the
       lookahead is translated.  */
    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:
    /* Make sure we have latest lookahead translation.  See comments at
       user semantic actions for why this is necessary.  */
    yytoken = yytranslate_ (yychar);

    /* If not already recovering from an error, report this error.  */
    if (!yyerrstatus_)
      {
	++yynerrs_;
	if (yychar == yyempty_)
	  yytoken = yyempty_;
	error (yylloc, yysyntax_error_ (yystate, yytoken));
      }

    yyerror_range[1] = yylloc;
    if (yyerrstatus_ == 3)
      {
	/* If just tried and failed to reuse lookahead 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 lookahead 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[1] = 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 (!yy_pact_value_is_default_ (yyn))
	{
	  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[1] = yylocation_stack_[0];
	yydestruct_ ("Error: popping",
		     yystos_[yystate],
		     &yysemantic_stack_[0], &yylocation_stack_[0]);
	yypop_ ();
	yystate = yystate_stack_[0];
	YY_STACK_PRINT ();
      }

    yyerror_range[2] = yylloc;
    // Using YYLLOC is tempting, but would change the location of
    // the lookahead.  YYLOC is available though.
    YYLLOC_DEFAULT (yyloc, yyerror_range, 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 != yyempty_)
      {
        /* Make sure we have latest lookahead translation.  See comments
           at user semantic actions for why this is necessary.  */
        yytoken = yytranslate_ (yychar);
        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;
  }