ASTMatcher.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. // Copyright (c) 2008 Roberto Raggi <[email protected]>
  2. //
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy
  4. // of this software and associated documentation files (the "Software"), to deal
  5. // in the Software without restriction, including without limitation the rights
  6. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. // copies of the Software, and to permit persons to whom the Software is
  8. // furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in
  11. // all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. // THE SOFTWARE.
  20. #ifndef ASTMATCHER_H
  21. #define ASTMATCHER_H
  22. #include "ASTfwd.h"
  23. namespace CPlusPlus {
  24. class CPLUSPLUS_EXPORT ASTMatcher
  25. {
  26. public:
  27. ASTMatcher();
  28. virtual ~ASTMatcher();
  29. virtual bool match(AccessDeclarationAST *node, AccessDeclarationAST *pattern);
  30. virtual bool match(AliasDeclarationAST *node, AliasDeclarationAST *pattern);
  31. virtual bool match(AlignmentSpecifierAST *node, AlignmentSpecifierAST *pattern);
  32. virtual bool match(AlignofExpressionAST *node, AlignofExpressionAST *pattern);
  33. virtual bool match(AnonymousNameAST *node, AnonymousNameAST *pattern);
  34. virtual bool match(ArrayAccessAST *node, ArrayAccessAST *pattern);
  35. virtual bool match(ArrayDeclaratorAST *node, ArrayDeclaratorAST *pattern);
  36. virtual bool match(ArrayInitializerAST *node, ArrayInitializerAST *pattern);
  37. virtual bool match(AsmDefinitionAST *node, AsmDefinitionAST *pattern);
  38. virtual bool match(BaseSpecifierAST *node, BaseSpecifierAST *pattern);
  39. virtual bool match(BinaryExpressionAST *node, BinaryExpressionAST *pattern);
  40. virtual bool match(BoolLiteralAST *node, BoolLiteralAST *pattern);
  41. virtual bool match(BracedInitializerAST *node, BracedInitializerAST *pattern);
  42. virtual bool match(BracketDesignatorAST *node, BracketDesignatorAST *pattern);
  43. virtual bool match(BreakStatementAST *node, BreakStatementAST *pattern);
  44. virtual bool match(CallAST *node, CallAST *pattern);
  45. virtual bool match(CaptureAST *node, CaptureAST *pattern);
  46. virtual bool match(CaseStatementAST *node, CaseStatementAST *pattern);
  47. virtual bool match(CastExpressionAST *node, CastExpressionAST *pattern);
  48. virtual bool match(CatchClauseAST *node, CatchClauseAST *pattern);
  49. virtual bool match(ClassSpecifierAST *node, ClassSpecifierAST *pattern);
  50. virtual bool match(CompoundExpressionAST *node, CompoundExpressionAST *pattern);
  51. virtual bool match(CompoundLiteralAST *node, CompoundLiteralAST *pattern);
  52. virtual bool match(CompoundStatementAST *node, CompoundStatementAST *pattern);
  53. virtual bool match(ConditionAST *node, ConditionAST *pattern);
  54. virtual bool match(ConditionalExpressionAST *node, ConditionalExpressionAST *pattern);
  55. virtual bool match(ContinueStatementAST *node, ContinueStatementAST *pattern);
  56. virtual bool match(ConversionFunctionIdAST *node, ConversionFunctionIdAST *pattern);
  57. virtual bool match(CppCastExpressionAST *node, CppCastExpressionAST *pattern);
  58. virtual bool match(CtorInitializerAST *node, CtorInitializerAST *pattern);
  59. virtual bool match(DeclarationStatementAST *node, DeclarationStatementAST *pattern);
  60. virtual bool match(DeclaratorAST *node, DeclaratorAST *pattern);
  61. virtual bool match(DeclaratorIdAST *node, DeclaratorIdAST *pattern);
  62. virtual bool match(DecltypeSpecifierAST *node, DecltypeSpecifierAST *pattern);
  63. virtual bool match(DeleteExpressionAST *node, DeleteExpressionAST *pattern);
  64. virtual bool match(DesignatedInitializerAST *node, DesignatedInitializerAST *pattern);
  65. virtual bool match(DestructorNameAST *node, DestructorNameAST *pattern);
  66. virtual bool match(DoStatementAST *node, DoStatementAST *pattern);
  67. virtual bool match(DotDesignatorAST *node, DotDesignatorAST *pattern);
  68. virtual bool match(DynamicExceptionSpecificationAST *node, DynamicExceptionSpecificationAST *pattern);
  69. virtual bool match(ElaboratedTypeSpecifierAST *node, ElaboratedTypeSpecifierAST *pattern);
  70. virtual bool match(EmptyDeclarationAST *node, EmptyDeclarationAST *pattern);
  71. virtual bool match(EnumSpecifierAST *node, EnumSpecifierAST *pattern);
  72. virtual bool match(EnumeratorAST *node, EnumeratorAST *pattern);
  73. virtual bool match(ExceptionDeclarationAST *node, ExceptionDeclarationAST *pattern);
  74. virtual bool match(ExpressionListParenAST *node, ExpressionListParenAST *pattern);
  75. virtual bool match(ExpressionOrDeclarationStatementAST *node, ExpressionOrDeclarationStatementAST *pattern);
  76. virtual bool match(ExpressionStatementAST *node, ExpressionStatementAST *pattern);
  77. virtual bool match(ForStatementAST *node, ForStatementAST *pattern);
  78. virtual bool match(ForeachStatementAST *node, ForeachStatementAST *pattern);
  79. virtual bool match(FunctionDeclaratorAST *node, FunctionDeclaratorAST *pattern);
  80. virtual bool match(FunctionDefinitionAST *node, FunctionDefinitionAST *pattern);
  81. virtual bool match(GnuAttributeAST *node, GnuAttributeAST *pattern);
  82. virtual bool match(GnuAttributeSpecifierAST *node, GnuAttributeSpecifierAST *pattern);
  83. virtual bool match(GotoStatementAST *node, GotoStatementAST *pattern);
  84. virtual bool match(IdExpressionAST *node, IdExpressionAST *pattern);
  85. virtual bool match(IfStatementAST *node, IfStatementAST *pattern);
  86. virtual bool match(LabeledStatementAST *node, LabeledStatementAST *pattern);
  87. virtual bool match(LambdaCaptureAST *node, LambdaCaptureAST *pattern);
  88. virtual bool match(LambdaDeclaratorAST *node, LambdaDeclaratorAST *pattern);
  89. virtual bool match(LambdaExpressionAST *node, LambdaExpressionAST *pattern);
  90. virtual bool match(LambdaIntroducerAST *node, LambdaIntroducerAST *pattern);
  91. virtual bool match(LinkageBodyAST *node, LinkageBodyAST *pattern);
  92. virtual bool match(LinkageSpecificationAST *node, LinkageSpecificationAST *pattern);
  93. virtual bool match(MemInitializerAST *node, MemInitializerAST *pattern);
  94. virtual bool match(MemberAccessAST *node, MemberAccessAST *pattern);
  95. virtual bool match(NamedTypeSpecifierAST *node, NamedTypeSpecifierAST *pattern);
  96. virtual bool match(NamespaceAST *node, NamespaceAST *pattern);
  97. virtual bool match(NamespaceAliasDefinitionAST *node, NamespaceAliasDefinitionAST *pattern);
  98. virtual bool match(NestedDeclaratorAST *node, NestedDeclaratorAST *pattern);
  99. virtual bool match(NestedExpressionAST *node, NestedExpressionAST *pattern);
  100. virtual bool match(NestedNameSpecifierAST *node, NestedNameSpecifierAST *pattern);
  101. virtual bool match(NewArrayDeclaratorAST *node, NewArrayDeclaratorAST *pattern);
  102. virtual bool match(NewExpressionAST *node, NewExpressionAST *pattern);
  103. virtual bool match(NewTypeIdAST *node, NewTypeIdAST *pattern);
  104. virtual bool match(NoExceptSpecificationAST *node, NoExceptSpecificationAST *pattern);
  105. virtual bool match(NumericLiteralAST *node, NumericLiteralAST *pattern);
  106. virtual bool match(ObjCClassDeclarationAST *node, ObjCClassDeclarationAST *pattern);
  107. virtual bool match(ObjCClassForwardDeclarationAST *node, ObjCClassForwardDeclarationAST *pattern);
  108. virtual bool match(ObjCDynamicPropertiesDeclarationAST *node, ObjCDynamicPropertiesDeclarationAST *pattern);
  109. virtual bool match(ObjCEncodeExpressionAST *node, ObjCEncodeExpressionAST *pattern);
  110. virtual bool match(ObjCFastEnumerationAST *node, ObjCFastEnumerationAST *pattern);
  111. virtual bool match(ObjCInstanceVariablesDeclarationAST *node, ObjCInstanceVariablesDeclarationAST *pattern);
  112. virtual bool match(ObjCMessageArgumentAST *node, ObjCMessageArgumentAST *pattern);
  113. virtual bool match(ObjCMessageArgumentDeclarationAST *node, ObjCMessageArgumentDeclarationAST *pattern);
  114. virtual bool match(ObjCMessageExpressionAST *node, ObjCMessageExpressionAST *pattern);
  115. virtual bool match(ObjCMethodDeclarationAST *node, ObjCMethodDeclarationAST *pattern);
  116. virtual bool match(ObjCMethodPrototypeAST *node, ObjCMethodPrototypeAST *pattern);
  117. virtual bool match(ObjCPropertyAttributeAST *node, ObjCPropertyAttributeAST *pattern);
  118. virtual bool match(ObjCPropertyDeclarationAST *node, ObjCPropertyDeclarationAST *pattern);
  119. virtual bool match(ObjCProtocolDeclarationAST *node, ObjCProtocolDeclarationAST *pattern);
  120. virtual bool match(ObjCProtocolExpressionAST *node, ObjCProtocolExpressionAST *pattern);
  121. virtual bool match(ObjCProtocolForwardDeclarationAST *node, ObjCProtocolForwardDeclarationAST *pattern);
  122. virtual bool match(ObjCProtocolRefsAST *node, ObjCProtocolRefsAST *pattern);
  123. virtual bool match(ObjCSelectorAST *node, ObjCSelectorAST *pattern);
  124. virtual bool match(ObjCSelectorArgumentAST *node, ObjCSelectorArgumentAST *pattern);
  125. virtual bool match(ObjCSelectorExpressionAST *node, ObjCSelectorExpressionAST *pattern);
  126. virtual bool match(ObjCSynchronizedStatementAST *node, ObjCSynchronizedStatementAST *pattern);
  127. virtual bool match(ObjCSynthesizedPropertiesDeclarationAST *node, ObjCSynthesizedPropertiesDeclarationAST *pattern);
  128. virtual bool match(ObjCSynthesizedPropertyAST *node, ObjCSynthesizedPropertyAST *pattern);
  129. virtual bool match(ObjCTypeNameAST *node, ObjCTypeNameAST *pattern);
  130. virtual bool match(ObjCVisibilityDeclarationAST *node, ObjCVisibilityDeclarationAST *pattern);
  131. virtual bool match(OperatorAST *node, OperatorAST *pattern);
  132. virtual bool match(OperatorFunctionIdAST *node, OperatorFunctionIdAST *pattern);
  133. virtual bool match(ParameterDeclarationAST *node, ParameterDeclarationAST *pattern);
  134. virtual bool match(ParameterDeclarationClauseAST *node, ParameterDeclarationClauseAST *pattern);
  135. virtual bool match(PointerAST *node, PointerAST *pattern);
  136. virtual bool match(PointerLiteralAST *node, PointerLiteralAST *pattern);
  137. virtual bool match(PointerToMemberAST *node, PointerToMemberAST *pattern);
  138. virtual bool match(PostIncrDecrAST *node, PostIncrDecrAST *pattern);
  139. virtual bool match(QtEnumDeclarationAST *node, QtEnumDeclarationAST *pattern);
  140. virtual bool match(QtFlagsDeclarationAST *node, QtFlagsDeclarationAST *pattern);
  141. virtual bool match(QtInterfaceNameAST *node, QtInterfaceNameAST *pattern);
  142. virtual bool match(QtInterfacesDeclarationAST *node, QtInterfacesDeclarationAST *pattern);
  143. virtual bool match(QtMemberDeclarationAST *node, QtMemberDeclarationAST *pattern);
  144. virtual bool match(QtMethodAST *node, QtMethodAST *pattern);
  145. virtual bool match(QtObjectTagAST *node, QtObjectTagAST *pattern);
  146. virtual bool match(QtPrivateSlotAST *node, QtPrivateSlotAST *pattern);
  147. virtual bool match(QtPropertyDeclarationAST *node, QtPropertyDeclarationAST *pattern);
  148. virtual bool match(QtPropertyDeclarationItemAST *node, QtPropertyDeclarationItemAST *pattern);
  149. virtual bool match(QualifiedNameAST *node, QualifiedNameAST *pattern);
  150. virtual bool match(RangeBasedForStatementAST *node, RangeBasedForStatementAST *pattern);
  151. virtual bool match(ReferenceAST *node, ReferenceAST *pattern);
  152. virtual bool match(ReturnStatementAST *node, ReturnStatementAST *pattern);
  153. virtual bool match(SimpleDeclarationAST *node, SimpleDeclarationAST *pattern);
  154. virtual bool match(SimpleNameAST *node, SimpleNameAST *pattern);
  155. virtual bool match(SimpleSpecifierAST *node, SimpleSpecifierAST *pattern);
  156. virtual bool match(SizeofExpressionAST *node, SizeofExpressionAST *pattern);
  157. virtual bool match(StaticAssertDeclarationAST *node, StaticAssertDeclarationAST *pattern);
  158. virtual bool match(StringLiteralAST *node, StringLiteralAST *pattern);
  159. virtual bool match(SwitchStatementAST *node, SwitchStatementAST *pattern);
  160. virtual bool match(TemplateDeclarationAST *node, TemplateDeclarationAST *pattern);
  161. virtual bool match(TemplateIdAST *node, TemplateIdAST *pattern);
  162. virtual bool match(TemplateTypeParameterAST *node, TemplateTypeParameterAST *pattern);
  163. virtual bool match(ThisExpressionAST *node, ThisExpressionAST *pattern);
  164. virtual bool match(ThrowExpressionAST *node, ThrowExpressionAST *pattern);
  165. virtual bool match(TrailingReturnTypeAST *node, TrailingReturnTypeAST *pattern);
  166. virtual bool match(TranslationUnitAST *node, TranslationUnitAST *pattern);
  167. virtual bool match(TryBlockStatementAST *node, TryBlockStatementAST *pattern);
  168. virtual bool match(TypeConstructorCallAST *node, TypeConstructorCallAST *pattern);
  169. virtual bool match(TypeIdAST *node, TypeIdAST *pattern);
  170. virtual bool match(TypeidExpressionAST *node, TypeidExpressionAST *pattern);
  171. virtual bool match(TypenameCallExpressionAST *node, TypenameCallExpressionAST *pattern);
  172. virtual bool match(TypenameTypeParameterAST *node, TypenameTypeParameterAST *pattern);
  173. virtual bool match(TypeofSpecifierAST *node, TypeofSpecifierAST *pattern);
  174. virtual bool match(UnaryExpressionAST *node, UnaryExpressionAST *pattern);
  175. virtual bool match(UsingAST *node, UsingAST *pattern);
  176. virtual bool match(UsingDirectiveAST *node, UsingDirectiveAST *pattern);
  177. virtual bool match(WhileStatementAST *node, WhileStatementAST *pattern);
  178. };
  179. } // namespace CPlusPlus
  180. #endif // CPLUSPLUS_ASTMATCHER_H