File indexing completed on 2024-12-08 12:18:41

0001 
0002 /* A Bison parser, made by GNU Bison 2.4.1.  */
0003 
0004 /*  Skeleton interface for Bison LALR(1) parsers in C++
0005 
0006     SPDX-FileCopyrightText: 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
0007 
0008     SPDX-License-Identifier: GPL-3.0-or-later WITH Bison-exception-2.2
0009 */
0010 
0011 /* C++ LALR(1) parser skeleton written by Akim Demaille.  */
0012 
0013 #ifndef PARSER_HEADER_H
0014 # define PARSER_HEADER_H
0015 
0016 
0017 
0018 #include <string>
0019 #include <iostream>
0020 #include "stack.hh"
0021 
0022 
0023 /* Line 35 of lalr1.cc  */
0024 #line 1 "[Bison:b4_percent_define_default]"
0025 
0026 namespace KHolidays {
0027 
0028 /* Line 35 of lalr1.cc  */
0029 #line 54 "holidayparserplan.hpp"
0030   class position;
0031   class location;
0032 
0033 /* Line 35 of lalr1.cc  */
0034 #line 1 "[Bison:b4_percent_define_default]"
0035 
0036 } // KHolidays
0037 
0038 /* Line 35 of lalr1.cc  */
0039 #line 64 "holidayparserplan.hpp"
0040 
0041 #include "location.hh"
0042 
0043 /* Enabling traces.  */
0044 #ifndef YYDEBUG
0045 # define YYDEBUG 1
0046 #endif
0047 
0048 /* Enabling verbose error messages.  */
0049 #ifdef YYERROR_VERBOSE
0050 # undef YYERROR_VERBOSE
0051 # define YYERROR_VERBOSE 1
0052 #else
0053 # define YYERROR_VERBOSE 1
0054 #endif
0055 
0056 /* Enabling the token table.  */
0057 #ifndef YYTOKEN_TABLE
0058 # define YYTOKEN_TABLE 0
0059 #endif
0060 
0061 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
0062    If N is 0, then set CURRENT to the empty location which ends
0063    the previous symbol: RHS[0] (always defined).  */
0064 
0065 #ifndef YYLLOC_DEFAULT
0066 # define YYLLOC_DEFAULT(Current, Rhs, N)        \
0067 do {                            \
0068   if (N)                        \
0069     {                           \
0070       (Current).begin = (Rhs)[1].begin;         \
0071       (Current).end   = (Rhs)[N].end;           \
0072     }                           \
0073   else                          \
0074     {                           \
0075       (Current).begin = (Current).end = (Rhs)[0].end;   \
0076     }                           \
0077 } while (false)
0078 #endif
0079 
0080 
0081 /* Line 35 of lalr1.cc  */
0082 #line 1 "[Bison:b4_percent_define_default]"
0083 
0084 namespace KHolidays {
0085 
0086 /* Line 35 of lalr1.cc  */
0087 #line 112 "holidayparserplan.hpp"
0088 
0089   /// A Bison parser.
0090   class HolidayParserPlan
0091   {
0092   public:
0093     /// Symbol semantic values.
0094 #ifndef YYSTYPE
0095     union semantic_type
0096     {
0097 
0098 /* Line 35 of lalr1.cc  */
0099 #line 86 "holidayparserplan.ypp"
0100  int  ival; char *sval;
0101 
0102 
0103 /* Line 35 of lalr1.cc  */
0104 #line 129 "holidayparserplan.hpp"
0105     };
0106 #else
0107     typedef YYSTYPE semantic_type;
0108 #endif
0109     /// Symbol locations.
0110     typedef location location_type;
0111     /// Tokens.
0112     struct token
0113     {
0114       /* Tokens.  */
0115    enum yytokentype {
0116      END = 0,
0117      NUMBER = 258,
0118      MONTH = 259,
0119      WDAY = 260,
0120      STRING = 261,
0121      CATEGORY = 262,
0122      CALENDAR = 263,
0123      INOP = 264,
0124      PLUS = 265,
0125      MINUS = 266,
0126      YEAR = 267,
0127      LEAPYEAR = 268,
0128      SHIFT = 269,
0129      IF = 270,
0130      LENGTH = 271,
0131      EASTER = 272,
0132      EQ = 273,
0133      NE = 274,
0134      LE = 275,
0135      GE = 276,
0136      LT = 277,
0137      GT = 278,
0138      PASCHA = 279,
0139      COUNTRY = 280,
0140      LANGUAGE = 281,
0141      NAME = 282,
0142      DESCRIPTION = 283,
0143      OR = 284,
0144      AND = 285,
0145      UMINUS = 286,
0146    };
0147 
0148     };
0149     /// Token type.
0150     typedef token::yytokentype token_type;
0151 
0152     /// Build a parser object.
0153     HolidayParserPlan (class HolidayParserDriverPlan& driver_yyarg);
0154     virtual ~HolidayParserPlan ();
0155 
0156     /// Parse.
0157     /// \returns  0 iff parsing succeeded.
0158     virtual int parse ();
0159 
0160 #if YYDEBUG
0161     /// The current debugging stream.
0162     std::ostream& debug_stream () const;
0163     /// Set the current debugging stream.
0164     void set_debug_stream (std::ostream &);
0165 
0166     /// Type for debugging levels.
0167     typedef int debug_level_type;
0168     /// The current debugging level.
0169     debug_level_type debug_level () const;
0170     /// Set the current debugging level.
0171     void set_debug_level (debug_level_type l);
0172 #endif
0173 
0174   private:
0175     /// Report a syntax error.
0176     /// \param loc    where the syntax error is found.
0177     /// \param msg    a description of the syntax error.
0178     virtual void error (const location_type& loc, const std::string& msg);
0179 
0180     /// Generate an error message.
0181     /// \param state   the state where the error occurred.
0182     /// \param tok     the lookahead token.
0183     virtual std::string yysyntax_error_ (std::string *filename, int yystate, int tok);
0184 
0185 #if YYDEBUG
0186     /// \brief Report a symbol value on the debug stream.
0187     /// \param yytype       The token type.
0188     /// \param yyvaluep     Its semantic value.
0189     /// \param yylocationp  Its location.
0190     virtual void yy_symbol_value_print_ (int yytype,
0191                      const semantic_type* yyvaluep,
0192                      const location_type* yylocationp);
0193     /// \brief Report a symbol on the debug stream.
0194     /// \param yytype       The token type.
0195     /// \param yyvaluep     Its semantic value.
0196     /// \param yylocationp  Its location.
0197     virtual void yy_symbol_print_ (int yytype,
0198                    const semantic_type* yyvaluep,
0199                    const location_type* yylocationp);
0200 #endif
0201 
0202 
0203     /// State numbers.
0204     typedef int state_type;
0205     /// State stack type.
0206     typedef stack<state_type>    state_stack_type;
0207     /// Semantic value stack type.
0208     typedef stack<semantic_type> semantic_stack_type;
0209     /// location stack type.
0210     typedef stack<location_type> location_stack_type;
0211 
0212     /// The state stack.
0213     state_stack_type yystate_stack_;
0214     /// The semantic value stack.
0215     semantic_stack_type yysemantic_stack_;
0216     /// The location stack.
0217     location_stack_type yylocation_stack_;
0218 
0219     /// Internal symbol numbers.
0220     typedef unsigned char token_number_type;
0221     /* Tables.  */
0222     /// For a state, the index in \a yytable_ of its portion.
0223     static const short int yypact_[];
0224     static const signed char yypact_ninf_;
0225 
0226     /// For a state, default rule to reduce.
0227     /// Unless\a  yytable_ specifies something else to do.
0228     /// Zero means the default is an error.
0229     static const unsigned char yydefact_[];
0230 
0231     static const signed char yypgoto_[];
0232     static const signed char yydefgoto_[];
0233 
0234     /// What to do in a state.
0235     /// \a yytable_[yypact_[s]]: what to do in state \a s.
0236     /// - if positive, shift that token.
0237     /// - if negative, reduce the rule which number is the opposite.
0238     /// - if zero, do what YYDEFACT says.
0239     static const short int yytable_[];
0240     static const signed char yytable_ninf_;
0241 
0242     static const short int yycheck_[];
0243 
0244     /// For a state, its accessing symbol.
0245     static const unsigned char yystos_[];
0246 
0247     /// For a rule, its LHS.
0248     static const unsigned char yyr1_[];
0249     /// For a rule, its RHS length.
0250     static const unsigned char yyr2_[];
0251 
0252 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
0253     /// For a symbol, its name in clear.
0254     static const char* const yytname_[];
0255 #endif
0256 
0257 #if YYERROR_VERBOSE
0258     /// Convert the symbol name \a n to a form suitable for a diagnostic.
0259     virtual std::string yytnamerr_ (const char *n);
0260 #endif
0261 
0262 #if YYDEBUG
0263     /// A type to store symbol numbers and -1.
0264     typedef signed char rhs_number_type;
0265     /// A `-1'-separated list of the rules' RHS.
0266     static const rhs_number_type yyrhs_[];
0267     /// For each rule, the index of the first RHS symbol in \a yyrhs_.
0268     static const unsigned short int yyprhs_[];
0269     /// For each rule, its source line number.
0270     static const unsigned char yyrline_[];
0271     /// For each scanner token number, its symbol number.
0272     static const unsigned short int yytoken_number_[];
0273     /// Report on the debug stream that the rule \a r is going to be reduced.
0274     virtual void yy_reduce_print_ (int r);
0275     /// Print the state stack on the debug stream.
0276     virtual void yystack_print_ ();
0277 
0278     /* Debugging.  */
0279     int yydebug_;
0280     std::ostream* yycdebug_;
0281 #endif
0282 
0283     /// Convert a scanner token number \a t to a symbol number.
0284     token_number_type yytranslate_ (int t);
0285 
0286     /// \brief Reclaim the memory associated to a symbol.
0287     /// \param yymsg        Why this token is reclaimed.
0288     /// \param yytype       The symbol type.
0289     /// \param yyvaluep     Its semantic value.
0290     /// \param yylocationp  Its location.
0291     inline void yydestruct_ (const char* yymsg,
0292                  int yytype,
0293                  semantic_type* yyvaluep,
0294                  location_type* yylocationp);
0295 
0296     /// Pop \a n symbols the three stacks.
0297     inline void yypop_ (unsigned int n = 1);
0298 
0299     /* Constants.  */
0300     static const int yyeof_;
0301     /* LAST_ -- Last index in TABLE_.  */
0302     static const int yylast_;
0303     static const int yynnts_;
0304     static const int yyempty_;
0305     static const int yyfinal_;
0306     static const int yyterror_;
0307     static const int yyerrcode_;
0308     static const int yyntokens_;
0309     static const unsigned int yyuser_token_number_max_;
0310     static const token_number_type yyundef_token_;
0311 
0312     /* User arguments.  */
0313     class HolidayParserDriverPlan& driver;
0314   };
0315 
0316 /* Line 35 of lalr1.cc  */
0317 #line 1 "[Bison:b4_percent_define_default]"
0318 
0319 } // KHolidays
0320 
0321 /* Line 35 of lalr1.cc  */
0322 #line 347 "holidayparserplan.hpp"
0323 
0324 
0325 
0326 #endif /* ! defined PARSER_HEADER_H */