lestes::lang::cplus::lex::string_joiner Class Reference

String literal joining filter. More...

#include <string_joiner.hh>

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

Inheritance graph
[legend]
List of all members.

Public Member Functions

ptr< pp_tokenread (void)
 Reads next token.

Static Public Member Functions

static ptr< string_joinercreate (const ptr< pp_filter > &a_input)
 Returns new instance.

Protected Member Functions

 string_joiner (const ptr< pp_filter > &a_input)
 Creates the object.
virtual void gc_mark (void)
 Marks the object.

Private Types

enum  state_type {
  START = 0, FIRST_STRING = 1, NEXT_STRING = 2, FIRST_WIDE_STRING = 3,
  NEXT_WIDE_STRING = 4, NEXT_BAD_STRING = 5, SAVED = 6
}
 States of the processor. More...
typedef ::lestes::std::vector<
srp< pp_token > > 
sequence_type
 Type of sequence of adjacent literals.

Private Member Functions

ptr< pp_tokenjoin_sequence (pp_token_type ptt) const
 Returns joined string literal.
 string_joiner (const string_joiner &)
 Hides copy constructor.
string_joineroperator= (const string_joiner &)
 Hides assignment operator.

Private Attributes

state_type state
 Current state of the processor.
srp< pp_tokensaved
 Buffered token.
srp< sequence_typesequence
 Current sequence of adjacent literals.

Detailed Description

String literal joining filter.

Performs joining of adjacent string literals and adjacent wide string literals.


Member Typedef Documentation

typedef ::lestes::std::vector< srp<pp_token> > lestes::lang::cplus::lex::string_joiner::sequence_type [private]

Type of sequence of adjacent literals.


Member Enumeration Documentation

enum lestes::lang::cplus::lex::string_joiner::state_type [private]

States of the processor.

Enumerator:
START  No tokens in buffer.
FIRST_STRING  Read first string.
NEXT_STRING  Reading string sequence.
FIRST_WIDE_STRING  Read first wide string.
NEXT_WIDE_STRING  Reading wide string sequence.
NEXT_BAD_STRING  Reading mixed string and wide string sequence.
SAVED  Ordinary token saved in buffer.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::string_joiner::string_joiner ( const ptr< pp_filter > &  a_input  )  [protected]

Creates the object.

Creates the object.

Precondition:
a_input != NULL
Parameters:
a_input The input for the filter.
Postcondition:
state == START

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

Hides copy constructor.


Member Function Documentation

ptr< pp_token > lestes::lang::cplus::lex::string_joiner::read ( void   )  [virtual]

Reads next token.

Reads next token from input. Joins all adjacent string literal tokens into single string literal token. Joins all adjacent normal and wide string literal tokens into single wide string literal token.

Implements lestes::lang::cplus::lex::pp_filter.

ptr< string_joiner > lestes::lang::cplus::lex::string_joiner::create ( const ptr< pp_filter > &  a_input  )  [static]

Returns new instance.

Returns new instance.

Precondition:
a_input != NULL
Parameters:
a_input The input for the filter.
Returns:
New instance of the class.

void lestes::lang::cplus::lex::string_joiner::gc_mark ( void   )  [protected, virtual]

Marks the object.

Marks the object.

Reimplemented from lestes::lang::cplus::lex::pp_filter.

ptr< pp_token > lestes::lang::cplus::lex::string_joiner::join_sequence ( pp_token_type  ptt  )  const [private]

Returns joined string literal.

Returns token containing joined string literals. Does not affect the contents of the sequence.

Precondition:
The sequence is not empty.

The sequence contains tokens of one type, either pp_token::TOK_STRING_LIT or pp_token::TOK_WSTRING_LIT. The location for the new token is taken from the first entry.

Parameters:
ptt The type of the new token.
Returns:
String or wide string literal token.

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

Hides assignment operator.


Member Data Documentation

state_type lestes::lang::cplus::lex::string_joiner::state [private]

Current state of the processor.

srp<pp_token> lestes::lang::cplus::lex::string_joiner::saved [private]

Buffered token.

srp<sequence_type> lestes::lang::cplus::lex::string_joiner::sequence [private]

Current sequence of adjacent literals.


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