summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/AST.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/cplusplus/AST.cpp')
-rw-r--r--src/shared/cplusplus/AST.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index 38f3050b00..1e6cae8969 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -48,6 +48,7 @@
#include "AST.h"
#include "ASTVisitor.h"
+#include "ASTMatcher.h"
#include "MemoryPool.h"
#include <cassert>
@@ -69,6 +70,22 @@ void AST::accept(ASTVisitor *visitor)
visitor->postVisit(this);
}
+bool AST::match(AST *ast, AST *pattern, ASTMatcher *matcher)
+{
+ if (ast == pattern)
+ return true;
+
+ else if (! ast || ! pattern)
+ return false;
+
+ return ast->match(pattern, matcher);
+}
+
+bool AST::match(AST *pattern, ASTMatcher *matcher)
+{
+ return match0(pattern, matcher);
+}
+
unsigned AttributeSpecifierAST::firstToken() const
{
return attribute_token;