lestes::lang::cplus::lex::macro_body Class Reference

#include <macro_body.hh>

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

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 object-like macro body
bool parse (const ptr< token_input > &input, const ptr< macro_head > &head)
 parses function-like macro body
ptr< token_sequenceexpand (const ptr< source_location > &loc)
 expands object-like macro
ptr< token_sequenceexpand (const ptr< source_location > &loc, const ptr< macro_arguments > &mas, const ptr< macro_storage > &macros)
 expands function-like macro
state_type state_get (void) const
 returns internal state
bool equals (const ptr< macro_body > &other) const
 tests equality

Static Public Member Functions

static ptr< macro_bodycreate (void)
 returns empty expansion list

Protected Member Functions

 macro_body (void)
 creates empty expansion list
virtual void gc_mark (void)
 Marks the object.

Private Types

typedef ::lestes::std::vector<
srp< macro_item > > 
items_type
 type of list for storing the expansion items

Private Attributes

state_type state
 internal state of the object
srp< items_typeitems
 the list of expansion items

Detailed Description

Representation of macro expansion list.


Member Typedef Documentation

typedef ::lestes::std::vector< srp<macro_item> > lestes::lang::cplus::lex::macro_body::items_type [private]

type of list for storing the expansion items


Member Enumeration Documentation

enum lestes::lang::cplus::lex::macro_body::state_type

type of internal state

Enumerator:
BEGIN 
PARSED 
DEAD 


Constructor & Destructor Documentation

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

creates empty expansion list

Constructs empty expansion list.

Postcondition:
state == BEGIN

items->size() == 0


Member Function Documentation

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

parses object-like macro body

Parses object-like macro replacement list and stores values into self. The input is parsed including the TOK_LINE_END even in case it is ill-formed.

Precondition:
state == BEGIN
Parameters:
input The source for tokens, starting at the beginning of the replacement list.
Returns:
false If the replacement list was ill-formed.

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

parses function-like macro body

Parses function like macro replacement list and stores values into self.

Precondition:
state == BEGIN
Parameters:
input The source for tokens, starting after parameter list.
Returns:
false If the replacement list was ill-formed.

ptr< token_sequence > lestes::lang::cplus::lex::macro_body::expand ( const ptr< source_location > &  loc  ) 

expands object-like macro

Expand this object-like macro body.

Precondition:
state == PARSED
Parameters:
loc The location of the expansion.
Returns:
The expanded, but not rescanned sequence.

ptr< token_sequence > lestes::lang::cplus::lex::macro_body::expand ( const ptr< source_location > &  loc,
const ptr< macro_arguments > &  mas,
const ptr< macro_storage > &  macros 
)

expands function-like macro

Expands this function-like macro body.

Todo:
pt Add error message.

pt Add location setting.

Precondition:
state == PARSED
Parameters:
mas The arguments for the macro.
loc The location of the expansion.
Returns:
The expanded, but not rescanned sequence.

NULL in case of error.

macro_body::state_type lestes::lang::cplus::lex::macro_body::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_body::equals ( const ptr< macro_body > &  other  )  const

tests equality

Tests equality.

Parameters:
other The macro body to compare with.
Returns:
true If both expansion lists have the same order, spelling and whitespace separation of tokens.

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

returns empty expansion list

Returns empty expansion list.

Postcondition:
state == BEGIN
Returns:
The new empty expansion list.

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

Marks the object.

Marks the object.

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


Member Data Documentation

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

internal state of the object

srp<items_type> lestes::lang::cplus::lex::macro_body::items [private]

the list of expansion items


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