SeExpr

ExprWalker.cpp
Go to the documentation of this file.
1 /*
2 Copyright Disney Enterprises, Inc. All rights reserved.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License
6 and the following modification to it: Section 6 Trademarks.
7 deleted and replaced with:
8
9 6. Trademarks. This License does not grant permission to use the
10 trade names, trademarks, service marks, or product names of the
11 Licensor and its affiliates, except as required for reproducing
12 the content of the NOTICE file.
13
14 You may obtain a copy of the License at
15 http://www.apache.org/licenses/LICENSE-2.0
16 */
17 #ifndef MAKEDEPEND
18 #include <string.h>
19 #include <string>
20 #include <vector>
21 #endif
22
23 #include "ExprNode.h"
24 #include "ExprPatterns.h"
25 #include "ExprWalker.h"
26
27 namespace SeExpr2 {
28
29 template <bool constnode>
30 void Walker<constnode>::walk(T_NODE* examinee) {
31 _examiner->reset();
32 internalWalk(examinee);
33 };
34
35 template <bool constnode>
36 void Walker<constnode>::internalWalk(T_NODE* examinee) {
38 if (_examiner->examine(examinee)) walkChildren(examinee);
39 _examiner->post(examinee);
40 };
41
42 template <bool constnode>
43 void Walker<constnode>::walkChildren(T_NODE* parent) {
44 for (int i = 0; i < parent->numChildren(); i++) internalWalk(parent->child(i));
45 };
46
47 template class Walker<false>;
48 template class Walker<true>;
49 }
SeExpr2::ExprNode::numChildren
int numChildren() const
Number of children.
Definition: ExprNode.h:114
SeExpr2::ExprNode
Definition: ExprNode.h:72
SeExpr2::Walker::internalWalk
void internalWalk(T_NODE *examinee)
Definition: ExprWalker.cpp:36
SeExpr2::Walker::walkChildren
void walkChildren(T_NODE *parent)
Definition: ExprWalker.cpp:43
SeExpr2
Definition: Context.h:22
ExprNode.h
ExprWalker.h
SeExpr2::Walker
Definition: ExprWalker.h:43
ExprPatterns.h
SeExpr2::ExprNode::child
const ExprNode * child(size_t i) const
Get 0 indexed child.
Definition: ExprNode.h:117
SeExpr2::Walker::walk
void walk(T_NODE *examinee)
Preorder walk.
Definition: ExprWalker.cpp:30