lestes::lang::cplus::lex::macro_arguments Class Reference

Macro argument list. More...

#include <macro_arguments.hh>

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

Inheritance graph
[legend]
List of all members.

Public Member Functions

bool parse (const ptr< token_input > &input)
 Parses argument list.
ulint length (void) const
 Returns length of the list.
ptr< macro_argumentargument_get (ulint index) const
 Returns argument at specified index.
bool check (ulint pars_length) const
 Checks if the arguments match parameter list length.

Static Public Member Functions

static ptr< macro_argumentscreate (void)
 Returns empty list.

Protected Member Functions

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

Private Types

enum  state_type { BEGIN, PARSED, PARSED_EMPTY, DEAD }
 Type of internal state. More...
typedef vector< srp< macro_argument > > arguments_type
 Type of list of macro arguments.

Private Attributes

state_type state
 Internal state of the object.
srp< arguments_typearguments
 List of macro arguments.

Detailed Description

Macro argument list.

Represents list of macro arguments. Arguments can be empty, which introduces certain ambiguity when dealing with single empty argument, which is the same as no argument at all. Such argument list has state == PARSED_EMPTY, length() == 1 and one empty argument.


Member Typedef Documentation

typedef vector< srp<macro_argument> > lestes::lang::cplus::lex::macro_arguments::arguments_type [private]

Type of list of macro arguments.


Member Enumeration Documentation

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

Type of internal state.

Enumerator:
BEGIN 
PARSED 
PARSED_EMPTY 
DEAD 


Constructor & Destructor Documentation

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

Creates empty list.

Creates empty list.

Postcondition:
state == BEGIN

length() == 0


Member Function Documentation

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

Parses argument list.

Parses macro argument list in parentheses.

Precondition:
state == BEGIN
Parameters:
input The source for arguments, starting with '(' token.
Returns:
false In case of parse error.

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

Returns length of the list.

Returns length of the argument list.

Precondition:
state == PARSED || state == PARSED_EMPTY
Returns:
Length of the argument list.

ptr< macro_argument > lestes::lang::cplus::lex::macro_arguments::argument_get ( ulint  index  )  const

Returns argument at specified index.

Returns argument at specified position.

Precondition:
state == PARSED || state == PARSED_EMPTY

index < length()

Parameters:
index The index of the desired argument.
Returns:
The argument at specified index.

bool lestes::lang::cplus::lex::macro_arguments::check ( ulint  pars_length  )  const

Checks if the arguments match parameter list length.

Checks whether the arguments match the length of a parameter list. Either the lengths are the same, or there is no parameters and the argument list is empty.

Precondition:
state == PARSED || state == PARSED_EMPTY
pars_length The length of the checked parameter list.
Returns:
true If the length matches or state == PARSED_EMPTY and pars_length == 0.

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

Returns empty list.

Returns new empty argument list.

Postcondition:
state == BEGIN

length() == 0

void lestes::lang::cplus::lex::macro_arguments::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_arguments::state [private]

Internal state of the object.

srp<arguments_type> lestes::lang::cplus::lex::macro_arguments::arguments [private]

List of macro arguments.


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