TreeChecker Class Reference#include <tree_checker.h>
Inheritance diagram for TreeChecker:
List of all members.
|
Public Types |
enum | Order { Preorder,
Postorder,
Both
} |
| The order in which AST Nodes should be visited. More...
|
enum | Depth { Subtree,
NodeOnly
} |
| Which Nodes in the AST tree should be visited. More...
|
Public Member Functions |
| TreeChecker () |
| TreeChecker (bool verbose, bool warning) |
virtual | ~TreeChecker () |
virtual void | at_node (Node *, Order) |
virtual void | at_unit (unitNode *, Order) |
virtual void | at_proc (procNode *, Order) |
virtual void | at_decl (declNode *, Order) |
virtual void | at_label (labelNode *, Order) |
virtual void | at_case (caseNode *, Order) |
virtual void | at_goto (gotoNode *, Order) |
virtual void | at_conditiongoto (conditiongotoNode *, Order) |
virtual void | at_break (breakNode *, Order) |
virtual void | at_continue (continueNode *, Order) |
virtual void | at_return (returnNode *, Order) |
virtual void | at_if (ifNode *, Order) |
virtual void | at_switch (switchNode *, Order) |
virtual void | at_for (forNode *, Order) |
virtual void | at_loop (loopNode *, Order) |
virtual void | at_call (callNode *, Order) |
virtual void | at_id (idNode *, Order) |
virtual void | at_const (constNode *, Order) |
virtual void | at_unary (unaryNode *, Order) |
virtual void | at_binary (binaryNode *, Order) |
virtual void | at_ternary (ternaryNode *, Order) |
virtual void | at_threeAddr (threeAddrNode *, Order) |
virtual void | at_operand (operandNode *, Order) |
virtual void | at_cast (castNode *, Order) |
virtual void | at_comma (commaNode *, Order) |
virtual void | at_initializer (initializerNode *, Order) |
virtual void | at_type (typeNode *, Order) |
virtual void | at_func (funcNode *, Order) |
virtual void | at_tdef (tdefNode *, Order) |
virtual void | at_array (arrayNode *, Order) |
|
Methods to get and set fields in the class.
|
Order | order () const |
| Return the order in which Nodes of an AST should be visited.
|
Depth | depth () const |
| Return which Nodes of an AST should be visited.
|
|
These methods define the functions that should be performed when different classes of Nodes are encountered in the AST. The most specific "at_" method that matches a given Node's class will be called.
|
virtual void | at_def (defNode *the_def, Order ord) |
virtual void | at_subdecl (subdeclNode *the_subdecl, Order ord) |
virtual void | at_prim (primNode *the_prim, Order ord) |
virtual void | at_ptr (ptrNode *the_ptr, Order ord) |
virtual void | at_sue (sueNode *the_sue, Order ord) |
virtual void | at_struct (structNode *the_struct, Order ord) |
virtual void | at_union (unionNode *the_union, Order ord) |
virtual void | at_enum (enumNode *the_enum, Order ord) |
virtual void | at_suespec (suespecNode *the_suespec, Order ord) |
virtual void | at_expr (exprNode *the_expr, Order ord) |
virtual void | at_index (indexNode *the_index, Order ord) |
virtual void | at_stmt (stmtNode *the_stmt, Order ord) |
virtual void | at_block (blockNode *the_block, Order ord) |
virtual void | at_basicblock (basicblockNode *the_basicblock, Order ord) |
virtual void | at_exprstmt (exprstmtNode *the_exprstmt, Order ord) |
virtual void | at_target (targetNode *the_target, Order ord) |
virtual void | at_selection (selectionNode *the_selection, Order ord) |
virtual void | at_while (whileNode *the_while, Order ord) |
virtual void | at_do (doNode *the_do, Order ord) |
virtual void | at_jump (jumpNode *the_jump, Order ord) |
virtual void | at_attrib (attribNode *the_attrib, Order ord) |
virtual void | at_text (textNode *the_text, Order ord) |
Static Public Member Functions |
static void | check () |
static void | check (unitNode *) |
Private Member Functions |
void | setPreDismantled (const char *, Node *) |
void | setPostDismantled (const char *, Node *) |
void | checkTree (Node *n, const char *type) |
void | checkField (Node *node, Node *field, const char *type, const char *fieldName, bool isError=true) |
void | checkString (Node *node, string &field, const char *type, const char *fieldName, bool isError=true) |
void | checkConstant (Node *node, constant &field, const char *type, const char *fieldName, bool isError=true) |
template<class T> |
void | checkOperator (Node *node, Operator *field, const char *type, const char *fieldName, T check, string desc, bool isError=true) |
template<class T> |
void | checkFieldInList (Node *node, T field, const char *type, const char *fieldName, list< T > &collection, bool isError=true) |
template<class T> |
void | checkList (Node *node, list< T > &field, const char *type, const char *fieldName, bool isError=true) |
template<class T> |
void | checkFieldInList (Node *node, list< T > &field, const char *type, const char *fieldName, int count, list< T > &collection, const char *itemName, bool isError=true) |
Private Attributes |
map< Node *, int > | _visitedNodes |
goto_list | _gotos |
label_list | _labels |
proc_list | _procs |
proc_list | _dupProcs |
switch_list | _switches |
decl_list | _decls |
map< labelNode *, int > | _gotoCount |
map< string, int > | _formals |
int | _typeDepth |
int | _arrayDepth |
bool | _in_proc |
bool | _verbose |
bool | _warning |
bool | _preDismantled |
bool | _postDismantled |
int | _errorCount |
Member Enumeration Documentation
|
Which Nodes in the AST tree should be visited.
- Enumeration values:
-
Subtree |
The entire AST should be traversed. |
NodeOnly |
Only the root Node should be visited. |
Definition at line 155 of file walker.h. |
|
The order in which AST Nodes should be visited.
- Enumeration values:
-
Preorder |
Nodes should be visited before their children. |
Postorder |
Nodes should be visited after their children. |
Both |
Nodes should be visited both before and after their children. |
Definition at line 147 of file walker.h. |
Constructor & Destructor Documentation
TreeChecker::TreeChecker |
( |
|
) |
|
|
TreeChecker::TreeChecker |
( |
bool |
verbose, |
|
|
bool |
warning |
|
) |
|
|
virtual TreeChecker::~TreeChecker |
( |
|
) |
[virtual] |
|
Member Function Documentation
virtual void Walker::at_attrib |
( |
attribNode * |
the_attrib, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_basicblock |
( |
basicblockNode * |
the_basicblock, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_block |
( |
blockNode * |
the_block, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void TreeChecker::at_call |
( |
callNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void TreeChecker::at_case |
( |
caseNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void TreeChecker::at_cast |
( |
castNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void TreeChecker::at_decl |
( |
declNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_def |
( |
defNode * |
the_def, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_do |
( |
doNode * |
the_do, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_enum |
( |
enumNode * |
the_enum, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_expr |
( |
exprNode * |
the_expr, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_exprstmt |
( |
exprstmtNode * |
the_exprstmt, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void TreeChecker::at_for |
( |
forNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void TreeChecker::at_func |
( |
funcNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void TreeChecker::at_goto |
( |
gotoNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void TreeChecker::at_id |
( |
idNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void TreeChecker::at_if |
( |
ifNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_index |
( |
indexNode * |
the_index, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_jump |
( |
jumpNode * |
the_jump, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void TreeChecker::at_loop |
( |
loopNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void TreeChecker::at_node |
( |
Node * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_prim |
( |
primNode * |
the_prim, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void TreeChecker::at_proc |
( |
procNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_ptr |
( |
ptrNode * |
the_ptr, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_selection |
( |
selectionNode * |
the_selection, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_stmt |
( |
stmtNode * |
the_stmt, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_struct |
( |
structNode * |
the_struct, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_subdecl |
( |
subdeclNode * |
the_subdecl, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_sue |
( |
sueNode * |
the_sue, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_suespec |
( |
suespecNode * |
the_suespec, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void Walker::at_target |
( |
targetNode * |
the_target, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void TreeChecker::at_tdef |
( |
tdefNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_text |
( |
textNode * |
the_text, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void TreeChecker::at_type |
( |
typeNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_union |
( |
unionNode * |
the_union, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
virtual void TreeChecker::at_unit |
( |
unitNode * |
, |
|
|
Order |
|
|
) |
[virtual] |
|
virtual void Walker::at_while |
( |
whileNode * |
the_while, |
|
|
Order |
ord |
|
) |
[inline, virtual, inherited] |
|
static void TreeChecker::check |
( |
unitNode * |
|
) |
[static] |
|
static void TreeChecker::check |
( |
|
) |
[static] |
|
void TreeChecker::checkConstant |
( |
Node * |
node, |
|
|
constant & |
field, |
|
|
const char * |
type, |
|
|
const char * |
fieldName, |
|
|
bool |
isError = true |
|
) |
[private] |
|
void TreeChecker::checkField |
( |
Node * |
node, |
|
|
Node * |
field, |
|
|
const char * |
type, |
|
|
const char * |
fieldName, |
|
|
bool |
isError = true |
|
) |
[private] |
|
template<class T> |
void TreeChecker::checkFieldInList |
( |
Node * |
node, |
|
|
list< T > & |
field, |
|
|
const char * |
type, |
|
|
const char * |
fieldName, |
|
|
int |
count, |
|
|
list< T > & |
collection, |
|
|
const char * |
itemName, |
|
|
bool |
isError = true |
|
) |
[private] |
|
template<class T> |
void TreeChecker::checkFieldInList |
( |
Node * |
node, |
|
|
T |
field, |
|
|
const char * |
type, |
|
|
const char * |
fieldName, |
|
|
list< T > & |
collection, |
|
|
bool |
isError = true |
|
) |
[private] |
|
template<class T> |
void TreeChecker::checkList |
( |
Node * |
node, |
|
|
list< T > & |
field, |
|
|
const char * |
type, |
|
|
const char * |
fieldName, |
|
|
bool |
isError = true |
|
) |
[private] |
|
template<class T> |
void TreeChecker::checkOperator |
( |
Node * |
node, |
|
|
Operator * |
field, |
|
|
const char * |
type, |
|
|
const char * |
fieldName, |
|
|
T |
check, |
|
|
string |
desc, |
|
|
bool |
isError = true |
|
) |
[private] |
|
void TreeChecker::checkString |
( |
Node * |
node, |
|
|
string & |
field, |
|
|
const char * |
type, |
|
|
const char * |
fieldName, |
|
|
bool |
isError = true |
|
) |
[private] |
|
void TreeChecker::checkTree |
( |
Node * |
n, |
|
|
const char * |
type |
|
) |
[private] |
|
Depth Walker::depth |
( |
|
) |
const [inline, inherited] |
|
|
Return which Nodes of an AST should be visited.
A value of SubTree specifies that the entire AST should be traversed. A value of NodeOnly specifies that only the root Node in the AST should be visited.
Definition at line 211 of file walker.h.
References Walker::_depth. |
Order Walker::order |
( |
|
) |
const [inline, inherited] |
|
|
Return the order in which Nodes of an AST should be visited.
Nodes can be visited before their children (Preorder), after their children (Postorder), or both (Both).
Definition at line 203 of file walker.h.
References Walker::_order.
Referenced by df_number_walker::at_node(). |
void TreeChecker::setPostDismantled |
( |
const char * |
, |
|
|
Node * |
|
|
) |
[private] |
|
void TreeChecker::setPreDismantled |
( |
const char * |
, |
|
|
Node * |
|
|
) |
[private] |
|
Member Data Documentation
The documentation for this class was generated from the following file:
|