00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
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
00051 #line 30 "holidayparserplan.ypp"
00052
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
00069 #line 70 "holidayparserplan.hpp"
00070
00071 #include "location.hh"
00072
00073
00074 #ifndef YYDEBUG
00075 # define YYDEBUG 1
00076 #endif
00077
00078
00079 #ifdef YYERROR_VERBOSE
00080 # undef YYERROR_VERBOSE
00081 # define YYERROR_VERBOSE 1
00082 #else
00083 # define YYERROR_VERBOSE 1
00084 #endif
00085
00086
00087 #ifndef YYTOKEN_TABLE
00088 # define YYTOKEN_TABLE 0
00089 #endif
00090
00091
00092
00093
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
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
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
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
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
00314 static const int yyeof_;
00315
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
00327 int yydebug_;
00328 std::ostream* yycdebug_;
00329
00330
00331
00332 class HolidayParserDriverPlan& driver;
00333 };
00334 }
00335
00336
00337 #endif