jaula API Reference  version 1.4.0
jaula_parse.h
00001 
00002 /*
00003  * jaula_parse.h : JSON Analysis User Library Acronym
00004  * JSON data parser
00005  *
00006  * Copyright (C) 2007, 2008, 2009 Kombo Morongo <morongo666@gmail.com>
00007  *
00008  * This library is free software; you can redistribute it and/or modify it
00009  * under the terms of the GNU Lesser General Public License as published by
00010  * the Free Software Foundation; either version 2.1 of the License, or (at
00011  * your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00015  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00016  * License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public License
00019  * along with this library; if not, write to the Free Software Foundation,
00020  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00021  *
00022  * svn info:
00023  * $Author: morongo $
00024  * $HeadURL: https://jaula.svn.sourceforge.net/svnroot/jaula/tags/jaula-1.4.0/jaula/jaula_parse.h $
00025  * $Id: jaula_parse.h 45 2009-01-11 16:17:03Z morongo $
00026  * $Revision: 45 $
00027  */
00028 
00029 #ifndef _JAULA_PARSE_H_
00030 #define _JAULA_PARSE_H_
00031 
00036 #include <jaula/jaula_lexan.h>
00037 #include <jaula/jaula_syntax_error.h>
00038 #include <jaula/jaula_value_complex.h>
00039 
00040 namespace JAULA
00041 {                                // namespace JAULA
00052   class Parser
00053   {                              // class Parser
00054     public:
00055 
00059       Parser(void);
00060 
00064       ~Parser(void);
00065 
00109       static Value_Complex *parseStream(std::istream &inpStream
00110         , bool comments_allowed = false
00111         , bool full_read = true
00112         ) throw(Exception);
00113 
00114     private:
00115 
00126       class Value_Parser
00127       {                          // class Value_Parser
00128         public:
00129 
00133           Value_Parser(void);
00134 
00138           ~Value_Parser(void);
00139 
00167           static Value *parseValue(Lexan &lexan, unsigned int token)
00168             throw(Exception);
00169 
00170         private:
00171 
00179           enum parser_states
00180           {
00182             START,
00184             array_addItem,
00186             array_nextItem,
00191             error,
00193             false_value,
00195             null_value,
00197             number_int_value,
00199             number_value,
00201             property_begin,
00203             property_name,
00205             property_value,
00207             property_next,
00209             string_value,
00211             true_value,
00213             END
00214           };                     //enum parser_states
00215 
00239           static void EOFError(Lexan &lexan, Syntax_Error const &ex)
00240             throw(Exception);
00241       };                         // class Value_Parser
00242 
00243   };                             // class Parser
00244 
00245 }                                // namespace JAULA
00246 #endif
00247 
00248 // EOF $Id: jaula_parse.h 45 2009-01-11 16:17:03Z morongo $