lestes::lang::cplus::lex::token_sequence Class Reference

#include <token_sequence.hh>

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

Inheritance graph
[legend]
List of all members.

Public Types

typedef sequence_type::size_type size_type
 The type for size of the sequence.

Public Member Functions

ptr< pp_tokenread (void)
 Reads first token.
ptr< pp_tokenpeek_front (void)
 Returns front token.
ptr< pp_tokenpeek_back (void)
 Returns back token.
ptr< pp_tokenread_front (void)
 Reads front token, squeezing whitespace.
ptr< pp_tokenread_front_skip_ws (void)
 Reads front token, skipping front whitespace, but not newline.
ptr< pp_tokenread_back (void)
 Reads back token, squeezing whitespace.
ptr< pp_tokenread_back_skip_ws (void)
 Reads back token, skipping back whitespace, but not newline.
bool skip_front_ws (void)
 skips back whitespace
bool skip_back_ws (void)
 skips back whitespace
void add_back (const ptr< pp_token > &t)
 Adds token to back.
void prepend (const ptr< token_sequence > &ts)
 Prepends another sequence.
void append (const ptr< token_sequence > &inserted)
 Appends another sequence.
void taboo_extend (const ptr< taboo_macros > &tm, const ptr< macro_storage > &macros)
 Extends taboo set for tokens in sequence.
ptr< token_sequenceexpand_all (const ptr< macro_storage > &macros)
 completely expands all macros within sequence
ptr< token_sequenceclone (void) const
 Clones the sequence.
ptr< token_sequenceclone (const ptr< source_location > &a_location) const
 clones the sequence with new location.
size_type length (void) const
 Returns length of the sequence.
bool equals (const ptr< token_sequence > &other) const
 Tests equality.
bool congruent (const ptr< token_sequence > &other) const
 Tests congruence.
void debug_print (::std::ostream &o) const
 TODO prints debug dump.

Static Public Member Functions

static ptr< token_sequencecreate (void)
 Returns empty sequence.

Protected Member Functions

 token_sequence (void)
 Creates empty sequence.
virtual void gc_mark (void)
 Marks the object.

Private Types

typedef ::lestes::std::list<
srp< pp_token > > 
sequence_type
 The type of sequence container.

Private Attributes

srp< sequence_typesequence
 The sequence container.

Friends

class token_stream
 For direct acces to sequence in prepend().

Detailed Description

Represents sequence of tokens, with access at both ends.


Member Typedef Documentation

typedef ::lestes::std::list< srp<pp_token> > lestes::lang::cplus::lex::token_sequence::sequence_type [private]

The type of sequence container.

typedef sequence_type::size_type lestes::lang::cplus::lex::token_sequence::size_type

The type for size of the sequence.

Author:
TMA


Constructor & Destructor Documentation

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

Creates empty sequence.

Constructs new empty sequence.

Postcondition:
length() == 0


Member Function Documentation

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

Reads first token.

Reads front token, does no transformation.

Returns:
The first token in the sequence.

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

ptr< pp_token > lestes::lang::cplus::lex::token_sequence::peek_front ( void   )  [virtual]

Returns front token.

Returns front token, which is kept in the sequence.

Returns:
The first token in the sequence, or TOK_TERMINATOR.

Implements lestes::lang::cplus::lex::token_input.

ptr< pp_token > lestes::lang::cplus::lex::token_sequence::peek_back ( void   ) 

Returns back token.

Returns back token, which is kept in the sequence.

Returns:
The last token in the sequence, or TOK_TERMINATOR.

ptr< pp_token > lestes::lang::cplus::lex::token_sequence::read_front ( void   )  [virtual]

Reads front token, squeezing whitespace.

Reads front token, squeezing multiple blanks into one.

Returns:
The first token in the sequence.

Implements lestes::lang::cplus::lex::token_input.

ptr< pp_token > lestes::lang::cplus::lex::token_sequence::read_front_skip_ws ( void   )  [virtual]

Reads front token, skipping front whitespace, but not newline.

Reads front token, skipping front whitespace, but not newline.

Returns:
The first non-whitespace token in the sequence, or TOK_TERMINATOR.

Implements lestes::lang::cplus::lex::token_input.

ptr< pp_token > lestes::lang::cplus::lex::token_sequence::read_back ( void   ) 

Reads back token, squeezing whitespace.

Reads back token, squeezing blanks.

