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 yy 00045 { 00046 class position; 00047 class location; 00048 } 00049 00050 /* First part of user declarations. */ 00051 #line 25 "json_parser.yy" 00052 00053 #include "parser_p.h" 00054 #include "json_scanner.h" 00055 #include "qjson_debug.h" 00056 00057 #include <QtCore/QByteArray> 00058 #include <QtCore/QMap> 00059 #include <QtCore/QString> 00060 #include <QtCore/QVariant> 00061 00062 #include <limits> 00063 00064 class JSonScanner; 00065 00066 namespace QJson { 00067 class Parser; 00068 } 00069 00070 #define YYERROR_VERBOSE 1 00071 00072 00073 /* Line 35 of lalr1.cc. */ 00074 #line 75 "json_parser.hh" 00075 00076 #include "location.hh" 00077 00078 /* Enabling traces. */ 00079 #ifndef YYDEBUG 00080 # define YYDEBUG 1 00081 #endif 00082 00083 /* Enabling verbose error messages. */ 00084 #ifdef YYERROR_VERBOSE 00085 # undef YYERROR_VERBOSE 00086 # define YYERROR_VERBOSE 1 00087 #else 00088 # define YYERROR_VERBOSE 1 00089 #endif 00090 00091 /* Enabling the token table. */ 00092 #ifndef YYTOKEN_TABLE 00093 # define YYTOKEN_TABLE 0 00094 #endif 00095 00096 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00097 If N is 0, then set CURRENT to the empty location which ends 00098 the previous symbol: RHS[0] (always defined). */ 00099 00100 #ifndef YYLLOC_DEFAULT 00101 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00102 do { \ 00103 if (N) \ 00104 { \ 00105 (Current).begin = (Rhs)[1].begin; \ 00106 (Current).end = (Rhs)[N].end; \ 00107 } \ 00108 else \ 00109 { \ 00110 (Current).begin = (Current).end = (Rhs)[0].end; \ 00111 } \ 00112 } while (false) 00113 #endif 00114 00115 namespace yy 00116 { 00117 00119 class json_parser 00120 { 00121 public: 00123 #ifndef YYSTYPE 00124 typedef int semantic_type; 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 CURLY_BRACKET_OPEN = 1, 00137 CURLY_BRACKET_CLOSE = 2, 00138 SQUARE_BRACKET_OPEN = 3, 00139 SQUARE_BRACKET_CLOSE = 4, 00140 COLON = 5, 00141 COMMA = 6, 00142 MINUS = 7, 00143 DOT = 8, 00144 DIGIT = 9, 00145 E = 10, 00146 TRUE_VAL = 11, 00147 FALSE_VAL = 12, 00148 NULL_VAL = 13, 00149 QUOTMARKOPEN = 14, 00150 QUOTMARKCLOSE = 15, 00151 STRING = 16, 00152 INFINITY_VAL = 17, 00153 NAN_VAL = 18 00154 }; 00155 00156 }; 00158 typedef token::yytokentype token_type; 00159 00161 json_parser (QJson::ParserPrivate* driver_yyarg); 00162 virtual ~json_parser (); 00163 00166 virtual int parse (); 00167 00169 std::ostream& debug_stream () const; 00171 void set_debug_stream (std::ostream &); 00172 00174 typedef int debug_level_type; 00176 debug_level_type debug_level () const; 00178 void set_debug_level (debug_level_type l); 00179 00180 private: 00184 virtual void error (const location_type& loc, const std::string& msg); 00185 00189 virtual std::string yysyntax_error_ (int yystate, int tok); 00190 00191 #if YYDEBUG 00192 00193 00194 00195 00196 virtual void yy_symbol_value_print_ (int yytype, 00197 const semantic_type* yyvaluep, 00198 const location_type* yylocationp); 00203 virtual void yy_symbol_print_ (int yytype, 00204 const semantic_type* yyvaluep, 00205 const location_type* yylocationp); 00206 #endif /* ! YYDEBUG */ 00207 00208 00210 typedef int state_type; 00212 typedef stack<state_type> state_stack_type; 00214 typedef stack<semantic_type> semantic_stack_type; 00216 typedef stack<location_type> location_stack_type; 00217 00219 state_stack_type yystate_stack_; 00221 semantic_stack_type yysemantic_stack_; 00223 location_stack_type yylocation_stack_; 00224 00226 typedef unsigned char token_number_type; 00227 /* Tables. */ 00229 static const signed char yypact_[]; 00230 static const signed char yypact_ninf_; 00231 00235 static const unsigned char yydefact_[]; 00236 00237 static const signed char yypgoto_[]; 00238 static const signed char yydefgoto_[]; 00239 00245 static const unsigned char yytable_[]; 00246 static const signed char yytable_ninf_; 00247 00248 static const signed char yycheck_[]; 00249 00251 static const unsigned char yystos_[]; 00252 00254 static const unsigned char yyr1_[]; 00256 static const unsigned char yyr2_[]; 00257 00258 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00259 00260 static const char* const yytname_[]; 00261 #endif 00262 00263 #if YYERROR_VERBOSE 00264 00265 virtual std::string yytnamerr_ (const char *n); 00266 #endif 00267 00268 #if YYDEBUG 00269 00270 typedef signed char rhs_number_type; 00272 static const rhs_number_type yyrhs_[]; 00274 static const unsigned char yyprhs_[]; 00276 static const unsigned char yyrline_[]; 00278 static const unsigned short int yytoken_number_[]; 00280 virtual void yy_reduce_print_ (int r); 00282 virtual void yystack_print_ (); 00283 #endif 00284 00286 token_number_type yytranslate_ (int t); 00287 00293 inline void yydestruct_ (const char* yymsg, 00294 int yytype, 00295 semantic_type* yyvaluep, 00296 location_type* yylocationp); 00297 00299 inline void yypop_ (unsigned int n = 1); 00300 00301 /* Constants. */ 00302 static const int yyeof_; 00303 /* LAST_ -- Last index in TABLE_. */ 00304 static const int yylast_; 00305 static const int yynnts_; 00306 static const int yyempty_; 00307 static const int yyfinal_; 00308 static const int yyterror_; 00309 static const int yyerrcode_; 00310 static const int yyntokens_; 00311 static const unsigned int yyuser_token_number_max_; 00312 static const token_number_type yyundef_token_; 00313 00314 /* Debugging. */ 00315 int yydebug_; 00316 std::ostream* yycdebug_; 00317 00318 00319 /* User arguments. */ 00320 QJson::ParserPrivate* driver; 00321 }; 00322 } 00323 00324 00325 #endif /* ! defined PARSER_HEADER_H */
|
hosts this site. |
Send comments to: QJson Developers |