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>
31  _examiner->reset();
32  internalWalk(examinee);
33 };
34 
35 template <bool constnode>
38  if (_examiner->examine(examinee)) walkChildren(examinee);
39  _examiner->post(examinee);
40 };
41 
42 template <bool constnode>
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 }
void walk(T_NODE *examinee)
Preorder walk.
Definition: ExprWalker.cpp:30
void walkChildren(T_NODE *parent)
Definition: ExprWalker.cpp:43
void internalWalk(T_NODE *examinee)
Definition: ExprWalker.cpp:36
int numChildren() const
Number of children.
Definition: ExprNode.h:114
const ExprNode * child(size_t i) const
Get 0 indexed child.
Definition: ExprNode.h:117