Returns:
The last token in the sequence, or TOK_TERMINATOR.

ptr< pp_token > lestes::lang::cplus::lex::token_sequence::read_back_skip_ws ( void   ) 

Reads back token, skipping back whitespace, but not newline.

Reads back token, skipping back whitespace.

Precondition:
The sequence contains non-whitespace tokens.
Returns:
The last non-whitespace token in the sequence.

bool lestes::lang::cplus::lex::token_sequence::skip_front_ws ( void   )  [virtual]

skips back whitespace

Skips front whitespace.

Returns:
true If there are some tokens left in the sequence.

Implements lestes::lang::cplus::lex::token_input.

bool lestes::lang::cplus::lex::token_sequence::skip_back_ws ( void   ) 

skips back whitespace

Skips back whitespace.

Returns:
true If there are some tokens left in the sequence.

void lestes::lang::cplus::lex::token_sequence::add_back ( const ptr< pp_token > &  a_token  ) 

Adds token to back.

Adds token to back of the sequence.

Precondition:
a_token != NULL
Parameters:
a_token The token to add.

void lestes::lang::cplus::lex::token_sequence::prepend ( const ptr< token_sequence > &  inserted  ) 

Prepends another sequence.

Inserts another token sequence before the beginning of the sequence.

Precondition:
inserted != NULL
Postcondition:
inserted->length() == 0
Parameters:
inserted The sequence to insert, the content is moved into new place.

void lestes::lang::cplus::lex::token_sequence::append ( const ptr< token_sequence > &  inserted  ) 

Appends another sequence.

Inserts another token sequence after the end of the sequence.

Precondition:
inserted != NULL
Postcondition:
inserted->length() == 0
Parameters:
inserted The sequence to insert, the content is moved into new place.

void lestes::lang::cplus::lex::token_sequence::taboo_extend ( const ptr< taboo_macros > &  tm,
const ptr< macro_storage > &  macros 
)

Extends taboo set for tokens in sequence.

Extends taboo set for possibly expandable tokens in sequence by a macro.

Precondition:
a_macro != NULL

macros != NULL

Parameters:
a_macro The macro to add to the taboo set.
macros The defined macros.

ptr< token_sequence > lestes::lang::cplus::lex::token_sequence::expand_all ( const ptr< macro_storage > &  macros  ) 

completely expands all macros within sequence

Expands macros within sequence. The sequence is discarded.

Precondition:
macros != NULL
Postcondition:
length() == 0
Parameters:
macros The macros for expansion.
Returns:
The expanded tokens in a new sequence.

ptr< token_sequence > lestes::lang::cplus::lex::token_sequence::clone ( void   )  const

Clones the sequence.

Returns copy of the sequence.

Postcondition:
is_equal(returned,this)
Returns:
New sequence with equal values.

ptr< token_sequence > lestes::lang::cplus::lex::token_sequence::clone ( const ptr< source_location > &  a_location  )  const

clones the sequence with new location.

Returns a copy of the sequence with new location.

Precondition:
a_location != NULL
Parameters:
a_location The location for the copied tokens.
Returns:
The copy of the sequence.

token_sequence::size_type lestes::lang::cplus::lex::token_sequence::length ( void   )  const

Returns length of the sequence.

Returns length of the sequence.

Returns:
The length of the sequence.

bool lestes::lang::cplus::lex::token_sequence::equals ( const ptr< token_sequence > &  other  )  const

Tests equality.

Tests equality to other token sequence.

Parameters:
other The token sequence to compare with.
Returns:
true If both sequences contain equal tokens.

bool lestes::lang::cplus::lex::token_sequence::congruent ( const ptr< token_sequence > &  other  )  const

Tests congruence.

Tests whether sequences have the same type and spelling of tokens.

Parameters:
other The token sequence to compare with.
Returns:
true If both sequences contain interchangeable tokens.

void lestes::lang::cplus::lex::token_sequence::debug_print ( ::std::ostream &  o  )  const

TODO prints debug dump.

ptr< token_sequence > lestes::lang::cplus::lex::token_sequence::create ( void   )  [static]

Returns empty sequence.

Returns empty token sequence.

Returns:
Empty token sequence.

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

Marks the object.

Marks the object.

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


Friends And Related Function Documentation

friend class token_stream [friend]

For direct acces to sequence in prepend().


Member Data Documentation

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

The sequence container.


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