Index

BlockToken Class Reference

BlockToken token class. More...

#include "ini__BlockToken.h"


Inherited Class(es)


Public Functions

Protected Functions

Public Static Functions

Protected Variables

Protected Static Variables

Friends


Detailed Description

BlockToken token class.

This class provides the parse and expand code for a BlockToken token. It includes the code written for this token in the gsp file.


Functions Documentation

int maxOccurrences ( )   [  static  ] 

Returns the maximum allowed number of occurrences of this symbol or -1 if there is no limit.

See also:

Back to index

int minOccurrences ( )   [  static  ] 

Returns the minimum required number of occurrences of this symbol or -1 if there is no limit.

See also:

Back to index

void maxOccurrences ( int iMaxOcc   [  static  ] 

Sets the maximum allowed number of occurrences of this symbol. -1 if there is no limit.

See also:

Back to index

void minOccurrences ( int iMinOcc   [  static  ] 

Sets the minimum required number of occurrences of this symbol. -1 if there is no limit.

See also:

Back to index

BlockToken ( ) 

Token symbol class constructor.

See also:

Back to index

~BlockToken ( )   [  virtual  ] 

Token class destructor.

See also:

Back to index

bool isToken ( ) const   [  virtual  ] 

Tells whether the symbol is token.

See also:

Back to index

bool isNonTerminal ( ) const   [  virtual  ] 

Tells whether the symbol is a non-terminal.

See also:

Back to index

bool parseSymbol ( gsp::LLParser & parser , gsp::Symbol * & rpReturnSymbol , gsp::Symbol * pParent   [  virtual  ] 

Please refer to the matching overriden method description in base class.

See also:

virtual bool gsp::Symbol::parseSymbol LLParser & parser Symbol * & rpReturnSymbol Symbol * pParent ) = 0 
bool BlockToken::parseSymbol ( ini::Parser & parser BlockToken * & rpReturnSymbol , gsp::Symbol * pParent 
Back to index

bool parseSymbol ( ini::Parser & parser BlockToken * & rpReturnSymbol , gsp::Symbol * pParent 

Used internally by the generated code to carry out the parsing of the token. Basically executes the parse code written for this token in the gsp file.

See also:

virtual bool gsp::Symbol::parseSymbol LLParser & parser Symbol * & rpReturnSymbol Symbol * pParent ) = 0 
Back to index

bool parseRoot ( ini::Parser & parser BlockToken * & pReturnSymbol , gsp::Symbol * pParent , bool bBreakOff 

This function attempts to carry out a raw parsing of this symbol using parser, without pre-processing the input stream before.

The symbol is parsed as the root symbol would be, i.e. the line numbering in stream starts counting from zero and it is checked that the end of the stream is encountered if a stream break-off was expected.

pReturnSymbol is the symbol pointer returned by the parsing.

pParent gives the initial parent for the symbol parent to parse. By default it is null, i.e. the symbol is the root and has no parent.

bBreakOff tells whether a stream break-off is expected at the end of the parsing (true by default).

Returns true when the symbol could be successfully parsed, regardless of whether user errors were raised from reduction code. For that purpose, the return value of fail() should also always be checked in parallel to handle these errors.

See also:

virtual bool parse ( std::istream & is , std::ostream & os , gsp::Symbol * pParent = NULL , bool bExpectEOF = false , bool bDeactivatePreprocessing = false ) 
virtual bool parse ( std::istream & is , gsp::Symbol * pParent = NULL , bool bExpectEOF = false , bool bDeactivatePreprocessing = false ) 
bool gsp::Symbol::fail ( ) const 
void gsp::Symbol::error ( std::ostream & os , unsigned long uErrorLineNo , const char * pszFormattedMsg , ... ) 
void gsp::Symbol::error ( std::streampos errorOffset , unsigned int uErrorLineNo 
void gsp::Symbol::fatal ( const char * pszFormattedMsg , ... ) 
Back to index

bool parse ( std::istream & is , std::ostream & os , gsp::Symbol * pParent , bool bExpectEOF , bool bDeactivatePreprocessing   [  virtual  ] 

This function attempts to parse this symbol in a input stream is and error messages are re-directed to output stream os.

pParent gives the initial parent for the symbol parent to parse. By default it is null, i.e. the symbol is the root and has no parent.

bDeactivatePreprocessing tells whether preprocessing should be deactivated before the actual parsing takes place. This argument is optional and is set to false by default.

The symbol is parsed as the root symbol would be, i.e. the line numbering in stream starts counting from zero.

bExpectEOF tells whether to expect an end-of-stream at the end of parsing. This parameter is optional and set to false by default.

This function is useful when the users don't want to parse a stream starting from the root symbol of the grammar, but from whatever else symbol, without having to create by himself the parser object and output possible error messages.

With this function there is no way to get the symbol returned by the reduction code.

Basically, calling this method is equivalent to:

Example:

  ...Parser parser(is);
  ...parser.deactivatePreprocessing(bDeactivatePreprocessing);
  ...parser.preprocess();
  ...parseRoot();

See also:

bool parseRoot ( ini::Parser & parser BlockToken * & pReturnSymbol , gsp::Symbol * pParent = NULL , bool bBreakOff = true ) 
Back to index

bool parse ( std::istream & is , gsp::Symbol * pParent , bool bExpectEOF , bool bDeactivatePreprocessing   [  virtual  ] 

This overloaded function is provided for convenience and behaves like the above function, except that error messages are forced to be output on the standard error output cerr.

Therefore, it is strictly equivalent to calling:

parse(is, cerr, pParent, bDeactivatePreprocessing)

See also:

virtual bool parse ( std::istream & is , std::ostream & os , gsp::Symbol * pParent = NULL , bool bExpectEOF = false , bool bDeactivatePreprocessing = false ) 
virtual bool parse ( std::istream & is , gsp::Symbol * pParent = NULL , bool bExpectEOF = false , bool bDeactivatePreprocessing = false ) 
Back to index

bool expand ( std::ostream & os , bool bRestoreWS   [  virtual  ] 

Expands the token. See documentation of overriden method referred to below.

This method ensures the following:

- If the default/normal expanding was ok and it is the root, the original trailing whitespaces are restored.

- If the token is a composite, the expanding will result of the expanding of all components.

- Return true on success only.

NO end-of-stream char ('\0') is appended to the result string.

See also:

virtual bool gsp::Symbol::expand ( std::ostream & os , bool bRestoreWS = true ) 
Back to index

universal::String expand ( bool bTrimFirstWhitespaces , bool bRestoreWS 

This function is provided for convenience and behaves like the other expand() function, except that :

on failure an empty string is returned;

the first leading whitespaces are removed by default. This can be switched off by setting bTrimFirstWhitespaces to false.

bRestoreWS is also optional and tells whether to restore all whitespaces. This is the case by default. If not so, the value of bTrimFirstWhitespaces is actually overriden and ignored.

See also:

universal::String gsp::Symbol::expand ( bool bTrimFirstWhitespaces = true , bool bRestoreWS = true ) 
Back to index

bool backtrace ( std::ostream & os   [  virtual  ] 

Backtraces the non-terminal.

See also:

virtual bool gsp::Symbol::backtrace ( std::ostream & os ) = 0 
Back to index

bool test ( std::ostream & os , bool bVerbose   [  virtual  ] 

Tests the symbol according to the test cases specified along with with the symbol definition.

For further information please see the test() function of the base symbol class.

See also:

bool gsp::Symbol::test ( std::ostream & os , unsigned long uNbTestCases , universal::String * pasTestCaseNames , universal::String * pasTestCaseInputs , universal::String * pasTestCaseOutputs , bool * pabResults , bool bVerbose 
virtual bool gsp::Symbol::backtrace ( std::ostream & os ) = 0 
void LLParser::outputFailureContext ( std::ostream & os , unsigned long uNbLinesAround = 1 ) 
Back to index

BlockTokenFactory & factory ( )   [  static  ] 

Returns the factory object for such token.

See also:

Back to index

void setFactory BlockTokenFactory * pNewFactory   [  static  ] 

Sets pNewFactory as the new factory object for such token.

The previous factory is not destroyed.

See also:

Back to index

bool is_a ( gsp::Symbol * pSymbol   [  static  ] 

Tells whether the passed symbol pointer narrows to a symbol pointer of this type.

See also:

Back to index

universal::String getSymbolName ( ) const 

Returns the name of this token class.

See also:

Back to index

void reset ( )   [  virtual  ] 

Please refer to the matching overriden method description in base class.

If the token inherits from universal::String, the string is emptied.

See also:

void gsp::Symbol::reset ( ) 
Back to index

bool readBlock ( const char * pszStartDelimiter , const char * pszEndDelimiter , std::istream & is , bool bIgnoreCase   [  protected  ] 

See also:

Back to index


Generated with makedoc.