ROSE 0.11.145.192
AstMatching.h
1#ifndef AST_MATCHING_H
2#define AST_MATCHING_H
3
4/*************************************************************
5 * Author : Markus Schordan *
6 *************************************************************/
7
8#include "matcherparser_decls.h"
9#include "MatchOperation.h"
10#include "RoseAst.h"
11#include <list>
12#include <set>
13
14class SgNode;
15
16class MatchOperation;
17
18/* update documentation:
19 make doxygen_docs -C build_tree/docs/Rose
20 webbrowser build_tree/docs/Rose/ROSE_WebPages/ROSE_HTML_Reference/classAstMatching.html
21*/
22
188 public:
189 AstMatching();
190 ~AstMatching();
191
193 MatchResult performMatching(std::string matchExpression, SgNode* root);
194
196 AstMatching(std::string matchExpression,SgNode* root);
197
199 MatchResult getResult();
200
205
211 void setKeepMarkedLocations(bool keepMarked);
212
217
218 private:
219 bool performSingleMatch(SgNode* node, MatchOperationList* matchOperationSequence);
220 void performMatchingOnAst(SgNode* root);
221 void performMatching();
222 void generateMatchOperationsSequence();
223
224 private:
225 std::string _matchExpression;
226 SgNode* _root;
227 MatchOperationList* _matchOperationsSequence;
228 MatchStatus _status;
229 bool _keepMarkedLocations;
230};
231
232#endif
The AstMatching class allows to specify arbitrary large patterns to be matched on any subtree in the ...
void printMatchOperationsSequence()
This function is only for information purposes.
void printMarkedLocations()
This function is only for information purposes.
AstMatching(std::string matchExpression, SgNode *root)
Constructor as a all-in-one solution.
MatchResult performMatching(std::string matchExpression, SgNode *root)
This is the main function to be called for matching.
void setKeepMarkedLocations(bool keepMarked)
This flag is useful when reusing the same matcher object for performing multiple matches.
MatchResult getResult()
Allows to access the match result if the match expression was provided as an argument to the construc...
This class represents the base class for all IR nodes within Sage III.