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 example
00045 {
00046 class position;
00047 class location;
00048 }
00049
00050
00051 #line 4 "parser.yy"
00052
00053
00054 #include <stdio.h>
00055 #include <string>
00056 #include <vector>
00057
00058 #include "expression.h"
00059
00060
00061
00062
00063 #line 64 "parser.h"
00064
00065 #include "location.hh"
00066
00067
00068 #ifndef YYDEBUG
00069 # define YYDEBUG 1
00070 #endif
00071
00072
00073 #ifdef YYERROR_VERBOSE
00074 # undef YYERROR_VERBOSE
00075 # define YYERROR_VERBOSE 1
00076 #else
00077 # define YYERROR_VERBOSE 1
00078 #endif
00079
00080
00081 #ifndef YYTOKEN_TABLE
00082 # define YYTOKEN_TABLE 0
00083 #endif
00084
00085
00086
00087
00088
00089 #ifndef YYLLOC_DEFAULT
00090 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00091 do { \
00092 if (N) \
00093 { \
00094 (Current).begin = (Rhs)[1].begin; \
00095 (Current).end = (Rhs)[N].end; \
00096 } \
00097 else \
00098 { \
00099 (Current).begin = (Current).end = (Rhs)[0].end; \
00100 } \
00101 } while (false)
00102 #endif
00103
00104 namespace example
00105 {
00106
00108 class Parser
00109 {
00110 public:
00112 #ifndef YYSTYPE
00113 union semantic_type
00114 #line 56 "parser.yy"
00115 {
00116 int integerVal;
00117 double doubleVal;
00118 std::string* stringVal;
00119 CalcNode* calcnode;
00120 }
00121
00122 #line 123 "parser.h"
00123 ;
00124 #else
00125 typedef YYSTYPE semantic_type;
00126 #endif
00128 typedef location location_type;
00130 struct token
00131 {
00132
00133 enum yytokentype {
00134 END = 0,
00135 EOL = 258,
00136 INTEGER = 259,
00137 DOUBLE = 260,
00138 STRING = 261
00139 };
00140
00141 };
00143 typedef token::yytokentype token_type;
00144
00146 Parser (class Driver& driver_yyarg);
00147 virtual ~Parser ();
00148
00151 virtual int parse ();
00152
00154 std::ostream& debug_stream () const;
00156 void set_debug_stream (std::ostream &);
00157
00159 typedef int debug_level_type;
00161 debug_level_type debug_level () const;
00163 void set_debug_level (debug_level_type l);
00164
00165 private:
00169 virtual void error (const location_type& loc, const std::string& msg);
00170
00174 virtual std::string yysyntax_error_ (int yystate, int tok);
00175
00176 #if YYDEBUG
00181 virtual void yy_symbol_value_print_ (int yytype,
00182 const semantic_type* yyvaluep,
00183 const location_type* yylocationp);
00188 virtual void yy_symbol_print_ (int yytype,
00189 const semantic_type* yyvaluep,
00190 const location_type* yylocationp);
00191 #endif
00192
00193
00195 typedef int state_type;
00197 typedef stack<state_type> state_stack_type;
00199 typedef stack<semantic_type> semantic_stack_type;
00201 typedef stack<location_type> location_stack_type;
00202
00204 state_stack_type yystate_stack_;
00206 semantic_stack_type yysemantic_stack_;
00208 location_stack_type yylocation_stack_;
00209
00211 typedef unsigned char token_number_type;
00212
00214 static const signed char yypact_[];
00215 static const signed char yypact_ninf_;
00216
00220 static const unsigned char yydefact_[];
00221
00222 static const signed char yypgoto_[];
00223 static const signed char yydefgoto_[];
00224
00230 static const unsigned char yytable_[];
00231 static const signed char yytable_ninf_;
00232
00233 static const signed char yycheck_[];
00234
00236 static const unsigned char yystos_[];
00237
00239 static const unsigned char yyr1_[];
00241 static const unsigned char yyr2_[];
00242
00243 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00245 static const char* const yytname_[];
00246 #endif
00247
00248 #if YYERROR_VERBOSE
00250 virtual std::string yytnamerr_ (const char *n);
00251 #endif
00252
00253 #if YYDEBUG
00255 typedef signed char rhs_number_type;
00257 static const rhs_number_type yyrhs_[];
00259 static const unsigned char yyprhs_[];
00261 static const unsigned char yyrline_[];
00263 static const unsigned short int yytoken_number_[];
00265 virtual void yy_reduce_print_ (int r);
00267 virtual void yystack_print_ ();
00268 #endif
00269
00271 token_number_type yytranslate_ (int t);
00272
00278 inline void yydestruct_ (const char* yymsg,
00279 int yytype,
00280 semantic_type* yyvaluep,
00281 location_type* yylocationp);
00282
00284 inline void yypop_ (unsigned int n = 1);
00285
00286
00287 static const int yyeof_;
00288
00289 static const int yylast_;
00290 static const int yynnts_;
00291 static const int yyempty_;
00292 static const int yyfinal_;
00293 static const int yyterror_;
00294 static const int yyerrcode_;
00295 static const int yyntokens_;
00296 static const unsigned int yyuser_token_number_max_;
00297 static const token_number_type yyundef_token_;
00298
00299
00300 int yydebug_;
00301 std::ostream* yycdebug_;
00302
00303
00304
00305 class Driver& driver;
00306 };
00307 }
00308
00309
00310 #endif