ROSE  0.11.98.0
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 
14 class SgNode;
15 
16 class 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 
187 class AstMatching {
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 
216  void printMarkedLocations();
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
void printMatchOperationsSequence()
This function is only for information purposes.
MatchResult getResult()
Allows to access the match result if the match expression was provided as an argument to the construc...
void setKeepMarkedLocations(bool keepMarked)
This flag is useful when reusing the same matcher object for performing multiple matches.
MatchResult performMatching(std::string matchExpression, SgNode *root)
This is the main function to be called for matching.
void printMarkedLocations()
This function is only for information purposes.
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:9559
The AstMatching class allows to specify arbitrary large patterns to be matched on any subtree in the ...
Definition: AstMatching.h:187