Index

ExpanderVisitor Class Reference

The Expander Visitor's work consists in printing out the values of the parsed constants and tokens. More...

#include "gsp__Visitor.h"


Inherited Class(es)


Public Functions

Private Variables


Detailed Description

The Expander Visitor's work consists in printing out the values of the parsed constants and tokens.

The symbol's expand() functions are implemented using this visitor.

See also:

virtual bool gsp::Symbol::expand ( std::ostream & os , bool bRestoreWS = true ) 
universal::String gsp::Symbol::expand ( bool bTrimFirstWhitespaces = true , bool bRestoreWS = true ) 


Functions Documentation

ExpanderVisitor ( std::ostream & os , bool bRestoreWS 

Constructor.

See also:

Back to index

~ExpanderVisitor ( )   [  virtual  ] 

Destructor.

See also:

Back to index

bool process ( gsp::Symbol * & rpSymbol   [  virtual  ] 

If the symbol is a non-terminal, it does nothing and true is returned. If the symbol is a token, it prints out the value of the token as it was parsed in the original input stream.

Returns true if the operation was successful, which is normally always the case if the expanded symbol was initially parsed successfully.

The code executed is the following:

Example:

  if (rpSymbol)
    {
      if (rpSymbol->isToken())
	{
	  rpSymbol->restore_ws(0, m_os);
	  rpSymbol->expand(m_os);
	}
      else // (rpSymbol->isNonTerminal())
	{
	  // Nothing to do
	}
      return true;
    }
  else
    {
      return false;
    }

See also:

virtual bool Visitor::process ( gsp::Symbol * & rpSymbol ) = 0 
virtual bool Visitor::process ( const char * c_pszConstant , gsp::Symbol & parent , unsigned long uSymbolRank ) = 0 
Back to index

bool process ( const char * c_pszConstant , gsp::Symbol & parent , unsigned long uSymbolRank   [  virtual  ] 

Prints out the value of the passed constant, restituting the preceding whitespaces that were eaten during parsing.

Returns always true.

The code executed is the following:

Example:

  parent.restore_ws(uSymbolRank, m_os);
  m_os << c_pszConstant;
  return true;

See also:

virtual bool Visitor::process ( gsp::Symbol * & rpSymbol ) = 0 
virtual bool Visitor::process ( const char * c_pszConstant , gsp::Symbol & parent , unsigned long uSymbolRank ) = 0 
Back to index


Generated with makedoc.