lestes::lang::cplus::lex::stringifier Class Reference

Token stringifier. More...

#include <stringifier.hh>

Inheritance diagram for lestes::lang::cplus::lex::stringifier:

Inheritance graph
[legend]
List of all members.

Public Member Functions

ptr< pp_tokenprocess (const ptr< token_input > &input)
 Stringifies tokens.

Static Public Member Functions

static ptr< stringifierinstance (void)
 Returns the only instance.

Protected Member Functions

 stringifier (void)
 Creates the object.

Private Member Functions

ucn_string escape_spelling (const ptr< pp_token > &tok)
 Adds guard characters to disable escape sequences.
 stringifier (const stringifier &)
 Hides copy constructor.
stringifieroperator= (const stringifier &)
 Hides assignment operator.

Static Private Attributes

static ptr< stringifiersingleton
 The only instance of the class.

Detailed Description

Token stringifier.

Performs token stringification.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::stringifier::stringifier ( void   )  [protected]

Creates the object.

Creates the only object of the class.

lestes::lang::cplus::lex::stringifier::stringifier ( const stringifier  )  [private]

Hides copy constructor.


Member Function Documentation

ptr< pp_token > lestes::lang::cplus::lex::stringifier::process ( const ptr< token_input > &  input  ) 

Stringifies tokens.

Attempts to stringify tokens. Creates new token of type pp_token::TOK_STRING_LIT, with location taken from the first nonblank input token and value representing joined stringification of all input tokens, with character and string literals escaped. Runs of blank tokens inside the sequence are represented by single space, surrounding blanks are discarded.

Precondition:
input != NULL
Todo:
pt necessary? pre input does not contain pp_token::TOK_LINE_END tokens.
Parameters:
input The tokens to stringify.
Returns:
New token containing the stringification, no correctness checks are done.

ptr< stringifier > lestes::lang::cplus::lex::stringifier::instance ( void   )  [static]

Returns the only instance.

Returns the only instance. Lazy initialized.

Returns:
The singleton.

ucn_string lestes::lang::cplus::lex::stringifier::escape_spelling ( const ptr< pp_token > &  tok  )  [private]

Adds guard characters to disable escape sequences.

Adds guard backslash characters before double quotes and backslash characters into the spelling of string, character and other literals to avoid interpreting them as escape sequences. Spelling of tokens with other types are returned intact.

Precondition:
tok != NULL
Parameters:
tok The token to process.
Returns:
The spelling string with special characters escaped.

stringifier& lestes::lang::cplus::lex::stringifier::operator= ( const stringifier  )  [private]

Hides assignment operator.


Member Data Documentation

ptr< stringifier > lestes::lang::cplus::lex::stringifier::singleton [static, private]

The only instance of the class.

The only instance of the class. Lazy initialized in the instance() method.


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:43:52 2007 for lestes by doxygen 1.5.1-20070107