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 yy
00045 {
00046 class position;
00047 class location;
00048 }
00049
00050
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 class JSonScanner;
00063
00064 namespace QJson {
00065 class Parser;
00066 }
00067
00068 #define YYERROR_VERBOSE 1
00069
00070
00071
00072 #line 73 "json_parser.hh"
00073
00074 #include "location.hh"
00075
00076
00077 #ifndef YYDEBUG
00078 # define YYDEBUG 1
00079 #endif
00080
00081
00082 #ifdef YYERROR_VERBOSE
00083 # undef YYERROR_VERBOSE
00084 # define YYERROR_VERBOSE 1
00085 #else
00086 # define YYERROR_VERBOSE 1
00087 #endif
00088
00089
00090 #ifndef YYTOKEN_TABLE
00091 # define YYTOKEN_TABLE 0
00092 #endif
00093
00094
00095
00096
00097
00098 #ifndef YYLLOC_DEFAULT
00099 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00100 do { \
00101 if (N) \
00102 { \
00103 (Current).begin = (Rhs)[1].begin; \
00104 (Current).end = (Rhs)[N].end; \
00105 } \
00106 else \
00107 { \
00108 (Current).begin = (Current).end = (Rhs)[0].end; \
00109 } \
00110 } while (false)
00111 #endif
00112
00113 namespace yy
00114 {
00115
00117 class json_parser
00118 {
00119 public:
00121 #ifndef YYSTYPE
00122 typedef int semantic_type;
00123 #else
00124 typedef YYSTYPE semantic_type;
00125 #endif
00127 typedef location location_type;
00129 struct token
00130 {
00131
00132 enum yytokentype {
00133 END = 0,
00134 CURLY_BRACKET_OPEN = 1,
00135 CURLY_BRACKET_CLOSE = 2,
00136 SQUARE_BRACKET_OPEN = 3,
00137 SQUARE_BRACKET_CLOSE = 4,
00138 COLON = 5,
00139 COMMA = 6,
00140 MINUS = 7,
00141 DOT = 8,
00142 DIGIT = 9,
00143 E = 10,
00144 TRUE_VAL = 11,
00145 FALSE_VAL = 12,
00146 NULL_VAL = 13,
00147 QUOTMARKOPEN = 14,
00148 QUOTMARKCLOSE = 15,
00149 STRING = 16
00150 };
00151
00152 };
00154 typedef token::yytokentype token_type;
00155
00157 json_parser (QJson::ParserPrivate* driver_yyarg);
00158 virtual ~json_parser ();
00159
00162 virtual int parse ();
00163
00165 std::ostream& debug_stream () const;
00167 void set_debug_stream (std::ostream &);
00168
00170 typedef int debug_level_type;
00172 debug_level_type debug_level () const;
00174 void set_debug_level (debug_level_type l);
00175
00176 private:
00180 virtual void error (const location_type& loc, const std::string& msg);
00181
00185 virtual std::string yysyntax_error_ (int yystate, int tok);
00186
00187 #if YYDEBUG
00192 virtual void yy_symbol_value_print_ (int yytype,
00193 const semantic_type* yyvaluep,
00194 const location_type* yylocationp);
00199 virtual void yy_symbol_print_ (int yytype,
00200 const semantic_type* yyvaluep,
00201 const location_type* yylocationp);
00202 #endif
00203
00204
00206 typedef int state_type;
00208 typedef stack<state_type> state_stack_type;
00210 typedef stack<semantic_type> semantic_stack_type;
00212 typedef stack<location_type> location_stack_type;
00213
00215 state_stack_type yystate_stack_;
00217 semantic_stack_type yysemantic_stack_;
00219 location_stack_type yylocation_stack_;
00220
00222 typedef unsigned char token_number_type;
00223
00225 static const signed char yypact_[];
00226 static const signed char yypact_ninf_;
00227
00231 static const unsigned char yydefact_[];
00232
00233 static const signed char yypgoto_[];
00234 static const signed char yydefgoto_[];
00235
00241 static const unsigned char yytable_[];
00242 static const signed char yytable_ninf_;
00243
00244 static const unsigned char yycheck_[];
00245
00247 static const unsigned char yystos_[];
00248
00250 static const unsigned char yyr1_[];
00252 static const unsigned char yyr2_[];
00253
00254 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00256 static const char* const yytname_[];
00257 #endif
00258
00259 #if YYERROR_VERBOSE
00261 virtual std::string yytnamerr_ (const char *n);
00262 #endif
00263
00264 #if YYDEBUG
00266 typedef signed char rhs_number_type;
00268 static const rhs_number_type yyrhs_[];
00270 static const unsigned char yyprhs_[];
00272 static const unsigned char yyrline_[];
00274 static const unsigned short int yytoken_number_[];
00276 virtual void yy_reduce_print_ (int r);
00278 virtual void yystack_print_ ();
00279 #endif
00280
00282 token_number_type yytranslate_ (int t);
00283
00289 inline void yydestruct_ (const char* yymsg,
00290 int yytype,
00291 semantic_type* yyvaluep,
00292 location_type* yylocationp);
00293
00295 inline void yypop_ (unsigned int n = 1);
00296
00297
00298 static const int yyeof_;
00299
00300 static const int yylast_;
00301 static const int yynnts_;
00302 static const int yyempty_;
00303 static const int yyfinal_;
00304 static const int yyterror_;
00305 static const int yyerrcode_;
00306 static const int yyntokens_;
00307 static const unsigned int yyuser_token_number_max_;
00308 static const token_number_type yyundef_token_;
00309
00310
00311 int yydebug_;
00312 std::ostream* yycdebug_;
00313
00314
00315
00316 QJson::ParserPrivate* driver;
00317 };
00318 }
00319
00320
00321 #endif