1 
2 /* A Bison parser, made by GNU Bison 2.4.1.  */
3 
4 /*  Skeleton interface for Bison LALR(1) parsers in C++
5 
6     SPDX-FileCopyrightText: 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
7 
8     SPDX-License-Identifier: GPL-3.0-or-later WITH Bison-exception-2.2
9 */
10 
11 /* C++ LALR(1) parser skeleton written by Akim Demaille.  */
12 
13 #ifndef PARSER_HEADER_H
14 # define PARSER_HEADER_H
15 
16 
17 
18 #include <string>
19 #include <iostream>
20 #include "stack.hh"
21 
22 
23 /* Line 35 of lalr1.cc  */
24 #line 1 "[Bison:b4_percent_define_default]"
25 
26 namespace KHolidays {
27 
28 /* Line 35 of lalr1.cc  */
29 #line 54 "holidayparserplan.hpp"
30   class position;
31   class location;
32 
33 /* Line 35 of lalr1.cc  */
34 #line 1 "[Bison:b4_percent_define_default]"
35 
36 } // KHolidays
37 
38 /* Line 35 of lalr1.cc  */
39 #line 64 "holidayparserplan.hpp"
40 
41 #include "location.hh"
42 
43 /* Enabling traces.  */
44 #ifndef YYDEBUG
45 # define YYDEBUG 1
46 #endif
47 
48 /* Enabling verbose error messages.  */
49 #ifdef YYERROR_VERBOSE
50 # undef YYERROR_VERBOSE
51 # define YYERROR_VERBOSE 1
52 #else
53 # define YYERROR_VERBOSE 1
54 #endif
55 
56 /* Enabling the token table.  */
57 #ifndef YYTOKEN_TABLE
58 # define YYTOKEN_TABLE 0
59 #endif
60 
61 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
62    If N is 0, then set CURRENT to the empty location which ends
63    the previous symbol: RHS[0] (always defined).  */
64 
65 #ifndef YYLLOC_DEFAULT
66 # define YYLLOC_DEFAULT(Current, Rhs, N)		\
67 do {							\
68   if (N)						\
69     {							\
70       (Current).begin = (Rhs)[1].begin;			\
71       (Current).end   = (Rhs)[N].end;			\
72     }							\
73   else							\
74     {							\
75       (Current).begin = (Current).end = (Rhs)[0].end;	\
76     }							\
77 } while (false)
78 #endif
79 
80 
81 /* Line 35 of lalr1.cc  */
82 #line 1 "[Bison:b4_percent_define_default]"
83 
84 namespace KHolidays {
85 
86 /* Line 35 of lalr1.cc  */
87 #line 112 "holidayparserplan.hpp"
88 
89   /// A Bison parser.
90   class HolidayParserPlan
91   {
92   public:
93     /// Symbol semantic values.
94 #ifndef YYSTYPE
95     union semantic_type
96     {
97 
98 /* Line 35 of lalr1.cc  */
99 #line 86 "holidayparserplan.ypp"
100  int  ival; char *sval;
101 
102 
103 /* Line 35 of lalr1.cc  */
104 #line 129 "holidayparserplan.hpp"
105     };
106 #else
107     typedef YYSTYPE semantic_type;
108 #endif
109     /// Symbol locations.
110     typedef location location_type;
111     /// Tokens.
112     struct token
113     {
114       /* Tokens.  */
115    enum yytokentype {
116      END = 0,
117      NUMBER = 258,
118      MONTH = 259,
119      WDAY = 260,
120      STRING = 261,
121      CATEGORY = 262,
122      CALENDAR = 263,
123      INOP = 264,
124      PLUS = 265,
125      MINUS = 266,
126      YEAR = 267,
127      LEAPYEAR = 268,
128      SHIFT = 269,
129      IF = 270,
130      LENGTH = 271,
131      EASTER = 272,
132      EQ = 273,
133      NE = 274,
134      LE = 275,
135      GE = 276,
136      LT = 277,
137      GT = 278,
138      PASCHA = 279,
139      COUNTRY = 280,
140      LANGUAGE = 281,
141      NAME = 282,
142      DESCRIPTION = 283,
143      OR = 284,
144      AND = 285,
145      UMINUS = 286,
146    };
147 
148     };
149     /// Token type.
150     typedef token::yytokentype token_type;
151 
152     /// Build a parser object.
153     HolidayParserPlan (class HolidayParserDriverPlan& driver_yyarg);
154     virtual ~HolidayParserPlan ();
155 
156     /// Parse.
157     /// \returns  0 iff parsing succeeded.
158     virtual int parse ();
159 
160 #if YYDEBUG
161     /// The current debugging stream.
162     std::ostream& debug_stream () const;
163     /// Set the current debugging stream.
164     void set_debug_stream (std::ostream &);
165 
166     /// Type for debugging levels.
167     typedef int debug_level_type;
168     /// The current debugging level.
169     debug_level_type debug_level () const;
170     /// Set the current debugging level.
171     void set_debug_level (debug_level_type l);
172 #endif
173 
174   private:
175     /// Report a syntax error.
176     /// \param loc    where the syntax error is found.
177     /// \param msg    a description of the syntax error.
178     virtual void error (const location_type& loc, const std::string& msg);
179 
180     /// Generate an error message.
181     /// \param state   the state where the error occurred.
182     /// \param tok     the lookahead token.
183     virtual std::string yysyntax_error_ (std::string *filename, int yystate, int tok);
184 
185 #if YYDEBUG
186     /// \brief Report a symbol value on the debug stream.
187     /// \param yytype       The token type.
188     /// \param yyvaluep     Its semantic value.
189     /// \param yylocationp  Its location.
190     virtual void yy_symbol_value_print_ (int yytype,
191 					 const semantic_type* yyvaluep,
192 					 const location_type* yylocationp);
193     /// \brief Report a symbol on the debug stream.
194     /// \param yytype       The token type.
195     /// \param yyvaluep     Its semantic value.
196     /// \param yylocationp  Its location.
197     virtual void yy_symbol_print_ (int yytype,
198 				   const semantic_type* yyvaluep,
199 				   const location_type* yylocationp);
200 #endif
201 
202 
203     /// State numbers.
204     typedef int state_type;
205     /// State stack type.
206     typedef stack<state_type>    state_stack_type;
207     /// Semantic value stack type.
208     typedef stack<semantic_type> semantic_stack_type;
209     /// location stack type.
210     typedef stack<location_type> location_stack_type;
211 
212     /// The state stack.
213     state_stack_type yystate_stack_;
214     /// The semantic value stack.
215     semantic_stack_type yysemantic_stack_;
216     /// The location stack.
217     location_stack_type yylocation_stack_;
218 
219     /// Internal symbol numbers.
220     typedef unsigned char token_number_type;
221     /* Tables.  */
222     /// For a state, the index in \a yytable_ of its portion.
223     static const short int yypact_[];
224     static const signed char yypact_ninf_;
225 
226     /// For a state, default rule to reduce.
227     /// Unless\a  yytable_ specifies something else to do.
228     /// Zero means the default is an error.
229     static const unsigned char yydefact_[];
230 
231     static const signed char yypgoto_[];
232     static const signed char yydefgoto_[];
233 
234     /// What to do in a state.
235     /// \a yytable_[yypact_[s]]: what to do in state \a s.
236     /// - if positive, shift that token.
237     /// - if negative, reduce the rule which number is the opposite.
238     /// - if zero, do what YYDEFACT says.
239     static const short int yytable_[];
240     static const signed char yytable_ninf_;
241 
242     static const short int yycheck_[];
243 
244     /// For a state, its accessing symbol.
245     static const unsigned char yystos_[];
246 
247     /// For a rule, its LHS.
248     static const unsigned char yyr1_[];
249     /// For a rule, its RHS length.
250     static const unsigned char yyr2_[];
251 
252 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
253     /// For a symbol, its name in clear.
254     static const char* const yytname_[];
255 #endif
256 
257 #if YYERROR_VERBOSE
258     /// Convert the symbol name \a n to a form suitable for a diagnostic.
259     virtual std::string yytnamerr_ (const char *n);
260 #endif
261 
262 #if YYDEBUG
263     /// A type to store symbol numbers and -1.
264     typedef signed char rhs_number_type;
265     /// A `-1'-separated list of the rules' RHS.
266     static const rhs_number_type yyrhs_[];
267     /// For each rule, the index of the first RHS symbol in \a yyrhs_.
268     static const unsigned short int yyprhs_[];
269     /// For each rule, its source line number.
270     static const unsigned char yyrline_[];
271     /// For each scanner token number, its symbol number.
272     static const unsigned short int yytoken_number_[];
273     /// Report on the debug stream that the rule \a r is going to be reduced.
274     virtual void yy_reduce_print_ (int r);
275     /// Print the state stack on the debug stream.
276     virtual void yystack_print_ ();
277 
278     /* Debugging.  */
279     int yydebug_;
280     std::ostream* yycdebug_;
281 #endif
282 
283     /// Convert a scanner token number \a t to a symbol number.
284     token_number_type yytranslate_ (int t);
285 
286     /// \brief Reclaim the memory associated to a symbol.
287     /// \param yymsg        Why this token is reclaimed.
288     /// \param yytype       The symbol type.
289     /// \param yyvaluep     Its semantic value.
290     /// \param yylocationp  Its location.
291     inline void yydestruct_ (const char* yymsg,
292 			     int yytype,
293 			     semantic_type* yyvaluep,
294 			     location_type* yylocationp);
295 
296     /// Pop \a n symbols the three stacks.
297     inline void yypop_ (unsigned int n = 1);
298 
299     /* Constants.  */
300     static const int yyeof_;
301     /* LAST_ -- Last index in TABLE_.  */
302     static const int yylast_;
303     static const int yynnts_;
304     static const int yyempty_;
305     static const int yyfinal_;
306     static const int yyterror_;
307     static const int yyerrcode_;
308     static const int yyntokens_;
309     static const unsigned int yyuser_token_number_max_;
310     static const token_number_type yyundef_token_;
311 
312     /* User arguments.  */
313     class HolidayParserDriverPlan& driver;
314   };
315 
316 /* Line 35 of lalr1.cc  */
317 #line 1 "[Bison:b4_percent_define_default]"
318 
319 } // KHolidays
320 
321 /* Line 35 of lalr1.cc  */
322 #line 347 "holidayparserplan.hpp"
323 
324 
325 
326 #endif /* ! defined PARSER_HEADER_H */
327