OLD | NEW |
(Empty) | |
| 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 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software |
| 7 Foundation, Inc. |
| 8 |
| 9 This program is free software: you can redistribute it and/or modify |
| 10 it under the terms of the GNU General Public License as published by |
| 11 the Free Software Foundation, either version 3 of the License, or |
| 12 (at your option) any later version. |
| 13 |
| 14 This program is distributed in the hope that it will be useful, |
| 15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 GNU General Public License for more details. |
| 18 |
| 19 You should have received a copy of the GNU General Public License |
| 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 21 |
| 22 /* As a special exception, you may create a larger work that contains |
| 23 part or all of the Bison parser skeleton and distribute that work |
| 24 under terms of your choice, so long as that work isn't itself a |
| 25 parser generator using the skeleton or a modified version thereof |
| 26 as a parser skeleton. Alternatively, if you modify or redistribute |
| 27 the parser skeleton itself, you may (at your option) remove this |
| 28 special exception, which will cause the skeleton and the resulting |
| 29 Bison output files to be licensed under the GNU General Public |
| 30 License without this special exception. |
| 31 |
| 32 This special exception was added by the Free Software Foundation in |
| 33 version 2.2 of Bison. */ |
| 34 |
| 35 /* C++ LALR(1) parser skeleton written by Akim Demaille. */ |
| 36 |
| 37 #ifndef PARSER_HEADER_H |
| 38 # define PARSER_HEADER_H |
| 39 |
| 40 /* "%code requires" blocks. */ |
| 41 |
| 42 /* Line 300 of lalr1.cc */ |
| 43 #line 8438 "../../doc/bison.texinfo" |
| 44 |
| 45 # include <string> |
| 46 class calcxx_driver; |
| 47 |
| 48 |
| 49 |
| 50 /* Line 300 of lalr1.cc */ |
| 51 #line 52 "./calc++-parser.hh" |
| 52 |
| 53 |
| 54 #include <string> |
| 55 #include <iostream> |
| 56 #include "stack.hh" |
| 57 |
| 58 |
| 59 /* Line 300 of lalr1.cc */ |
| 60 #line 1 "[Bison:b4_percent_define_default]" |
| 61 |
| 62 namespace yy { |
| 63 |
| 64 /* Line 300 of lalr1.cc */ |
| 65 #line 66 "./calc++-parser.hh" |
| 66 class position; |
| 67 class location; |
| 68 |
| 69 /* Line 300 of lalr1.cc */ |
| 70 #line 1 "[Bison:b4_percent_define_default]" |
| 71 |
| 72 } // yy |
| 73 |
| 74 /* Line 300 of lalr1.cc */ |
| 75 #line 76 "./calc++-parser.hh" |
| 76 |
| 77 #include "location.hh" |
| 78 |
| 79 /* Enabling traces. */ |
| 80 #ifndef YYDEBUG |
| 81 # define YYDEBUG 1 |
| 82 #endif |
| 83 |
| 84 /* Enabling verbose error messages. */ |
| 85 #ifdef YYERROR_VERBOSE |
| 86 # undef YYERROR_VERBOSE |
| 87 # define YYERROR_VERBOSE 1 |
| 88 #else |
| 89 # define YYERROR_VERBOSE 1 |
| 90 #endif |
| 91 |
| 92 /* Enabling the token table. */ |
| 93 #ifndef YYTOKEN_TABLE |
| 94 # define YYTOKEN_TABLE 0 |
| 95 #endif |
| 96 |
| 97 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 98 If N is 0, then set CURRENT to the empty location which ends |
| 99 the previous symbol: RHS[0] (always defined). */ |
| 100 |
| 101 #ifndef YYLLOC_DEFAULT |
| 102 # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 103 do { \ |
| 104 if (N) \ |
| 105 { \ |
| 106 (Current).begin = (Rhs)[1].begin; \ |
| 107 (Current).end = (Rhs)[N].end; \ |
| 108 } \ |
| 109 else \ |
| 110 { \ |
| 111 (Current).begin = (Current).end = (Rhs)[0].end; \ |
| 112 } \ |
| 113 } while (false) |
| 114 #endif |
| 115 |
| 116 |
| 117 /* Line 300 of lalr1.cc */ |
| 118 #line 1 "[Bison:b4_percent_define_default]" |
| 119 |
| 120 namespace yy { |
| 121 |
| 122 /* Line 300 of lalr1.cc */ |
| 123 #line 124 "./calc++-parser.hh" |
| 124 |
| 125 /// A Bison parser. |
| 126 class calcxx_parser |
| 127 { |
| 128 public: |
| 129 /// Symbol semantic values. |
| 130 #ifndef YYSTYPE |
| 131 union semantic_type |
| 132 { |
| 133 |
| 134 /* Line 300 of lalr1.cc */ |
| 135 #line 8490 "../../doc/bison.texinfo" |
| 136 |
| 137 int ival; |
| 138 std::string *sval; |
| 139 |
| 140 |
| 141 |
| 142 /* Line 300 of lalr1.cc */ |
| 143 #line 144 "./calc++-parser.hh" |
| 144 }; |
| 145 #else |
| 146 typedef YYSTYPE semantic_type; |
| 147 #endif |
| 148 /// Symbol locations. |
| 149 typedef location location_type; |
| 150 /// Tokens. |
| 151 struct token |
| 152 { |
| 153 /* Tokens. */ |
| 154 enum yytokentype { |
| 155 END = 0, |
| 156 ASSIGN = 258, |
| 157 IDENTIFIER = 259, |
| 158 NUMBER = 260 |
| 159 }; |
| 160 |
| 161 }; |
| 162 /// Token type. |
| 163 typedef token::yytokentype token_type; |
| 164 |
| 165 /// Build a parser object. |
| 166 calcxx_parser (calcxx_driver& driver_yyarg); |
| 167 virtual ~calcxx_parser (); |
| 168 |
| 169 /// Parse. |
| 170 /// \returns 0 iff parsing succeeded. |
| 171 virtual int parse (); |
| 172 |
| 173 #if YYDEBUG |
| 174 /// The current debugging stream. |
| 175 std::ostream& debug_stream () const; |
| 176 /// Set the current debugging stream. |
| 177 void set_debug_stream (std::ostream &); |
| 178 |
| 179 /// Type for debugging levels. |
| 180 typedef int debug_level_type; |
| 181 /// The current debugging level. |
| 182 debug_level_type debug_level () const; |
| 183 /// Set the current debugging level. |
| 184 void set_debug_level (debug_level_type l); |
| 185 #endif |
| 186 |
| 187 private: |
| 188 /// Report a syntax error. |
| 189 /// \param loc where the syntax error is found. |
| 190 /// \param msg a description of the syntax error. |
| 191 virtual void error (const location_type& loc, const std::string& msg); |
| 192 |
| 193 /// Generate an error message. |
| 194 /// \param state the state where the error occurred. |
| 195 /// \param tok the lookahead token. |
| 196 virtual std::string yysyntax_error_ (int yystate, int tok); |
| 197 |
| 198 #if YYDEBUG |
| 199 /// \brief Report a symbol value on the debug stream. |
| 200 /// \param yytype The token type. |
| 201 /// \param yyvaluep Its semantic value. |
| 202 /// \param yylocationp Its location. |
| 203 virtual void yy_symbol_value_print_ (int yytype, |
| 204 const semantic_type* yyvaluep, |
| 205 const location_type* yylocationp); |
| 206 /// \brief Report a symbol on the debug stream. |
| 207 /// \param yytype The token type. |
| 208 /// \param yyvaluep Its semantic value. |
| 209 /// \param yylocationp Its location. |
| 210 virtual void yy_symbol_print_ (int yytype, |
| 211 const semantic_type* yyvaluep, |
| 212 const location_type* yylocationp); |
| 213 #endif |
| 214 |
| 215 |
| 216 /// State numbers. |
| 217 typedef int state_type; |
| 218 /// State stack type. |
| 219 typedef stack<state_type> state_stack_type; |
| 220 /// Semantic value stack type. |
| 221 typedef stack<semantic_type> semantic_stack_type; |
| 222 /// location stack type. |
| 223 typedef stack<location_type> location_stack_type; |
| 224 |
| 225 /// The state stack. |
| 226 state_stack_type yystate_stack_; |
| 227 /// The semantic value stack. |
| 228 semantic_stack_type yysemantic_stack_; |
| 229 /// The location stack. |
| 230 location_stack_type yylocation_stack_; |
| 231 |
| 232 /// Internal symbol numbers. |
| 233 typedef unsigned char token_number_type; |
| 234 /* Tables. */ |
| 235 /// For a state, the index in \a yytable_ of its portion. |
| 236 static const signed char yypact_[]; |
| 237 static const signed char yypact_ninf_; |
| 238 |
| 239 /// For a state, default rule to reduce. |
| 240 /// Unless\a yytable_ specifies something else to do. |
| 241 /// Zero means the default is an error. |
| 242 static const unsigned char yydefact_[]; |
| 243 |
| 244 static const signed char yypgoto_[]; |
| 245 static const signed char yydefgoto_[]; |
| 246 |
| 247 /// What to do in a state. |
| 248 /// \a yytable_[yypact_[s]]: what to do in state \a s. |
| 249 /// - if positive, shift that token. |
| 250 /// - if negative, reduce the rule which number is the opposite. |
| 251 /// - if zero, do what YYDEFACT says. |
| 252 static const unsigned char yytable_[]; |
| 253 static const signed char yytable_ninf_; |
| 254 |
| 255 static const signed char yycheck_[]; |
| 256 |
| 257 /// For a state, its accessing symbol. |
| 258 static const unsigned char yystos_[]; |
| 259 |
| 260 /// For a rule, its LHS. |
| 261 static const unsigned char yyr1_[]; |
| 262 /// For a rule, its RHS length. |
| 263 static const unsigned char yyr2_[]; |
| 264 |
| 265 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 266 /// For a symbol, its name in clear. |
| 267 static const char* const yytname_[]; |
| 268 #endif |
| 269 |
| 270 #if YYERROR_VERBOSE |
| 271 /// Convert the symbol name \a n to a form suitable for a diagnostic. |
| 272 virtual std::string yytnamerr_ (const char *n); |
| 273 #endif |
| 274 |
| 275 #if YYDEBUG |
| 276 /// A type to store symbol numbers and -1. |
| 277 typedef signed char rhs_number_type; |
| 278 /// A `-1'-separated list of the rules' RHS. |
| 279 static const rhs_number_type yyrhs_[]; |
| 280 /// For each rule, the index of the first RHS symbol in \a yyrhs_. |
| 281 static const unsigned char yyprhs_[]; |
| 282 /// For each rule, its source line number. |
| 283 static const unsigned short int yyrline_[]; |
| 284 /// For each scanner token number, its symbol number. |
| 285 static const unsigned short int yytoken_number_[]; |
| 286 /// Report on the debug stream that the rule \a r is going to be reduced. |
| 287 virtual void yy_reduce_print_ (int r); |
| 288 /// Print the state stack on the debug stream. |
| 289 virtual void yystack_print_ (); |
| 290 |
| 291 /* Debugging. */ |
| 292 int yydebug_; |
| 293 std::ostream* yycdebug_; |
| 294 #endif |
| 295 |
| 296 /// Convert a scanner token number \a t to a symbol number. |
| 297 token_number_type yytranslate_ (int t); |
| 298 |
| 299 /// \brief Reclaim the memory associated to a symbol. |
| 300 /// \param yymsg Why this token is reclaimed. |
| 301 /// \param yytype The symbol type. |
| 302 /// \param yyvaluep Its semantic value. |
| 303 /// \param yylocationp Its location. |
| 304 inline void yydestruct_ (const char* yymsg, |
| 305 int yytype, |
| 306 semantic_type* yyvaluep, |
| 307 location_type* yylocationp); |
| 308 |
| 309 /// Pop \a n symbols the three stacks. |
| 310 inline void yypop_ (unsigned int n = 1); |
| 311 |
| 312 /* Constants. */ |
| 313 static const int yyeof_; |
| 314 /* LAST_ -- Last index in TABLE_. */ |
| 315 static const int yylast_; |
| 316 static const int yynnts_; |
| 317 static const int yyempty_; |
| 318 static const int yyfinal_; |
| 319 static const int yyterror_; |
| 320 static const int yyerrcode_; |
| 321 static const int yyntokens_; |
| 322 static const unsigned int yyuser_token_number_max_; |
| 323 static const token_number_type yyundef_token_; |
| 324 |
| 325 /* User arguments. */ |
| 326 calcxx_driver& driver; |
| 327 }; |
| 328 |
| 329 /* Line 300 of lalr1.cc */ |
| 330 #line 1 "[Bison:b4_percent_define_default]" |
| 331 |
| 332 } // yy |
| 333 |
| 334 /* Line 300 of lalr1.cc */ |
| 335 #line 336 "./calc++-parser.hh" |
| 336 |
| 337 |
| 338 |
| 339 #endif /* ! defined PARSER_HEADER_H */ |
OLD | NEW |