JAULA::Parser::Value_Parser Class Reference
[JAULA: JSON data parser]

JSON Value Parser. More...


Public Member Functions

 Value_Parser (void)
 Constructor.
 ~Value_Parser (void)
 Destructor.

Static Public Member Functions

static ValueparseValue (Lexan &lexan, unsigned int token) throw (Exception)
 reads a single JSON value

Private Types

enum  parser_states {
  START, array_addItem, array_nextItem, error,
  false_value, null_value, number_int_value, number_value,
  property_begin, property_name, property_value, property_next,
  string_value, true_value, END
}
 Enumeration for the parser state machine. More...

Static Private Member Functions

static void EOFError (Lexan &lexan, Syntax_Error const &ex) throw (Exception)
 Analyzes the reason for an EOF condition.


Detailed Description

JSON Value Parser.

Parses a value from the input stream.
Author:
Kombo Morongo <morongo666@gmail.com>

Member Enumeration Documentation

Enumeration for the parser state machine.

Description
This type defines a constant for each state that the parser may assume during the process.
Enumerator:
START  initial state
array_addItem  a new item for an array has been read
array_nextItem  an inter-item delimiter for an array has been read
error  error condition detected (pseudostate that launches an exception terminating the process)
false_value  a boolean false value constant has been read (pseudostate)
null_value  a null value constant has been read (pseudostate)
number_int_value  a numeric (integer) value has been read (pseudostate)
number_value  a numeric (float) value has been read (pseudostate)
property_begin  an object initial delimiter has been read
property_name  an object property name has been read
property_value  an object property delimiter has been read
property_next  an inter-property delimiter for an object has been read
string_value  a string value has been read (pseudostate)
true_value  a boolean true value constant has been read (pseudostate)
END  final state (pseudostate)


Constructor & Destructor Documentation

JAULA::Parser::Value_Parser::Value_Parser ( void   ) 

Constructor.

JAULA::Parser::Value_Parser::~Value_Parser ( void   ) 

Destructor.


Member Function Documentation

void JAULA::Parser::Value_Parser::EOFError ( Lexan lexan,
Syntax_Error const &  ex 
) throw (Exception) [static, private]

Analyzes the reason for an EOF condition.

Parameters:
lexan Reference to the lexical analysis instance that reads from the input.
ex Syntax error to be thrown detailing why an EOF at this point is an error.
Exceptions:
Exception As a result of the execution of this method an exception is thrown with the data conatined in the input parameter or with a JAULA::LEXAN_ERROR type if the EOF is due to an error in the lexical analysis phase.
Description
This method is to be launched whenever an unexpected end of file is encountered. Its implementation includes analyzing if the EOF condition is real or a side effect from a lexical analysis error and chooses to send the Lexan::LexerError Exception or the one received in the input parameter based on this.

References JAULA::Exception::addOrigin().

Value * JAULA::Parser::Value_Parser::parseValue ( Lexan lexan,
unsigned int  token 
) throw (Exception) [static]

reads a single JSON value

Parameters:
lexan Reference to the lexical analysis instance that reads from the input.
token Token read from the upper level. * If this token does not belong to an starting value token, an error condition will arise.
Returns:
a pointer to memory taken from the heap containing the value read. If this value belongs to a complex type, all the items that it contains have been recursively parsed.
Exceptions:
Exception An exception will be thrown as soon as a lexical or syntax error is found analyzing the stream. The result of printing the exception retrurned through a stream is a human readable text explaining the error found and an approximation of the error line where it occurred.
Description
This method fully reads a whole value from the input or until a syntax or lexical error is found. Upon execution input stream is positioned so that a new token or EOF can be read from the input.

References JAULA::Exception::addOrigin(), and JAULA::Value_String::getData().


The documentation for this class was generated from the following files:


Back to JAULA Project Documentation Page.

Go to JAULA Project Home Page.


Copyright (c) 2007, 2008, 2009 Kombo Morongo.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

API Reference Generated for jaula by

doxygen

jaula project hosted by

SourceForge.net Logo