#include <unary.h>
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_unary & | operator= (const expression_dispatcher_unary &) |
Private Attributes | |
| const char * | operator_name |
| size_t | length |
| size_t | maximum |
| dispatch_t * | item |
Classes | |
| class | dispatch_t |
Definition at line 35 of file unary.h.
| 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.
| operand | The expression to be tested. Usually this test for type, but it could test for l-values, or anything else. |
| typedef expression::pointer(translator::*) expression_dispatcher_unary::factory_t(const expression::pointer &operand) |
| 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.
The push_back method is used to append another {test, method} tuple to the end of the list of possibilities.
| 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.
| operand | The operand of the new expression node. | |
| context | The translator context for the new expression node. |
| 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.
| arg | The row to be appended. |
| expression_dispatcher_unary& expression_dispatcher_unary::operator= | ( | const expression_dispatcher_unary & | ) | [private] |
The assignment operator.
const char* expression_dispatcher_unary::operator_name [private] |
size_t expression_dispatcher_unary::length [private] |
size_t expression_dispatcher_unary::maximum [private] |
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.
1.5.1