QJson home page
json_parser.hh
Go to the documentation of this file.
1/* A Bison parser, made by GNU Bison 2.7. */
2
3/* Skeleton interface for Bison LALR(1) parsers in C++
4
5 Copyright (C) 2002-2012 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20/* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
38/* C++ LALR(1) parser skeleton written by Akim Demaille. */
39
40#ifndef YY_YY_JSON_PARSER_HH_INCLUDED
41# define YY_YY_JSON_PARSER_HH_INCLUDED
42
43/* "%code requires" blocks. */
44/* Line 33 of lalr1.cc */
45#line 26 "json_parser.yy"
46
47 #include "parser_p.h"
48 #include "json_scanner.h"
49 #include "qjson_debug.h"
50
51 #include <QtCore/QByteArray>
52 #include <QtCore/QMap>
53 #include <QtCore/QString>
54 #include <QtCore/QVariant>
55
56 #include <limits>
57
58 class JSonScanner;
59
60 namespace QJson {
61 class Parser;
62 }
63
64 #define YYERROR_VERBOSE 1
65
66 Q_DECLARE_METATYPE(QVector<QVariant>*)
67 Q_DECLARE_METATYPE(QVariantMap*)
68
69
70/* Line 33 of lalr1.cc */
71#line 72 "json_parser.hh"
72
73
74#include <string>
75#include <iostream>
76#include "stack.hh"
77#include "location.hh"
78
79/* Enabling traces. */
80#ifndef YYDEBUG
81# define YYDEBUG 1
82#endif
83
84
85namespace yy {
86/* Line 33 of lalr1.cc */
87#line 88 "json_parser.hh"
88
91 {
92 public:
94#ifndef YYSTYPE
95 typedef int semantic_type;
96#else
97 typedef YYSTYPE semantic_type;
98#endif
102 struct token
103 {
104 /* Tokens. */
105 enum yytokentype {
106 END = 0,
107 CURLY_BRACKET_OPEN = 1,
108 CURLY_BRACKET_CLOSE = 2,
109 SQUARE_BRACKET_OPEN = 3,
110 SQUARE_BRACKET_CLOSE = 4,
111 COLON = 5,
112 COMMA = 6,
113 NUMBER = 7,
114 TRUE_VAL = 8,
115 FALSE_VAL = 9,
116 NULL_VAL = 10,
117 STRING = 11,
118 INVALID = 12
119 };
120
121 };
123 typedef token::yytokentype token_type;
124
126 json_parser (QJson::ParserPrivate* driver_yyarg);
127 virtual ~json_parser ();
128
131 virtual int parse ();
132
133#if YYDEBUG
135 std::ostream& debug_stream () const;
137 void set_debug_stream (std::ostream &);
138
140 typedef int debug_level_type;
145#endif
146
147 private:
151 virtual void error (const location_type& loc, const std::string& msg);
152
156 virtual std::string yysyntax_error_ (int yystate, int tok);
157
158#if YYDEBUG
163 virtual void yy_symbol_value_print_ (int yytype,
164 const semantic_type* yyvaluep,
165 const location_type* yylocationp);
170 virtual void yy_symbol_print_ (int yytype,
171 const semantic_type* yyvaluep,
172 const location_type* yylocationp);
173#endif
174
175
177 typedef int state_type;
179 typedef stack<state_type> state_stack_type;
181 typedef stack<semantic_type> semantic_stack_type;
183 typedef stack<location_type> location_stack_type;
184
186 state_stack_type yystate_stack_;
188 semantic_stack_type yysemantic_stack_;
190 location_stack_type yylocation_stack_;
191
194 static bool yy_pact_value_is_default_ (int yyvalue);
195
198 static bool yy_table_value_is_error_ (int yyvalue);
199
201 typedef unsigned char token_number_type;
202 /* Tables. */
204 static const signed char yypact_[];
205 static const signed char yypact_ninf_;
206
210 static const unsigned char yydefact_[];
211
212 static const signed char yypgoto_[];
213 static const signed char yydefgoto_[];
214
220 static const unsigned char yytable_[];
221 static const signed char yytable_ninf_;
222
223 static const signed char yycheck_[];
224
226 static const unsigned char yystos_[];
227
229 static const unsigned char yyr1_[];
231 static const unsigned char yyr2_[];
232
234 static std::string yytnamerr_ (const char *n);
235
236
238 static const char* const yytname_[];
239#if YYDEBUG
241 typedef signed char rhs_number_type;
243 static const rhs_number_type yyrhs_[];
245 static const unsigned char yyprhs_[];
247 static const unsigned char yyrline_[];
249 static const unsigned short int yytoken_number_[];
251 virtual void yy_reduce_print_ (int r);
253 virtual void yystack_print_ ();
254
255 /* Debugging. */
256 int yydebug_;
257 std::ostream* yycdebug_;
258#endif
259
261 token_number_type yytranslate_ (int t);
262
269 inline void yydestruct_ (const char* yymsg,
270 int yytype,
271 semantic_type* yyvaluep,
272 location_type* yylocationp);
273
275 inline void yypop_ (unsigned int n = 1);
276
277 /* Constants. */
278 static const int yyeof_;
279 /* LAST_ -- Last index in TABLE_. */
280 static const int yylast_;
281 static const int yynnts_;
282 static const int yyempty_;
283 static const int yyfinal_;
284 static const int yyterror_;
285 static const int yyerrcode_;
286 static const int yyntokens_;
287 static const unsigned int yyuser_token_number_max_;
288 static const token_number_type yyundef_token_;
289
290 /* User arguments. */
291 QJson::ParserPrivate* driver;
292 };
293
294} // yy
295/* Line 33 of lalr1.cc */
296#line 297 "json_parser.hh"
297
298
299
300#endif /* !YY_YY_JSON_PARSER_HH_INCLUDED */
Main class used to convert JSON data to QVariant objects.
Definition parser.h:42
A Bison parser.
json_parser(QJson::ParserPrivate *driver_yyarg)
Build a parser object.
debug_level_type debug_level() const
The current debugging level.
virtual int parse()
token::yytokentype token_type
Token type.
int debug_level_type
Type for debugging levels.
void set_debug_level(debug_level_type l)
Set the current debugging level.
std::ostream & debug_stream() const
The current debugging stream.
location location_type
Symbol locations.
YYSTYPE semantic_type
Symbol semantic values.
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Abstract a location.
Definition location.hh:50

SourceForge Logo hosts this site. Send comments to:
QJson Developers