QJson project page QJson home page

/work/a/ports/devel/qjson/work/qjson/src/json_parser.hh

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   class JSonScanner;
00063 
00064   namespace QJson {
00065     class Parser;
00066   }
00067 
00068   #define YYERROR_VERBOSE 1
00069 
00070 
00071 /* Line 303 of lalr1.cc.  */
00072 #line 73 "json_parser.hh"
00073 
00074 #include "location.hh"
00075 
00076 /* Enabling traces.  */
00077 #ifndef YYDEBUG
00078 # define YYDEBUG 1
00079 #endif
00080 
00081 /* Enabling verbose error messages.  */
00082 #ifdef YYERROR_VERBOSE
00083 # undef YYERROR_VERBOSE
00084 # define YYERROR_VERBOSE 1
00085 #else
00086 # define YYERROR_VERBOSE 1
00087 #endif
00088 
00089 /* Enabling the token table.  */
00090 #ifndef YYTOKEN_TABLE
00091 # define YYTOKEN_TABLE 0
00092 #endif
00093 
00094 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00095    If N is 0, then set CURRENT to the empty location which ends
00096    the previous symbol: RHS[0] (always defined).  */
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
00126 
00127     typedef location location_type;
00129     struct token
00130     {
00131       /* Tokens.  */
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
00188 
00189 
00190 
00191 
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 /* ! YYDEBUG */
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     /* Tables.  */
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
00255 
00256     static const char* const yytname_[];
00257 #endif
00258 
00259 #if YYERROR_VERBOSE
00260 
00261     virtual std::string yytnamerr_ (const char *n);
00262 #endif
00263 
00264 #if YYDEBUG
00265 
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     /* Constants.  */
00298     static const int yyeof_;
00299     /* LAST_ -- Last index in TABLE_.  */
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     /* Debugging.  */
00311     int yydebug_;
00312     std::ostream* yycdebug_;
00313 
00314 
00315     /* User arguments.  */
00316     QJson::ParserPrivate* driver;
00317   };
00318 }
00319 
00320 
00321 #endif /* ! defined PARSER_HEADER_H */

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