lestes::lang::cplus::lex::macro_head Class Reference

Macro parameter list. More...

#include <macro_head.hh>

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

Inheritance graph
[legend]
List of all members.

Public Types

enum  state_type { BEGIN, PARSED, DEAD }
 Type of internal state. More...

Public Member Functions

bool parse (const ptr< token_input > &input)
 Parses macro parameter list.
ulint index_of (const ptr< token_value > &a_value) const
 Returns index of parameter.
ulint length (void) const
 Returns list length.
state_type state_get (void) const
 Returns internal state.
bool equals (const ptr< macro_head > &other) const
 Tests equality.

Static Public Member Functions

static ptr< macro_headcreate (void)
 Returns empty parameter list.

Protected Member Functions

 macro_head (void)
 Creates empty parameter list.
virtual void gc_mark (void)
 Marks the object.

Private Types

typedef ::lestes::std::map<
srp< token_value >, ulint,
token_value::compare_less
pars_type
 Type of map for storing the parameters.

Private Member Functions

bool add_param (const ptr< token_value > &a_value)
 Adds parameter to list.

Private Attributes

state_type state
 Internal state of the object.
srp< pars_typepars
 Map of parameters to indexes.

Detailed Description

Macro parameter list.

Representation of indexed macro parameter list. The parameter names are added at the end and can be searched for.


Member Typedef Documentation

typedef ::lestes::std::map< srp<token_value>,ulint,token_value::compare_less > lestes::lang::cplus::lex::macro_head::pars_type [private]

Type of map for storing the parameters.


Member Enumeration Documentation

enum lestes::lang::cplus::lex::macro_head::state_type

Type of internal state.

Enumerator:
BEGIN 
PARSED 
DEAD 


Constructor & Destructor Documentation

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

Creates empty parameter list.

Constructs empty parameter list.

Postcondition:
state == BEGIN

length() == 0

pars->size() == 0


Member Function Documentation

bool lestes::lang::cplus::lex::macro_head::parse ( const ptr< token_input > &  input  ) 

Parses macro parameter list.

Parses macro parameter list.

Precondition:
state == BEGIN

input != NULL

Parameters:
input The source for tokens, starting after left parenthesis.
Returns:
false In case of duplicate parameters or unterminated parameter list.

ulint lestes::lang::cplus::lex::macro_head::index_of ( const ptr< token_value > &  a_value  )  const

Returns index of parameter.

Returns index of parameter in list.

Precondition:
state == PARSED

a_value != NULL

Returns:
The index of the parameter, length() if parameter is not present.

ulint lestes::lang::cplus::lex::macro_head::length ( void   )  const

Returns list length.

Returns length of the parameter list, which is also a special return value in index_of method.

Precondition:
state == PARSED
Returns:
Length of the parameter list.

macro_head::state_type lestes::lang::cplus::lex::macro_head::state_get ( void   )  const

Returns internal state.

Returns internal state of the object.

Returns:
The internal state of the object.

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

Tests equality.

Tests equality to other macro head.

Parameters:
other The macro head to compare with.
Returns:
true If both parameter lists have the same length and spelling.

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

Returns empty parameter list.

Returns empty macro head.

Postcondition:
state == BEGIN
Returns:
A new empty instance of macro head.

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

Marks the object.

Marks the object.

Reimplemented from lestes::std::mem::keystone.

bool lestes::lang::cplus::lex::macro_head::add_param ( const ptr< token_value > &  a_value  )  [private]

Adds parameter to list.

Adds parameter to list.

Precondition:
a_value != NULL
Parameters:
a_value Value to be added as parameter.
Returns:
false If the value was already present in the list.


Member Data Documentation

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

Internal state of the object.

srp<pars_type> lestes::lang::cplus::lex::macro_head::pars [private]

Map of parameters to indexes.


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