📄 fcl-parser.cc
字号:
/* A Bison parser, made by GNU Bison 2.3. *//* Skeleton implementation for Bison LALR(1) parsers in C++ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *//* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */#include "fcl-parser.hh"/* User implementation prologue. */#line 7502 "../../doc/bison.texinfo"#include "fcl-driver.hh"/* Line 317 of lalr1.cc. */#line 46 "fcl-parser.cc"#ifndef YY_# if YYENABLE_NLS# if ENABLE_NLS# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */# define YY_(msgid) dgettext ("bison-runtime", msgid)# endif# endif# ifndef YY_# define YY_(msgid) msgid# endif#endif/* Suppress unused-variable warnings by "using" E. */#define YYUSE(e) ((void) (e))/* A pseudo ostream that takes yydebug_ into account. */# define YYCDEBUG \ for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \ (*yycdebug_)/* Enable debugging if requested. */#if YYDEBUG# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \do { \ if (yydebug_) \ { \ *yycdebug_ << Title << ' '; \ yy_symbol_print_ ((Type), (Value), (Location)); \ *yycdebug_ << std::endl; \ } \} while (false)# define YY_REDUCE_PRINT(Rule) \do { \ if (yydebug_) \ yy_reduce_print_ (Rule); \} while (false)# define YY_STACK_PRINT() \do { \ if (yydebug_) \ yystack_print_ (); \} while (false)#else /* !YYDEBUG */# define YY_SYMBOL_PRINT(Title, Type, Value, Location)# define YY_REDUCE_PRINT(Rule)# define YY_STACK_PRINT()#endif /* !YYDEBUG */#define YYACCEPT goto yyacceptlab#define YYABORT goto yyabortlab#define YYERROR goto yyerrorlabnamespace yy{#if YYERROR_VERBOSE /* Return YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. */ std::string fcl_parser::yytnamerr_ (const char *yystr) { if (*yystr == '"') { std::string yyr = ""; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: yyr += *yyp; break; case '"': return yyr; } do_not_strip_quotes: ; } return yystr; }#endif /// Build a parser object. fcl_parser::fcl_parser (fcl_driver& driver_yyarg) : yydebug_ (false), yycdebug_ (&std::cerr), driver (driver_yyarg) { } fcl_parser::~fcl_parser () { }#if YYDEBUG /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ inline void fcl_parser::yy_symbol_value_print_ (int yytype, const semantic_type* yyvaluep, const location_type* yylocationp) { YYUSE (yylocationp); YYUSE (yyvaluep); switch (yytype) { case 46: /* "\"identifier\"" */#line 7531 "../../doc/bison.texinfo" { debug_stream () << *(yyvaluep->sval); };#line 176 "fcl-parser.cc" break; default: break; } } void fcl_parser::yy_symbol_print_ (int yytype, const semantic_type* yyvaluep, const location_type* yylocationp) { *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") << ' ' << yytname_[yytype] << " (" << *yylocationp << ": "; yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); *yycdebug_ << ')'; }#endif /* ! YYDEBUG */ void fcl_parser::yydestruct_ (const char* yymsg, int yytype, semantic_type* yyvaluep, location_type* yylocationp) { YYUSE (yylocationp); YYUSE (yymsg); YYUSE (yyvaluep); YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { case 46: /* "\"identifier\"" */#line 7532 "../../doc/bison.texinfo" { delete (yyvaluep->sval); };#line 211 "fcl-parser.cc" break; default: break; } } void fcl_parser::yypop_ (unsigned int n) { yystate_stack_.pop (n); yysemantic_stack_.pop (n); yylocation_stack_.pop (n); } std::ostream& fcl_parser::debug_stream () const { return *yycdebug_; } void fcl_parser::set_debug_stream (std::ostream& o) { yycdebug_ = &o; } fcl_parser::debug_level_type fcl_parser::debug_level () const { return yydebug_; } void fcl_parser::set_debug_level (debug_level_type l) { yydebug_ = l; } int fcl_parser::parse () { /// Look-ahead and look-ahead in internal form. int yychar = yyempty_; int yytoken = 0; /* State. */ int yyn; int yylen = 0; int yystate = 0; /* Error handling. */ int yynerrs_ = 0; int yyerrstatus_ = 0; /// Semantic value of the look-ahead. semantic_type yylval; /// Location of the look-ahead. location_type yylloc; /// The locations where the error started and ended. location yyerror_range[2]; /// $$. semantic_type yyval; /// @$. location_type yyloc; int yyresult; YYCDEBUG << "Starting parse" << std::endl; /* User initialization code. */ #line 7465 "../../doc/bison.texinfo"{ // Initialize the initial location. yylloc.begin.filename = yylloc.end.filename = &driver.file;} /* Line 547 of yacc.c. */#line 293 "fcl-parser.cc" /* Initialize the stacks. The initial state will be pushed in yynewstate, since the latter expects the semantical and the location values to have been already stored, initialize these stacks with a primary value. */ yystate_stack_ = state_stack_type (0); yysemantic_stack_ = semantic_stack_type (0); yylocation_stack_ = location_stack_type (0); yysemantic_stack_.push (yylval); yylocation_stack_.push (yylloc); /* New state. */ yynewstate: yystate_stack_.push (yystate); YYCDEBUG << "Entering state " << yystate << std::endl; goto yybackup; /* Backup. */ yybackup: /* Try to take a decision without look-ahead. */ yyn = yypact_[yystate]; if (yyn == yypact_ninf_) goto yydefault; /* Read a look-ahead token. */ if (yychar == yyempty_) { YYCDEBUG << "Reading a token: "; yychar = yylex (&yylval, &yylloc, driver); } /* Convert token to internal form. */ if (yychar <= yyeof_) { yychar = yytoken = yyeof_; YYCDEBUG << "Now at end of input." << std::endl; } else {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -