holidayparserplan.hpp
00001 /* A Bison parser, made by GNU Bison 2.3. */ 00002 00003 /* Skeleton interface for Bison LALR(1) parsers in C++ 00004 00005 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2, or (at your option) 00010 any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. */ 00021 00022 /* As a special exception, you may create a larger work that contains 00023 part or all of the Bison parser skeleton and distribute that work 00024 under terms of your choice, so long as that work isn't itself a 00025 parser generator using the skeleton or a modified version thereof 00026 as a parser skeleton. Alternatively, if you modify or redistribute 00027 the parser skeleton itself, you may (at your option) remove this 00028 special exception, which will cause the skeleton and the resulting 00029 Bison output files to be licensed under the GNU General Public 00030 License without this special exception. 00031 00032 This special exception was added by the Free Software Foundation in 00033 version 2.2 of Bison. */ 00034 00035 /* C++ LALR(1) parser skeleton written by Akim Demaille. */ 00036 00037 #ifndef PARSER_HEADER_H 00038 # define PARSER_HEADER_H 00039 00040 #include <string> 00041 #include <iostream> 00042 #include "stack.hh" 00043 00044 namespace KHolidays 00045 { 00046 class position; 00047 class location; 00048 } 00049 00050 /* First part of user declarations. */ 00051 #line 30 "holidayparserplan.ypp" 00052 /*** C/C++ Declarations ***/ 00053 00054 #include <stdio.h> 00055 #include <stdlib.h> 00056 #include <pwd.h> 00057 #include <sys/types.h> 00058 #include <sys/stat.h> 00059 #include <limits.h> 00060 #include <string> 00061 00062 #include <QString> 00063 00064 #include <KCalendarSystem> 00065 00066 00067 00068 /* Line 35 of lalr1.cc. */ 00069 #line 70 "holidayparserplan.hpp" 00070 00071 #include "location.hh" 00072 00073 /* Enabling traces. */ 00074 #ifndef YYDEBUG 00075 # define YYDEBUG 1 00076 #endif 00077 00078 /* Enabling verbose error messages. */ 00079 #ifdef YYERROR_VERBOSE 00080 # undef YYERROR_VERBOSE 00081 # define YYERROR_VERBOSE 1 00082 #else 00083 # define YYERROR_VERBOSE 1 00084 #endif 00085 00086 /* Enabling the token table. */ 00087 #ifndef YYTOKEN_TABLE 00088 # define YYTOKEN_TABLE 0 00089 #endif 00090 00091 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00092 If N is 0, then set CURRENT to the empty location which ends 00093 the previous symbol: RHS[0] (always defined). */ 00094 00095 #ifndef YYLLOC_DEFAULT 00096 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00097 do { \ 00098 if (N) \ 00099 { \ 00100 (Current).begin = (Rhs)[1].begin; \ 00101 (Current).end = (Rhs)[N].end; \ 00102 } \ 00103 else \ 00104 { \ 00105 (Current).begin = (Current).end = (Rhs)[0].end; \ 00106 } \ 00107 } while (false) 00108 #endif 00109 00110 namespace KHolidays 00111 { 00112 00114 class HolidayParserPlan 00115 { 00116 public: 00118 #ifndef YYSTYPE 00119 union semantic_type 00120 #line 86 "holidayparserplan.ypp" 00121 { int ival; char *sval; } 00122 /* Line 35 of lalr1.cc. */ 00123 #line 124 "holidayparserplan.hpp" 00124 ; 00125 #else 00126 typedef YYSTYPE semantic_type; 00127 #endif 00128 00129 typedef location location_type; 00131 struct token 00132 { 00133 /* Tokens. */ 00134 enum yytokentype { 00135 END = 0, 00136 NUMBER = 258, 00137 MONTH = 259, 00138 WDAY = 260, 00139 COLOR = 261, 00140 STRING = 262, 00141 CALENDAR = 263, 00142 INOP = 264, 00143 PLUS = 265, 00144 MINUS = 266, 00145 SMALL = 267, 00146 YEAR = 268, 00147 LEAPYEAR = 269, 00148 SHIFT = 270, 00149 IF = 271, 00150 LENGTH = 272, 00151 EASTER = 273, 00152 EQ = 274, 00153 NE = 275, 00154 LE = 276, 00155 GE = 277, 00156 LT = 278, 00157 GT = 279, 00158 PASCHA = 280, 00159 COUNTRY = 281, 00160 LANGUAGE = 282, 00161 NAME = 283, 00162 DESCRIPTION = 284, 00163 OR = 285, 00164 AND = 286, 00165 UMINUS = 287 00166 }; 00167 00168 }; 00170 typedef token::yytokentype token_type; 00171 00173 HolidayParserPlan (class HolidayParserDriverPlan& driver_yyarg); 00174 virtual ~HolidayParserPlan (); 00175 00178 virtual int parse (); 00179 00181 std::ostream& debug_stream () const; 00183 void set_debug_stream (std::ostream &); 00184 00186 typedef int debug_level_type; 00188 debug_level_type debug_level () const; 00190 void set_debug_level (debug_level_type l); 00191 00192 private: 00196 virtual void error (const location_type& loc, const std::string& msg); 00197 00201 virtual std::string yysyntax_error_ (int yystate, int tok); 00202 00203 #if YYDEBUG 00204 00205 00206 00207 00208 virtual void yy_symbol_value_print_ (int yytype, 00209 const semantic_type* yyvaluep, 00210 const location_type* yylocationp); 00215 virtual void yy_symbol_print_ (int yytype, 00216 const semantic_type* yyvaluep, 00217 const location_type* yylocationp); 00218 #endif /* ! YYDEBUG */ 00219 00220 00222 typedef int state_type; 00224 typedef stack<state_type> state_stack_type; 00226 typedef stack<semantic_type> semantic_stack_type; 00228 typedef stack<location_type> location_stack_type; 00229 00231 state_stack_type yystate_stack_; 00233 semantic_stack_type yysemantic_stack_; 00235 location_stack_type yylocation_stack_; 00236 00238 typedef unsigned char token_number_type; 00239 /* Tables. */ 00241 static const short int yypact_[]; 00242 static const short int yypact_ninf_; 00243 00247 static const unsigned char yydefact_[]; 00248 00249 static const short int yypgoto_[]; 00250 static const signed char yydefgoto_[]; 00251 00257 static const short int yytable_[]; 00258 static const signed char yytable_ninf_; 00259 00260 static const short int yycheck_[]; 00261 00263 static const unsigned char yystos_[]; 00264 00266 static const unsigned char yyr1_[]; 00268 static const unsigned char yyr2_[]; 00269 00270 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00271 00272 static const char* const yytname_[]; 00273 #endif 00274 00275 #if YYERROR_VERBOSE 00276 00277 virtual std::string yytnamerr_ (const char *n); 00278 #endif 00279 00280 #if YYDEBUG 00281 00282 typedef signed char rhs_number_type; 00284 static const rhs_number_type yyrhs_[]; 00286 static const unsigned short int yyprhs_[]; 00288 static const unsigned char yyrline_[]; 00290 static const unsigned short int yytoken_number_[]; 00292 virtual void yy_reduce_print_ (int r); 00294 virtual void yystack_print_ (); 00295 #endif 00296 00298 token_number_type yytranslate_ (int t); 00299 00305 inline void yydestruct_ (const char* yymsg, 00306 int yytype, 00307 semantic_type* yyvaluep, 00308 location_type* yylocationp); 00309 00311 inline void yypop_ (unsigned int n = 1); 00312 00313 /* Constants. */ 00314 static const int yyeof_; 00315 /* LAST_ -- Last index in TABLE_. */ 00316 static const int yylast_; 00317 static const int yynnts_; 00318 static const int yyempty_; 00319 static const int yyfinal_; 00320 static const int yyterror_; 00321 static const int yyerrcode_; 00322 static const int yyntokens_; 00323 static const unsigned int yyuser_token_number_max_; 00324 static const token_number_type yyundef_token_; 00325 00326 /* Debugging. */ 00327 int yydebug_; 00328 std::ostream* yycdebug_; 00329 00330 00331 /* User arguments. */ 00332 class HolidayParserDriverPlan& driver; 00333 }; 00334 } 00335 00336 00337 #endif /* ! defined PARSER_HEADER_H */