Wolfgang Thallergcc16 merge934c3885 months agoHistory
1505 lines · 45.2 KB · C++
RawDownload
// A Bison parser, made by GNU Bison 3.8.2. // Skeleton implementation for Bison LALR(1) parsers in C++ // Copyright (C) 2002-2015, 2018-2021 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. // 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. // DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,// especially those whose name start with YY_ or yy_.  They are// private implementation details that can be changed or removed. // "%code top" blocks.#line 28 "QLParser.yy" #include "config.h"#include <stdio.h>#include <string.h>#include <string> #line 46 "QLParser.tab.cc"    #include "QLParser.tab.hh"  // Unqualified %code blocks.#line 44 "QLParser.yy" namespace QL{  static QL::Parser::symbol_type yylex (QL::Result &result);   static Expression *  processName (std::string str)  {    const char *name = str.c_str();    int propID = dbeSession->getPropIdByName (name);    if (propID != PROP_NONE)      return new Expression (Expression::OP_NAME,		      new Expression (Expression::OP_NUM, (uint64_t) propID));     // If a name is not statically known try user defined objects    Expression *expr = dbeSession->findObjDefByName (name);    if (expr != NULL)      return expr->copy();     throw Parser::syntax_error ("Name not found");  }} #line 79 "QLParser.tab.cc"  #ifndef YY_# if defined YYENABLE_NLS && YYENABLE_NLS#  if ENABLE_NLS#   include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.#   define YY_(msgid) dgettext ("bison-runtime", msgid)#  endif# endif# ifndef YY_#  define YY_(msgid) msgid# endif#endif  // Whether we are compiled with exception support.#ifndef YY_EXCEPTIONS# if defined __GNUC__ && !defined __EXCEPTIONS#  define YY_EXCEPTIONS 0# else#  define YY_EXCEPTIONS 1# endif#endif   // Enable debugging if requested.#if YYDEBUG // A pseudo ostream that takes yydebug_ into account.# define YYCDEBUG if (yydebug_) (*yycdebug_) # define YY_SYMBOL_PRINT(Title, Symbol)         \  do {                                          \    if (yydebug_)                               \    {                                           \      *yycdebug_ << Title << ' ';               \      yy_print_ (*yycdebug_, Symbol);           \      *yycdebug_ << '\n';                       \    }                                           \  } while (false) # define YY_REDUCE_PRINT(Rule)          \  do {                                  \    if (yydebug_)                       \      yy_reduce_print_ (Rule);          \  } while (false) # define YY_STACK_PRINT()               \  do {                                  \    if (yydebug_)                       \      yy_stack_print_ ();                \  } while (false) #else // !YYDEBUG # define YYCDEBUG if (false) std::cerr# define YY_SYMBOL_PRINT(Title, Symbol)  YY_USE (Symbol)# define YY_REDUCE_PRINT(Rule)           static_cast<void> (0)# define YY_STACK_PRINT()                static_cast<void> (0) #endif // !YYDEBUG #define yyerrok         (yyerrstatus_ = 0)#define yyclearin       (yyla.clear ()) #define YYACCEPT        goto yyacceptlab#define YYABORT         goto yyabortlab#define YYERROR         goto yyerrorlab#define YYRECOVERING()  (!!yyerrstatus_) #line 69 "QLParser.yy"namespace QL {#line 153 "QLParser.tab.cc"   /// Build a parser object.  Parser::Parser (QL::Result &result_yyarg)#if YYDEBUG    : yydebug_ (false),      yycdebug_ (&std::cerr),#else    :#endif      result (result_yyarg)  {}   Parser::~Parser ()  {}   Parser::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW  {}   /*---------.  | symbol.  |  `---------*/     // by_state.  Parser::by_state::by_state () YY_NOEXCEPT    : state (empty_state)  {}   Parser::by_state::by_state (const by_state& that) YY_NOEXCEPT    : state (that.state)  {}   void  Parser::by_state::clear () YY_NOEXCEPT  {    state = empty_state;  }   void  Parser::by_state::move (by_state& that)  {    state = that.state;    that.clear ();  }   Parser::by_state::by_state (state_type s) YY_NOEXCEPT    : state (s)  {}   Parser::symbol_kind_type  Parser::by_state::kind () const YY_NOEXCEPT  {    if (state == empty_state)      return symbol_kind::S_YYEMPTY;    else      return YY_CAST (symbol_kind_type, yystos_[+state]);  }   Parser::stack_symbol_type::stack_symbol_type ()  {}   Parser::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)    : super_type (YY_MOVE (that.state))  {    switch (that.kind ())    {      case symbol_kind::S_exp: // exp      case symbol_kind::S_term: // term        value.YY_MOVE_OR_COPY< Expression * > (YY_MOVE (that.value));        break;       case symbol_kind::S_NAME: // NAME        value.YY_MOVE_OR_COPY< std::string > (YY_MOVE (that.value));        break;       case symbol_kind::S_NUM: // NUM      case symbol_kind::S_FNAME: // FNAME      case symbol_kind::S_JGROUP: // JGROUP      case symbol_kind::S_JPARENT: // JPARENT      case symbol_kind::S_QSTR: // QSTR        value.YY_MOVE_OR_COPY< uint64_t > (YY_MOVE (that.value));        break;       default:        break;    } #if 201103L <= YY_CPLUSPLUS    // that is emptied.    that.state = empty_state;#endif  }   Parser::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)    : super_type (s)  {    switch (that.kind ())    {      case symbol_kind::S_exp: // exp      case symbol_kind::S_term: // term        value.move< Expression * > (YY_MOVE (that.value));        break;       case symbol_kind::S_NAME: // NAME        value.move< std::string > (YY_MOVE (that.value));        break;       case symbol_kind::S_NUM: // NUM      case symbol_kind::S_FNAME: // FNAME      case symbol_kind::S_JGROUP: // JGROUP      case symbol_kind::S_JPARENT: // JPARENT      case symbol_kind::S_QSTR: // QSTR        value.move< uint64_t > (YY_MOVE (that.value));        break;       default:        break;    }     // that is emptied.    that.kind_ = symbol_kind::S_YYEMPTY;  } #if YY_CPLUSPLUS < 201103L  Parser::stack_symbol_type&  Parser::stack_symbol_type::operator= (const stack_symbol_type& that)  {    state = that.state;    switch (that.kind ())    {      case symbol_kind::S_exp: // exp      case symbol_kind::S_term: // term        value.copy< Expression * > (that.value);        break;       case symbol_kind::S_NAME: // NAME        value.copy< std::string > (that.value);        break;       case symbol_kind::S_NUM: // NUM      case symbol_kind::S_FNAME: // FNAME      case symbol_kind::S_JGROUP: // JGROUP      case symbol_kind::S_JPARENT: // JPARENT      case symbol_kind::S_QSTR: // QSTR        value.copy< uint64_t > (that.value);        break;       default:        break;    }     return *this;  }   Parser::stack_symbol_type&  Parser::stack_symbol_type::operator= (stack_symbol_type& that)  {    state = that.state;    switch (that.kind ())    {      case symbol_kind::S_exp: // exp      case symbol_kind::S_term: // term        value.move< Expression * > (that.value);        break;       case symbol_kind::S_NAME: // NAME        value.move< std::string > (that.value);        break;       case symbol_kind::S_NUM: // NUM      case symbol_kind::S_FNAME: // FNAME      case symbol_kind::S_JGROUP: // JGROUP      case symbol_kind::S_JPARENT: // JPARENT      case symbol_kind::S_QSTR: // QSTR        value.move< uint64_t > (that.value);        break;       default:        break;    }     // that is emptied.    that.state = empty_state;    return *this;  }#endif   template <typename Base>  void  Parser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const  {    if (yymsg)      YY_SYMBOL_PRINT (yymsg, yysym);  } #if YYDEBUG  template <typename Base>  void  Parser::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const  {    std::ostream& yyoutput = yyo;    YY_USE (yyoutput);    if (yysym.empty ())      yyo << "empty symbol";    else      {        symbol_kind_type yykind = yysym.kind ();        yyo << (yykind < YYNTOKENS ? "token" : "nterm")            << ' ' << yysym.name () << " (";        YY_USE (yykind);        yyo << ')';      }  }#endif   void  Parser::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)  {    if (m)      YY_SYMBOL_PRINT (m, sym);    yystack_.push (YY_MOVE (sym));  }   void  Parser::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)  {#if 201103L <= YY_CPLUSPLUS    yypush_ (m, stack_symbol_type (s, std::move (sym)));#else    stack_symbol_type ss (s, sym);    yypush_ (m, ss);#endif  }   void  Parser::yypop_ (int n) YY_NOEXCEPT  {    yystack_.pop (n);  } #if YYDEBUG  std::ostream&  Parser::debug_stream () const  {    return *yycdebug_;  }   void  Parser::set_debug_stream (std::ostream& o)  {    yycdebug_ = &o;  }    Parser::debug_level_type  Parser::debug_level () const  {    return yydebug_;  }   void  Parser::set_debug_level (debug_level_type l)  {    yydebug_ = l;  }#endif // YYDEBUG   Parser::state_type  Parser::yy_lr_goto_state_ (state_type yystate, int yysym)  {    int yyr = yypgoto_[yysym - YYNTOKENS] + yystate;    if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)      return yytable_[yyr];    else      return yydefgoto_[yysym - YYNTOKENS];  }   bool  Parser::yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT  {    return yyvalue == yypact_ninf_;  }   bool  Parser::yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT  {    return yyvalue == yytable_ninf_;  }   int  Parser::operator() ()  {    return parse ();  }   int  Parser::parse ()  {    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 return value of parse ().    int yyresult; #if YY_EXCEPTIONS    try#endif // YY_EXCEPTIONS      {    YYCDEBUG << "Starting parse\n";      /* 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, YY_MOVE (yyla));   /*-----------------------------------------------.  | yynewstate -- push a new symbol on the stack.  |  `-----------------------------------------------*/  yynewstate:    YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';    YY_STACK_PRINT ();     // Accept?    if (yystack_[0].state == yyfinal_)      YYACCEPT;     goto yybackup;    /*-----------.  | yybackup.  |  `-----------*/  yybackup:    // Try to take a decision without lookahead.    yyn = yypact_[+yystack_[0].state];    if (yy_pact_value_is_default_ (yyn))

Lines 1–500 of 1505.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t