QJson home page
json_parser.hh
1 /* A Bison parser, made by GNU Bison 2.3. */
2 
3 /* Skeleton interface for Bison LALR(1) parsers in C++
4 
5  Copyright (C) 2002, 2003, 2004, 2005, 2006 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 2, or (at your option)
10  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, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA. */
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 #include <string>
41 #include <iostream>
42 #include "stack.hh"
43 
44 namespace yy
45 {
46  class position;
47  class location;
48 }
49 
50 /* First part of user declarations. */
51 #line 25 "json_parser.yy"
52 
53  #include "parser_p.h"
54  #include "json_scanner.h"
55  #include "qjson_debug.h"
56 
57  #include <QtCore/QByteArray>
58  #include <QtCore/QMap>
59  #include <QtCore/QString>
60  #include <QtCore/QVariant>
61 
62  #include <limits>
63 
64  class JSonScanner;
65 
66  namespace QJson {
67  class Parser;
68  }
69 
70  #define YYERROR_VERBOSE 1
71 
72 
73 /* Line 35 of lalr1.cc. */
74 #line 75 "json_parser.hh"
75 
76 #include "location.hh"
77 
78 /* Enabling traces. */
79 #ifndef YYDEBUG
80 # define YYDEBUG 1
81 #endif
82 
83 /* Enabling verbose error messages. */
84 #ifdef YYERROR_VERBOSE
85 # undef YYERROR_VERBOSE
86 # define YYERROR_VERBOSE 1
87 #else
88 # define YYERROR_VERBOSE 1
89 #endif
90 
91 /* Enabling the token table. */
92 #ifndef YYTOKEN_TABLE
93 # define YYTOKEN_TABLE 0
94 #endif
95 
96 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
97  If N is 0, then set CURRENT to the empty location which ends
98  the previous symbol: RHS[0] (always defined). */
99 
100 #ifndef YYLLOC_DEFAULT
101 # define YYLLOC_DEFAULT(Current, Rhs, N) \
102 do { \
103  if (N) \
104  { \
105  (Current).begin = (Rhs)[1].begin; \
106  (Current).end = (Rhs)[N].end; \
107  } \
108  else \
109  { \
110  (Current).begin = (Current).end = (Rhs)[0].end; \
111  } \
112 } while (false)
113 #endif
114 
115 namespace yy
116 {
117 
120  {
121  public:
123 #ifndef YYSTYPE
124  typedef int semantic_type;
125 #else
126  typedef YYSTYPE semantic_type;
127 #endif
128 
131  struct token
132  {
133  /* Tokens. */
134  enum yytokentype {
135  END = 0,
136  CURLY_BRACKET_OPEN = 1,
137  CURLY_BRACKET_CLOSE = 2,
138  SQUARE_BRACKET_OPEN = 3,
139  SQUARE_BRACKET_CLOSE = 4,
140  COLON = 5,
141  COMMA = 6,
142  MINUS = 7,
143  DOT = 8,
144  DIGIT = 9,
145  E = 10,
146  TRUE_VAL = 11,
147  FALSE_VAL = 12,
148  NULL_VAL = 13,
149  QUOTMARKOPEN = 14,
150  QUOTMARKCLOSE = 15,
151  STRING = 16,
152  INFINITY_VAL = 17,
153  NAN_VAL = 18
154  };
155 
156  };
158  typedef token::yytokentype token_type;
159 
161  json_parser (QJson::ParserPrivate* driver_yyarg);
162  virtual ~json_parser ();
163 
166  virtual int parse ();
167 
169  std::ostream& debug_stream () const;
171  void set_debug_stream (std::ostream &);
172 
174  typedef int debug_level_type;
176  debug_level_type debug_level () const;
179 
180  private:
184  virtual void error (const location_type& loc, const std::string& msg);
185 
189  virtual std::string yysyntax_error_ (int yystate, int tok);
190 
191 #if YYDEBUG
192 
193 
194 
195 
196  virtual void yy_symbol_value_print_ (int yytype,
197  const semantic_type* yyvaluep,
198  const location_type* yylocationp);
203  virtual void yy_symbol_print_ (int yytype,
204  const semantic_type* yyvaluep,
205  const location_type* yylocationp);
206 #endif /* ! YYDEBUG */
207 
208 
210  typedef int state_type;
212  typedef stack<state_type> state_stack_type;
214  typedef stack<semantic_type> semantic_stack_type;
216  typedef stack<location_type> location_stack_type;
217 
219  state_stack_type yystate_stack_;
221  semantic_stack_type yysemantic_stack_;
223  location_stack_type yylocation_stack_;
224 
226  typedef unsigned char token_number_type;
227  /* Tables. */
229  static const signed char yypact_[];
230  static const signed char yypact_ninf_;
231 
235  static const unsigned char yydefact_[];
236 
237  static const signed char yypgoto_[];
238  static const signed char yydefgoto_[];
239 
245  static const unsigned char yytable_[];
246  static const signed char yytable_ninf_;
247 
248  static const signed char yycheck_[];
249 
251  static const unsigned char yystos_[];
252 
254  static const unsigned char yyr1_[];
256  static const unsigned char yyr2_[];
257 
258 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
259 
260  static const char* const yytname_[];
261 #endif
262 
263 #if YYERROR_VERBOSE
264 
265  virtual std::string yytnamerr_ (const char *n);
266 #endif
267 
268 #if YYDEBUG
269 
270  typedef signed char rhs_number_type;
272  static const rhs_number_type yyrhs_[];
274  static const unsigned char yyprhs_[];
276  static const unsigned char yyrline_[];
278  static const unsigned short int yytoken_number_[];
280  virtual void yy_reduce_print_ (int r);
282  virtual void yystack_print_ ();
283 #endif
284 
286  token_number_type yytranslate_ (int t);
287 
293  inline void yydestruct_ (const char* yymsg,
294  int yytype,
295  semantic_type* yyvaluep,
296  location_type* yylocationp);
297 
299  inline void yypop_ (unsigned int n = 1);
300 
301  /* Constants. */
302  static const int yyeof_;
303  /* LAST_ -- Last index in TABLE_. */
304  static const int yylast_;
305  static const int yynnts_;
306  static const int yyempty_;
307  static const int yyfinal_;
308  static const int yyterror_;
309  static const int yyerrcode_;
310  static const int yyntokens_;
311  static const unsigned int yyuser_token_number_max_;
312  static const token_number_type yyundef_token_;
313 
314  /* Debugging. */
315  int yydebug_;
316  std::ostream* yycdebug_;
317 
318 
319  /* User arguments. */
320  QJson::ParserPrivate* driver;
321  };
322 }
323 
324 
325 #endif /* ! defined PARSER_HEADER_H */

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