expression_dispatcher_unary Class Reference

#include <unary.h>

List of all members.

Public Types

typedef bool(*) test_t (const expression::pointer &operand)
typedef expression::pointer(translator::*) factory_t (const expression::pointer &operand)

Public Member Functions

virtual ~expression_dispatcher_unary ()
 expression_dispatcher_unary (const char *operator_name)
void push_back (test_t operand_test, factory_t factory)
expression::pointer dispatch (const expression::pointer &operand, translator *context) const

Private Member Functions

void push_back (const dispatch_t &arg)
 expression_dispatcher_unary ()
 expression_dispatcher_unary (const expression_dispatcher_unary &)
expression_dispatcher_unaryoperator= (const expression_dispatcher_unary &)

Private Attributes

const char * operator_name
size_t length
size_t maximum
dispatch_titem

Classes

class  dispatch_t


Detailed Description

The expression_dispatcher_unary class is used to represent a list of expression factories, to be conditionally applied when a pair of expressions is supplied. The first match is used.

Definition at line 35 of file unary.h.


Member Typedef Documentation

typedef bool(*) expression_dispatcher_unary::test_t(const expression::pointer &operand)

The test_t type is a convenience typedef, to make the code easier to read. It is a pointer to a function.

Parameters:
operand The expression to be tested. Usually this test for type, but it could test for l-values, or anything else.
Returns:
bool; true if the test is fulfilled, false if not.

Definition at line 58 of file unary.h.

typedef expression::pointer(translator::*) expression_dispatcher_unary::factory_t(const expression::pointer &operand)

The factory_t is a convenience typedef, to make the code easier to read. It is a pointer to a class translator method.

Parameters:
operand The operand expression of the new expression node.
Returns:
a new expression node instance

Definition at line 69 of file unary.h.


Constructor & Destructor Documentation

virtual expression_dispatcher_unary::~expression_dispatcher_unary (  )  [virtual]

The destructor.

expression_dispatcher_unary::expression_dispatcher_unary ( const char *  operator_name  ) 

The constructor.

expression_dispatcher_unary::expression_dispatcher_unary (  )  [private]

The default constructor.

expression_dispatcher_unary::expression_dispatcher_unary ( const expression_dispatcher_unary  )  [private]

The copy constructor.


Member Function Documentation

void expression_dispatcher_unary::push_back ( test_t  operand_test,
factory_t  factory 
)

The push_back method is used to append another {test, method} tuple to the end of the list of possibilities.

Parameters:
operand_test The test to be applied to the left hand expression.
factory The translator factory method to be called if the left and right tests succeed.

expression::pointer expression_dispatcher_unary::dispatch ( const expression::pointer operand,
translator context 
) const

The dispatch method is used to manufacture a new expression node instance, based on the dispatch table built by push_back method calls, and the expression given.

If either of the left or right expressions are an error expression, an error expression will be returned.

If none of the rows in the dispatch table match, an error will be reported via pascal_lex_error, and an error expression will be returned.

Parameters:
operand The operand of the new expression node.
context The translator context for the new expression node.
Returns:
a new expression node instance

void expression_dispatcher_unary::push_back ( const dispatch_t arg  )  [private]

The push_back method is used to add another row to the end of the dispatch table.

Parameters:
arg The row to be appended.

expression_dispatcher_unary& expression_dispatcher_unary::operator= ( const expression_dispatcher_unary  )  [private]

The assignment operator.


Member Data Documentation

const char* expression_dispatcher_unary::operator_name [private]

The operator_name instance variable is used to remember the name of the operator this dispatch table applies to. This name will be used for error messages.

Definition at line 197 of file unary.h.

size_t expression_dispatcher_unary::length [private]

The length instance variable is used to remember how many entries are present in the dispatch table.

Definition at line 203 of file unary.h.

size_t expression_dispatcher_unary::maximum [private]

The maximum instance variable is used to remember how many entries have been allocated in the dispatch table.

Definition at line 209 of file unary.h.

dispatch_t* expression_dispatcher_unary::item [private]

The operator_name instance variable is used to remember the base address of the dynamically allocated array of dispatch_t rows.

Definition at line 215 of file unary.h.


The documentation for this class was generated from the following file:
Generated on Sun Feb 25 01:27:11 2007 for UCSDp-SystemCrossCompiler by  doxygen 1.5.1