MADNESS  version 0.9
Public Member Functions | List of all members
mu::ParserTokenReader Class Reference

Token reader for the ParserBase class. More...

#include <muParserTokenReader.h>

Public Member Functions

 ParserTokenReader (ParserBase *a_pParent)
 Constructor. More...
 
ParserTokenReaderClone (ParserBase *a_pParent) const
 Create instance of a ParserTokenReader identical with this and return its pointer. More...
 
void AddValIdent (identfun_type a_pCallback)
 
void SetVarCreator (facfun_type a_pFactory, void *pUserData)
 
void SetFormula (const string_type &a_strFormula)
 Initialize the token Reader. More...
 
void SetArgSep (char_type cArgSep)
 
int GetPos () const
 Return the current position of the token reader in the formula string. More...
 
const string_typeGetFormula () const
 Return a reference to the formula. More...
 
const varmap_typeGetUsedVar () const
 Return a map containing the used variables only. More...
 
char_type GetArgSep () const
 
void IgnoreUndefVar (bool bIgnore)
 Set Flag that contronls behaviour in case of undefined variables beeing found. More...
 
void ReInit ()
 Reset the token reader to the start of the formula. More...
 
token_type ReadNextToken ()
 Read the next token from the string. More...
 

Detailed Description

Token reader for the ParserBase class.

Constructor & Destructor Documentation

mu::ParserTokenReader::ParserTokenReader ( ParserBase a_pParent)

Constructor.

Create a Token reader and bind it to a parser object.

Precondition
[assert] a_pParser may not be NULL
Postcondition
#m_pParser==a_pParser
Parameters
a_pParentParent parser object of the token reader.

Referenced by Clone().

Member Function Documentation

void mu::ParserTokenReader::AddValIdent ( identfun_type  a_pCallback)
ParserTokenReader * mu::ParserTokenReader::Clone ( ParserBase a_pParent) const

Create instance of a ParserTokenReader identical with this and return its pointer.

This is a factory method the calling function must take care of the object destruction.

Returns
A new ParserTokenReader object.
Exceptions
nothrow

References ParserTokenReader().

char_type mu::ParserTokenReader::GetArgSep ( ) const
const string_type & mu::ParserTokenReader::GetFormula ( ) const

Return a reference to the formula.

Returns
#m_strFormula
Exceptions
nothrow
int mu::ParserTokenReader::GetPos ( ) const

Return the current position of the token reader in the formula string.

Returns
#m_iPos
Exceptions
nothrow
const varmap_type & mu::ParserTokenReader::GetUsedVar ( ) const

Return a map containing the used variables only.

void mu::ParserTokenReader::IgnoreUndefVar ( bool  bIgnore)

Set Flag that contronls behaviour in case of undefined variables beeing found.

If true, the parser does not throw an exception if an undefined variable is found. otherwise it does. This variable is used internally only! It supresses a "undefined variable" exception in GetUsedVar(). Those function should return a complete list of variables including those the are not defined by the time of it's call.

ParserTokenReader::token_type mu::ParserTokenReader::ReadNextToken ( )

Read the next token from the string.

References mu::ecUNASSIGNABLE_TOKEN, and mu::ParserBase::ValidNameChars().

void mu::ParserTokenReader::ReInit ( )

Reset the token reader to the start of the formula.

The syntax flags will be reset to a value appropriate for the start of a formula.

Postcondition
#m_iPos==0, #m_iSynFlags = noOPT | noBC | noPOSTOP | noSTR
Exceptions
nothrow
See also
ESynCodes

Referenced by SetFormula().

void mu::ParserTokenReader::SetArgSep ( char_type  cArgSep)

References cArgSep.

void mu::ParserTokenReader::SetFormula ( const string_type a_strFormula)

Initialize the token Reader.

Sets the formula position index to zero and set Syntax flags to default for initial formula parsing.

Precondition
[assert] triggered if a_szFormula==0

References ReInit().

void mu::ParserTokenReader::SetVarCreator ( facfun_type  a_pFactory,
void *  pUserData 
)

References a_pFactory, and pUserData.


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