lestes::lang::cplus::lex::macro_item Class Reference

Expansion list item. More...

#include <macro_item.hh>

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

Inheritance graph
[legend]
List of all members.

Public Types

enum  action_type {
  LITERAL, EXPANSION, COPY, STR,
  CONCAT
}
 Type of action performed within the item. More...
typedef ulint index_type
 Type of index of macro parameter.

Public Member Functions

action_type action_get (void) const
 Returns action to be performed.
ptr< token_sequencevalue_get (void) const
 Returns value of literal or glue token.
index_type index_get (void) const
 Returns index of referenced macro parameter.
bool blank_get (void) const
 Returns blank flag.
bool equals (const ptr< macro_item > &other) const
 Tests equality.

Static Public Member Functions

static ptr< macro_itemcreate_literal (const ptr< token_sequence > &a_value)
 Returns literal macro item.
static ptr< macro_itemcreate_expansion (index_type a_index)
 Returns expansion macro item.
static ptr< macro_itemcreate_copy (index_type a_index)
 Returns copy macro item.
static ptr< macro_itemcreate_str (index_type a_index, const ptr< token_sequence > &a_value)
 Returns stringification macro item.
static ptr< macro_itemcreate_concat (const ptr< token_sequence > &a_value)
 Returns concatenation macro item.

Protected Member Functions

 macro_item (action_type a_action, index_type a_index, const ptr< token_sequence > &a_value)
 Creates item.
virtual void gc_mark (void)
 Marks the object.

Private Attributes

action_type action
 Action to be performed.
index_type index
 Index of referenced macro parameter.
srp< token_sequencevalue
 Value of literal or operation token wrapped in sequence.

Detailed Description

Expansion list item.

Represents of part of macro expansion list. Used as an element in macro_body.


Member Typedef Documentation

typedef ulint lestes::lang::cplus::lex::macro_item::index_type

Type of index of macro parameter.


Member Enumeration Documentation

enum lestes::lang::cplus::lex::macro_item::action_type

Type of action performed within the item.

Enumerator:
LITERAL  Insert literal value.
EXPANSION  Insert expanded parameter.
COPY  Insert copy of parameter.
STR  Insert stringification of parameter.
CONCAT  Insert concatenation of adjacent tokens.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::macro_item::macro_item ( action_type  a_action,
index_type  a_index,
const ptr< token_sequence > &  a_value 
) [protected]

Creates item.

Creates item object, not all parameters are valid for every action type. No checks of consistency are done on this level.

Parameters:
a_action The action represented by the item.
a_index The index of parameter for expand, nonexpand and stringify actions.
a_value The value of item for literal and operators.


Member Function Documentation

macro_item::action_type lestes::lang::cplus::lex::macro_item::action_get ( void   )  const

Returns action to be performed.

Returns action of the macro item.

Returns:
The action represented by the macro item.

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

Returns value of literal or glue token.

Returns value of stored token sequence literal.

Precondition:
action_get() != EXPANSION && action_get() != COPY
Returns:
The represented value.

macro_item::index_type lestes::lang::cplus::lex::macro_item::index_get ( void   )  const

Returns index of referenced macro parameter.

Returns index of the macro parameter.

Precondition:
action_get() == EXPAND || action_get() == COPY || action_get() == STR
Returns:
The index of macro parameter referenced in action.

bool lestes::lang::cplus::lex::macro_item::blank_get ( void   )  const

Returns blank flag.

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

Tests equality.

Tests equality to other macro item. Only fields relevant for selected actions are compared.

Parameters:
other The macro item to compare with.
Returns:
true If both actions and their respective parameters are equal.

ptr< macro_item > lestes::lang::cplus::lex::macro_item::create_literal ( const ptr< token_sequence > &  a_value  )  [static]

Returns literal macro item.

Returns literal macro item, initializes with a_value.

Precondition:
a_value != NULL
Parameters:
a_value The initialization value.
Returns:
Macro item representing literal.

ptr< macro_item > lestes::lang::cplus::lex::macro_item::create_expansion ( index_type  a_index  )  [static]

Returns expansion macro item.

Returns expansion macro item, initializes with a_index.

Parameters:
a_index The index of referenced parameter.
Returns:
Macro item representing parameter expansion.

ptr< macro_item > lestes::lang::cplus::lex::macro_item::create_copy ( index_type  a_index  )  [static]

Returns copy macro item.

Returns copy macro item, initializes with a_index.

Parameters:
a_index The index of referenced parameter.
Returns:
Macro item representing parameter copy without expansion.

ptr< macro_item > lestes::lang::cplus::lex::macro_item::create_str ( index_type  a_index,
const ptr< token_sequence > &  a_value 
) [static]

Returns stringification macro item.

Returns stringification macro item, initializes with index and blank flag.

Precondition:
a_value != NULL
Parameters:
a_index The index of referenced parameter.
a_value The stringification operator with optional space.
Returns:
Macro item representing parameter stringification.

ptr< macro_item > lestes::lang::cplus::lex::macro_item::create_concat ( const ptr< token_sequence > &  a_value  )  [static]

Returns concatenation macro item.

Returns concatenation macro item, initializes with sequence containing a_token.

Precondition:
a_value != NULL
Parameters:
a_value The concatenation operator.
Returns:
Macro item representing token concatenation

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

Marks the object.

Marks the object.

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


Member Data Documentation

action_type lestes::lang::cplus::lex::macro_item::action [private]

Action to be performed.

index_type lestes::lang::cplus::lex::macro_item::index [private]

Index of referenced macro parameter.

srp<token_sequence> lestes::lang::cplus::lex::macro_item::value [private]

Value of literal or operation token wrapped in sequence.


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