jaula API Reference  version 1.4.0
JAULA::Lexan Class Reference

Lexical Analysis implementation. More...

#include <jaula_lexan.h>

Public Member Functions

Lexan_Error const * getErrorReport (void) const
 Retrieves details for the last error detected.
std::string const & getTokenData (void) const
 Retrieves last token associated data.
 Lexan (std::istream &in_stream, bool comments_allowed=false)
 Constructor.
virtual void LexerError (const char *detail)
 Error report.
virtual int yylex ()
 Retrieves tokens from the input.
virtual ~Lexan ()
 Destructor.

Private Attributes

bool commented
 Flag for extending language to accept # comments.
Lexan_ErrorpErrorReport
 Pointer to the last exception detected.
std::string tokenData
 Container for the token associated data.

Detailed Description

Lexical Analysis implementation.

This class implements the lexical analysis for JSON as specified by RFC 4627.
Author:
Kombo Morongo <morongo666@gmail.com>

Constructor & Destructor Documentation

JAULA::Lexan::Lexan ( std::istream &  in_stream,
bool  comments_allowed = false 
)

Constructor.

Parameters:
in_streamstream for the input data to analyze
comments_allowedflag to extend basic format and allow for hash symbol '#' starting comments in input.
Description
Creates a lexical analysis instance for the specified input stream.
virtual JAULA::Lexan::~Lexan ( ) [virtual]

Destructor.


Member Function Documentation

Lexan_Error const* JAULA::Lexan::getErrorReport ( void  ) const

Retrieves details for the last error detected.

Returns:
a pointer to an instance containing the details for the last error detected during the lexical analysis process or a null pointer in case no error have ocurred during the lexical analysis so far.
std::string const& JAULA::Lexan::getTokenData ( void  ) const

Retrieves last token associated data.

Returns:
the data associated for the last token returned from yylex() in case there is such kind of data (token corresponds to a property name or a single value) or undefined otherwise.
virtual void JAULA::Lexan::LexerError ( const char *  detail) [virtual]

Error report.

Parameters:
detailText for the error received
Description
This method is a callback used by the analysis routines to indicate an error condition.
Its current implementation consists of generating the exception instance to be retrieved by getErrorReport().
virtual int JAULA::Lexan::yylex ( ) [virtual]

Retrieves tokens from the input.

Returns:
the code for a token read or 0 if the end of data has been reached.

Referenced by JAULA::Parser::parseStream().


Field Documentation

bool JAULA::Lexan::commented [private]

Flag for extending language to accept # comments.

Pointer to the last exception detected.

std::string JAULA::Lexan::tokenData [private]

Container for the token associated data.


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