forked from qt-creator/qt-creator
Initial work on the pattern matcher for AST nodes.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -120,6 +120,26 @@ public:
|
||||
accept(it->value, visitor);
|
||||
}
|
||||
|
||||
static bool match(AST *ast, AST *pattern, ASTMatcher *matcher);
|
||||
bool match(AST *pattern, ASTMatcher *matcher);
|
||||
|
||||
template <typename _Tp>
|
||||
static bool match(List<_Tp> *it, List<_Tp> *patternIt, ASTMatcher *matcher)
|
||||
{
|
||||
while (it && patternIt) {
|
||||
if (! match(it->value, patternIt->value, matcher))
|
||||
return false;
|
||||
|
||||
it = it->next;
|
||||
patternIt = patternIt->next;
|
||||
}
|
||||
|
||||
if (! it && ! patternIt)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual unsigned firstToken() const = 0;
|
||||
virtual unsigned lastToken() const = 0;
|
||||
|
||||
@@ -255,8 +275,10 @@ public:
|
||||
virtual UsingAST *asUsing() { return 0; }
|
||||
virtual UsingDirectiveAST *asUsingDirective() { return 0; }
|
||||
virtual WhileStatementAST *asWhileStatement() { return 0; }
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor) = 0;
|
||||
virtual bool match0(AST *, ASTMatcher *) = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT SpecifierAST: public AST
|
||||
@@ -278,6 +300,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT AttributeSpecifierAST: public SpecifierAST
|
||||
@@ -298,6 +321,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT AttributeAST: public AST
|
||||
@@ -317,6 +341,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TypeofSpecifierAST: public SpecifierAST
|
||||
@@ -335,6 +360,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT StatementAST: public AST
|
||||
@@ -386,6 +412,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT SimpleDeclarationAST: public DeclarationAST
|
||||
@@ -407,6 +434,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT EmptyDeclarationAST: public DeclarationAST
|
||||
@@ -422,6 +450,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT AccessDeclarationAST: public DeclarationAST
|
||||
@@ -439,6 +468,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT AsmDefinitionAST: public DeclarationAST
|
||||
@@ -460,6 +490,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT BaseSpecifierAST: public AST
|
||||
@@ -480,6 +511,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CompoundLiteralAST: public ExpressionAST
|
||||
@@ -498,6 +530,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT QtMethodAST: public ExpressionAST
|
||||
@@ -516,6 +549,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT BinaryExpressionAST: public ExpressionAST
|
||||
@@ -533,6 +567,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CastExpressionAST: public ExpressionAST
|
||||
@@ -551,6 +586,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ClassSpecifierAST: public SpecifierAST
|
||||
@@ -576,6 +612,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CaseStatementAST: public StatementAST
|
||||
@@ -594,6 +631,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CompoundStatementAST: public StatementAST
|
||||
@@ -614,6 +652,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ConditionAST: public ExpressionAST
|
||||
@@ -630,6 +669,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ConditionalExpressionAST: public ExpressionAST
|
||||
@@ -649,6 +689,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CppCastExpressionAST: public ExpressionAST
|
||||
@@ -670,6 +711,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CtorInitializerAST: public AST
|
||||
@@ -686,6 +728,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DeclarationStatementAST: public StatementAST
|
||||
@@ -701,6 +744,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DeclaratorIdAST: public CoreDeclaratorAST
|
||||
@@ -716,6 +760,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NestedDeclaratorAST: public CoreDeclaratorAST
|
||||
@@ -733,6 +778,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT FunctionDeclaratorAST: public PostfixDeclaratorAST
|
||||
@@ -756,6 +802,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ArrayDeclaratorAST: public PostfixDeclaratorAST
|
||||
@@ -773,6 +820,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DeleteExpressionAST: public ExpressionAST
|
||||
@@ -792,6 +840,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DoStatementAST: public StatementAST
|
||||
@@ -813,6 +862,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NamedTypeSpecifierAST: public SpecifierAST
|
||||
@@ -828,6 +878,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ElaboratedTypeSpecifierAST: public SpecifierAST
|
||||
@@ -844,6 +895,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT EnumSpecifierAST: public SpecifierAST
|
||||
@@ -863,6 +915,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT EnumeratorAST: public AST
|
||||
@@ -880,6 +933,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ExceptionDeclarationAST: public DeclarationAST
|
||||
@@ -897,6 +951,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ExceptionSpecificationAST: public AST
|
||||
@@ -916,6 +971,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ExpressionOrDeclarationStatementAST: public StatementAST
|
||||
@@ -932,6 +988,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ExpressionStatementAST: public StatementAST
|
||||
@@ -948,6 +1005,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT FunctionDefinitionAST: public DeclarationAST
|
||||
@@ -970,6 +1028,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ForeachStatementAST: public StatementAST
|
||||
@@ -998,6 +1057,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ForStatementAST: public StatementAST
|
||||
@@ -1023,6 +1083,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT IfStatementAST: public StatementAST
|
||||
@@ -1047,6 +1108,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ArrayInitializerAST: public ExpressionAST
|
||||
@@ -1064,6 +1126,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT LabeledStatementAST: public StatementAST
|
||||
@@ -1081,6 +1144,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT LinkageBodyAST: public DeclarationAST
|
||||
@@ -1097,6 +1161,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT LinkageSpecificationAST: public DeclarationAST
|
||||
@@ -1114,6 +1179,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT MemInitializerAST: public AST
|
||||
@@ -1132,6 +1198,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NameAST: public ExpressionAST
|
||||
@@ -1158,6 +1225,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT QualifiedNameAST: public NameAST
|
||||
@@ -1175,6 +1243,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT OperatorFunctionIdAST: public NameAST
|
||||
@@ -1191,6 +1260,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ConversionFunctionIdAST: public NameAST
|
||||
@@ -1208,6 +1278,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT SimpleNameAST: public NameAST
|
||||
@@ -1223,6 +1294,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DestructorNameAST: public NameAST
|
||||
@@ -1239,6 +1311,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TemplateIdAST: public NameAST
|
||||
@@ -1257,6 +1330,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NamespaceAST: public DeclarationAST
|
||||
@@ -1278,6 +1352,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NamespaceAliasDefinitionAST: public DeclarationAST
|
||||
@@ -1297,6 +1372,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NewPlacementAST: public AST
|
||||
@@ -1314,6 +1390,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NewArrayDeclaratorAST: public AST
|
||||
@@ -1331,6 +1408,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NewExpressionAST: public ExpressionAST
|
||||
@@ -1356,6 +1434,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NewInitializerAST: public AST
|
||||
@@ -1373,6 +1452,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NewTypeIdAST: public AST
|
||||
@@ -1390,6 +1470,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT OperatorAST: public AST
|
||||
@@ -1407,6 +1488,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ParameterDeclarationAST: public DeclarationAST
|
||||
@@ -1428,6 +1510,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ParameterDeclarationClauseAST: public AST
|
||||
@@ -1444,6 +1527,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PostfixAST: public AST
|
||||
@@ -1467,6 +1551,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ArrayAccessAST: public PostfixAST
|
||||
@@ -1484,6 +1569,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PostIncrDecrAST: public PostfixAST
|
||||
@@ -1499,6 +1585,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT MemberAccessAST: public PostfixAST
|
||||
@@ -1516,6 +1603,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TypeidExpressionAST: public ExpressionAST
|
||||
@@ -1534,6 +1622,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TypenameCallExpressionAST: public ExpressionAST
|
||||
@@ -1553,6 +1642,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TypeConstructorCallAST: public ExpressionAST
|
||||
@@ -1571,6 +1661,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PostfixExpressionAST: public ExpressionAST
|
||||
@@ -1587,6 +1678,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PtrOperatorAST: public AST
|
||||
@@ -1611,6 +1703,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT PointerAST: public PtrOperatorAST
|
||||
@@ -1627,6 +1720,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ReferenceAST: public PtrOperatorAST
|
||||
@@ -1642,6 +1736,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT BreakStatementAST: public StatementAST
|
||||
@@ -1658,6 +1753,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ContinueStatementAST: public StatementAST
|
||||
@@ -1674,6 +1770,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT GotoStatementAST: public StatementAST
|
||||
@@ -1691,6 +1788,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ReturnStatementAST: public StatementAST
|
||||
@@ -1708,6 +1806,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT SizeofExpressionAST: public ExpressionAST
|
||||
@@ -1726,6 +1825,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NumericLiteralAST: public ExpressionAST
|
||||
@@ -1741,6 +1841,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT BoolLiteralAST: public ExpressionAST
|
||||
@@ -1756,6 +1857,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ThisExpressionAST: public ExpressionAST
|
||||
@@ -1771,6 +1873,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NestedExpressionAST: public ExpressionAST
|
||||
@@ -1788,6 +1891,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT StringLiteralAST: public ExpressionAST
|
||||
@@ -1804,6 +1908,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT SwitchStatementAST: public StatementAST
|
||||
@@ -1826,6 +1931,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TemplateDeclarationAST: public DeclarationAST
|
||||
@@ -1846,6 +1952,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ThrowExpressionAST: public ExpressionAST
|
||||
@@ -1862,6 +1969,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TranslationUnitAST: public AST
|
||||
@@ -1877,6 +1985,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TryBlockStatementAST: public StatementAST
|
||||
@@ -1894,6 +2003,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT CatchClauseAST: public StatementAST
|
||||
@@ -1916,6 +2026,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TypeIdAST: public ExpressionAST
|
||||
@@ -1932,6 +2043,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TypenameTypeParameterAST: public DeclarationAST
|
||||
@@ -1953,6 +2065,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT TemplateTypeParameterAST: public DeclarationAST
|
||||
@@ -1978,6 +2091,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT UnaryExpressionAST: public ExpressionAST
|
||||
@@ -1994,6 +2108,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT UsingAST: public DeclarationAST
|
||||
@@ -2015,6 +2130,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT UsingDirectiveAST: public DeclarationAST
|
||||
@@ -2036,6 +2152,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT WhileStatementAST: public StatementAST
|
||||
@@ -2058,6 +2175,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCClassForwardDeclarationAST: public DeclarationAST
|
||||
@@ -2079,6 +2197,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCClassDeclarationAST: public DeclarationAST
|
||||
@@ -2109,6 +2228,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCProtocolForwardDeclarationAST: public DeclarationAST
|
||||
@@ -2130,6 +2250,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCProtocolDeclarationAST: public DeclarationAST
|
||||
@@ -2153,6 +2274,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCProtocolRefsAST: public AST
|
||||
@@ -2170,6 +2292,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCMessageArgumentAST: public AST
|
||||
@@ -2185,6 +2308,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCMessageExpressionAST: public ExpressionAST
|
||||
@@ -2204,6 +2328,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCProtocolExpressionAST: public ExpressionAST
|
||||
@@ -2222,6 +2347,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCTypeNameAST: public AST
|
||||
@@ -2240,6 +2366,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCEncodeExpressionAST: public ExpressionAST
|
||||
@@ -2256,6 +2383,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCSelectorAST: public AST
|
||||
@@ -2281,6 +2409,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCSelectorArgumentAST: public AST
|
||||
@@ -2297,6 +2426,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCSelectorWithArgumentsAST: public ObjCSelectorAST
|
||||
@@ -2312,6 +2442,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCSelectorExpressionAST: public ExpressionAST
|
||||
@@ -2330,6 +2461,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCInstanceVariablesDeclarationAST: public AST
|
||||
@@ -2347,6 +2479,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCVisibilityDeclarationAST: public DeclarationAST
|
||||
@@ -2362,6 +2495,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCPropertyAttributeAST: public AST
|
||||
@@ -2379,6 +2513,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCPropertyDeclarationAST: public DeclarationAST
|
||||
@@ -2402,6 +2537,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCMessageArgumentDeclarationAST: public NameAST
|
||||
@@ -2422,6 +2558,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCMethodPrototypeAST: public AST
|
||||
@@ -2445,6 +2582,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCMethodDeclarationAST: public DeclarationAST
|
||||
@@ -2462,6 +2600,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCSynthesizedPropertyAST: public AST
|
||||
@@ -2479,6 +2618,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCSynthesizedPropertiesDeclarationAST: public DeclarationAST
|
||||
@@ -2496,6 +2636,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCDynamicPropertiesDeclarationAST: public DeclarationAST
|
||||
@@ -2513,6 +2654,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCFastEnumerationAST: public StatementAST
|
||||
@@ -2543,6 +2685,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ObjCSynchronizedStatementAST: public StatementAST
|
||||
@@ -2562,6 +2705,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
} // end of namespace CPlusPlus
|
||||
|
||||
1628
src/shared/cplusplus/ASTMatch0.cpp
Normal file
1628
src/shared/cplusplus/ASTMatch0.cpp
Normal file
File diff suppressed because it is too large
Load Diff
693
src/shared/cplusplus/ASTMatcher.cpp
Normal file
693
src/shared/cplusplus/ASTMatcher.cpp
Normal file
@@ -0,0 +1,693 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "ASTMatcher.h"
|
||||
#include "Control.h"
|
||||
#include "TranslationUnit.h"
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
Control *ASTMatcher::control() const
|
||||
{ return _control; }
|
||||
|
||||
TranslationUnit *ASTMatcher::translationUnit() const
|
||||
{ return _control->translationUnit(); }
|
||||
|
||||
unsigned ASTMatcher::tokenCount() const
|
||||
{ return translationUnit()->tokenCount(); }
|
||||
|
||||
const Token &ASTMatcher::tokenAt(unsigned index) const
|
||||
{ return translationUnit()->tokenAt(index); }
|
||||
|
||||
int ASTMatcher::tokenKind(unsigned index) const
|
||||
{ return translationUnit()->tokenKind(index); }
|
||||
|
||||
const char *ASTMatcher::spell(unsigned index) const
|
||||
{ return translationUnit()->spell(index); }
|
||||
|
||||
Identifier *ASTMatcher::identifier(unsigned index) const
|
||||
{ return translationUnit()->identifier(index); }
|
||||
|
||||
Literal *ASTMatcher::literal(unsigned index) const
|
||||
{ return translationUnit()->literal(index); }
|
||||
|
||||
NumericLiteral *ASTMatcher::numericLiteral(unsigned index) const
|
||||
{ return translationUnit()->numericLiteral(index); }
|
||||
|
||||
StringLiteral *ASTMatcher::stringLiteral(unsigned index) const
|
||||
{ return translationUnit()->stringLiteral(index); }
|
||||
|
||||
void ASTMatcher::getPosition(unsigned offset,
|
||||
unsigned *line,
|
||||
unsigned *column,
|
||||
StringLiteral **fileName) const
|
||||
{ translationUnit()->getPosition(offset, line, column, fileName); }
|
||||
|
||||
void ASTMatcher::getTokenPosition(unsigned index,
|
||||
unsigned *line,
|
||||
unsigned *column,
|
||||
StringLiteral **fileName) const
|
||||
{ translationUnit()->getTokenPosition(index, line, column, fileName); }
|
||||
|
||||
void ASTMatcher::getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const
|
||||
{ getPosition(tokenAt(index).begin(), line, column); }
|
||||
|
||||
void ASTMatcher::getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const
|
||||
{ getPosition(tokenAt(index).end(), line, column); }
|
||||
|
||||
|
||||
bool ASTMatcher::match(AccessDeclarationAST *, AccessDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ArrayAccessAST *, ArrayAccessAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ArrayDeclaratorAST *, ArrayDeclaratorAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ArrayInitializerAST *, ArrayInitializerAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(AsmDefinitionAST *, AsmDefinitionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(AttributeSpecifierAST *, AttributeSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(AttributeAST *, AttributeAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(BaseSpecifierAST *, BaseSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(BinaryExpressionAST *, BinaryExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(BoolLiteralAST *, BoolLiteralAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(BreakStatementAST *, BreakStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(CallAST *, CallAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(CaseStatementAST *, CaseStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(CastExpressionAST *, CastExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(CatchClauseAST *, CatchClauseAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ClassSpecifierAST *, ClassSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(CompoundLiteralAST *, CompoundLiteralAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(CompoundStatementAST *, CompoundStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ConditionAST *, ConditionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ConditionalExpressionAST *, ConditionalExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ContinueStatementAST *, ContinueStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ConversionFunctionIdAST *, ConversionFunctionIdAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(CppCastExpressionAST *, CppCastExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(CtorInitializerAST *, CtorInitializerAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(DeclaratorAST *, DeclaratorAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(DeclarationStatementAST *, DeclarationStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(DeclaratorIdAST *, DeclaratorIdAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(DeleteExpressionAST *, DeleteExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(DestructorNameAST *, DestructorNameAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(DoStatementAST *, DoStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ElaboratedTypeSpecifierAST *, ElaboratedTypeSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(EmptyDeclarationAST *, EmptyDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(EnumSpecifierAST *, EnumSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(EnumeratorAST *, EnumeratorAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ExceptionDeclarationAST *, ExceptionDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ExceptionSpecificationAST *, ExceptionSpecificationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ExpressionOrDeclarationStatementAST *, ExpressionOrDeclarationStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ExpressionStatementAST *, ExpressionStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ForeachStatementAST *, ForeachStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ForStatementAST *, ForStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(FunctionDeclaratorAST *, FunctionDeclaratorAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(FunctionDefinitionAST *, FunctionDefinitionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(GotoStatementAST *, GotoStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(IfStatementAST *, IfStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(LabeledStatementAST *, LabeledStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(LinkageBodyAST *, LinkageBodyAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(LinkageSpecificationAST *, LinkageSpecificationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(MemInitializerAST *, MemInitializerAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(MemberAccessAST *, MemberAccessAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NamedTypeSpecifierAST *, NamedTypeSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NamespaceAST *, NamespaceAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NamespaceAliasDefinitionAST *, NamespaceAliasDefinitionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NestedDeclaratorAST *, NestedDeclaratorAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NestedExpressionAST *, NestedExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NestedNameSpecifierAST *, NestedNameSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NewPlacementAST *, NewPlacementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NewArrayDeclaratorAST *, NewArrayDeclaratorAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NewExpressionAST *, NewExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NewInitializerAST *, NewInitializerAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NewTypeIdAST *, NewTypeIdAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NumericLiteralAST *, NumericLiteralAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(OperatorAST *, OperatorAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(OperatorFunctionIdAST *, OperatorFunctionIdAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ParameterDeclarationAST *, ParameterDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ParameterDeclarationClauseAST *, ParameterDeclarationClauseAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(PointerAST *, PointerAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(PointerToMemberAST *, PointerToMemberAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(PostIncrDecrAST *, PostIncrDecrAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(PostfixExpressionAST *, PostfixExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(QualifiedNameAST *, QualifiedNameAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ReferenceAST *, ReferenceAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ReturnStatementAST *, ReturnStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(SimpleDeclarationAST *, SimpleDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(SimpleNameAST *, SimpleNameAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(SimpleSpecifierAST *, SimpleSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(SizeofExpressionAST *, SizeofExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(StringLiteralAST *, StringLiteralAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(SwitchStatementAST *, SwitchStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TemplateDeclarationAST *, TemplateDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TemplateIdAST *, TemplateIdAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TemplateTypeParameterAST *, TemplateTypeParameterAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ThisExpressionAST *, ThisExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ThrowExpressionAST *, ThrowExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TranslationUnitAST *, TranslationUnitAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TryBlockStatementAST *, TryBlockStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TypeConstructorCallAST *, TypeConstructorCallAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TypeIdAST *, TypeIdAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TypeidExpressionAST *, TypeidExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TypeofSpecifierAST *, TypeofSpecifierAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TypenameCallExpressionAST *, TypenameCallExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(TypenameTypeParameterAST *, TypenameTypeParameterAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(UnaryExpressionAST *, UnaryExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(UsingAST *, UsingAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(UsingDirectiveAST *, UsingDirectiveAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(WhileStatementAST *, WhileStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(QtMethodAST *, QtMethodAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCClassDeclarationAST *, ObjCClassDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCClassForwardDeclarationAST *, ObjCClassForwardDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCProtocolDeclarationAST *, ObjCProtocolDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCProtocolForwardDeclarationAST *, ObjCProtocolForwardDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCProtocolRefsAST *, ObjCProtocolRefsAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCMessageExpressionAST *, ObjCMessageExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCMessageArgumentAST *, ObjCMessageArgumentAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCProtocolExpressionAST *, ObjCProtocolExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCTypeNameAST *, ObjCTypeNameAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCEncodeExpressionAST *, ObjCEncodeExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCSelectorWithoutArgumentsAST *, ObjCSelectorWithoutArgumentsAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCSelectorArgumentAST *, ObjCSelectorArgumentAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCSelectorWithArgumentsAST *, ObjCSelectorWithArgumentsAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCSelectorExpressionAST *, ObjCSelectorExpressionAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCInstanceVariablesDeclarationAST *, ObjCInstanceVariablesDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCVisibilityDeclarationAST *, ObjCVisibilityDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCPropertyAttributeAST *, ObjCPropertyAttributeAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCPropertyDeclarationAST *, ObjCPropertyDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCMethodPrototypeAST *, ObjCMethodPrototypeAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCMethodDeclarationAST *, ObjCMethodDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCMessageArgumentDeclarationAST *, ObjCMessageArgumentDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCSynthesizedPropertyAST *, ObjCSynthesizedPropertyAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCSynthesizedPropertiesDeclarationAST *, ObjCSynthesizedPropertiesDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCDynamicPropertiesDeclarationAST *, ObjCDynamicPropertiesDeclarationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCFastEnumerationAST *, ObjCFastEnumerationAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(ObjCSynchronizedStatementAST *, ObjCSynchronizedStatementAST *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
195
src/shared/cplusplus/ASTMatcher.h
Normal file
195
src/shared/cplusplus/ASTMatcher.h
Normal file
@@ -0,0 +1,195 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
#ifndef ASTMATCHER_H
|
||||
#define ASTMATCHER_H
|
||||
|
||||
#include "ASTfwd.h"
|
||||
|
||||
namespace CPlusPlus {
|
||||
|
||||
class CPLUSPLUS_EXPORT ASTMatcher
|
||||
{
|
||||
public:
|
||||
ASTMatcher(Control *control);
|
||||
virtual ~ASTMatcher();
|
||||
|
||||
Control *control() const;
|
||||
TranslationUnit *translationUnit() const;
|
||||
|
||||
unsigned tokenCount() const;
|
||||
const Token &tokenAt(unsigned index) const;
|
||||
int tokenKind(unsigned index) const;
|
||||
const char *spell(unsigned index) const;
|
||||
Identifier *identifier(unsigned index) const;
|
||||
Literal *literal(unsigned index) const;
|
||||
NumericLiteral *numericLiteral(unsigned index) const;
|
||||
StringLiteral *stringLiteral(unsigned index) const;
|
||||
|
||||
void getPosition(unsigned offset,
|
||||
unsigned *line,
|
||||
unsigned *column = 0,
|
||||
StringLiteral **fileName = 0) const;
|
||||
|
||||
void getTokenPosition(unsigned index,
|
||||
unsigned *line,
|
||||
unsigned *column = 0,
|
||||
StringLiteral **fileName = 0) const;
|
||||
|
||||
void getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const;
|
||||
|
||||
void getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const; virtual bool match(AccessDeclarationAST *node, AccessDeclarationAST *pattern);
|
||||
virtual bool match(ArrayAccessAST *node, ArrayAccessAST *pattern);
|
||||
virtual bool match(ArrayDeclaratorAST *node, ArrayDeclaratorAST *pattern);
|
||||
virtual bool match(ArrayInitializerAST *node, ArrayInitializerAST *pattern);
|
||||
virtual bool match(AsmDefinitionAST *node, AsmDefinitionAST *pattern);
|
||||
virtual bool match(AttributeSpecifierAST *node, AttributeSpecifierAST *pattern);
|
||||
virtual bool match(AttributeAST *node, AttributeAST *pattern);
|
||||
virtual bool match(BaseSpecifierAST *node, BaseSpecifierAST *pattern);
|
||||
virtual bool match(BinaryExpressionAST *node, BinaryExpressionAST *pattern);
|
||||
virtual bool match(BoolLiteralAST *node, BoolLiteralAST *pattern);
|
||||
virtual bool match(BreakStatementAST *node, BreakStatementAST *pattern);
|
||||
virtual bool match(CallAST *node, CallAST *pattern);
|
||||
virtual bool match(CaseStatementAST *node, CaseStatementAST *pattern);
|
||||
virtual bool match(CastExpressionAST *node, CastExpressionAST *pattern);
|
||||
virtual bool match(CatchClauseAST *node, CatchClauseAST *pattern);
|
||||
virtual bool match(ClassSpecifierAST *node, ClassSpecifierAST *pattern);
|
||||
virtual bool match(CompoundLiteralAST *node, CompoundLiteralAST *pattern);
|
||||
virtual bool match(CompoundStatementAST *node, CompoundStatementAST *pattern);
|
||||
virtual bool match(ConditionAST *node, ConditionAST *pattern);
|
||||
virtual bool match(ConditionalExpressionAST *node, ConditionalExpressionAST *pattern);
|
||||
virtual bool match(ContinueStatementAST *node, ContinueStatementAST *pattern);
|
||||
virtual bool match(ConversionFunctionIdAST *node, ConversionFunctionIdAST *pattern);
|
||||
virtual bool match(CppCastExpressionAST *node, CppCastExpressionAST *pattern);
|
||||
virtual bool match(CtorInitializerAST *node, CtorInitializerAST *pattern);
|
||||
virtual bool match(DeclaratorAST *node, DeclaratorAST *pattern);
|
||||
virtual bool match(DeclarationStatementAST *node, DeclarationStatementAST *pattern);
|
||||
virtual bool match(DeclaratorIdAST *node, DeclaratorIdAST *pattern);
|
||||
virtual bool match(DeleteExpressionAST *node, DeleteExpressionAST *pattern);
|
||||
virtual bool match(DestructorNameAST *node, DestructorNameAST *pattern);
|
||||
virtual bool match(DoStatementAST *node, DoStatementAST *pattern);
|
||||
virtual bool match(ElaboratedTypeSpecifierAST *node, ElaboratedTypeSpecifierAST *pattern);
|
||||
virtual bool match(EmptyDeclarationAST *node, EmptyDeclarationAST *pattern);
|
||||
virtual bool match(EnumSpecifierAST *node, EnumSpecifierAST *pattern);
|
||||
virtual bool match(EnumeratorAST *node, EnumeratorAST *pattern);
|
||||
virtual bool match(ExceptionDeclarationAST *node, ExceptionDeclarationAST *pattern);
|
||||
virtual bool match(ExceptionSpecificationAST *node, ExceptionSpecificationAST *pattern);
|
||||
virtual bool match(ExpressionOrDeclarationStatementAST *node, ExpressionOrDeclarationStatementAST *pattern);
|
||||
virtual bool match(ExpressionStatementAST *node, ExpressionStatementAST *pattern);
|
||||
virtual bool match(ForeachStatementAST *node, ForeachStatementAST *pattern);
|
||||
virtual bool match(ForStatementAST *node, ForStatementAST *pattern);
|
||||
virtual bool match(FunctionDeclaratorAST *node, FunctionDeclaratorAST *pattern);
|
||||
virtual bool match(FunctionDefinitionAST *node, FunctionDefinitionAST *pattern);
|
||||
virtual bool match(GotoStatementAST *node, GotoStatementAST *pattern);
|
||||
virtual bool match(IfStatementAST *node, IfStatementAST *pattern);
|
||||
virtual bool match(LabeledStatementAST *node, LabeledStatementAST *pattern);
|
||||
virtual bool match(LinkageBodyAST *node, LinkageBodyAST *pattern);
|
||||
virtual bool match(LinkageSpecificationAST *node, LinkageSpecificationAST *pattern);
|
||||
virtual bool match(MemInitializerAST *node, MemInitializerAST *pattern);
|
||||
virtual bool match(MemberAccessAST *node, MemberAccessAST *pattern);
|
||||
virtual bool match(NamedTypeSpecifierAST *node, NamedTypeSpecifierAST *pattern);
|
||||
virtual bool match(NamespaceAST *node, NamespaceAST *pattern);
|
||||
virtual bool match(NamespaceAliasDefinitionAST *node, NamespaceAliasDefinitionAST *pattern);
|
||||
virtual bool match(NestedDeclaratorAST *node, NestedDeclaratorAST *pattern);
|
||||
virtual bool match(NestedExpressionAST *node, NestedExpressionAST *pattern);
|
||||
virtual bool match(NestedNameSpecifierAST *node, NestedNameSpecifierAST *pattern);
|
||||
virtual bool match(NewPlacementAST *node, NewPlacementAST *pattern);
|
||||
virtual bool match(NewArrayDeclaratorAST *node, NewArrayDeclaratorAST *pattern);
|
||||
virtual bool match(NewExpressionAST *node, NewExpressionAST *pattern);
|
||||
virtual bool match(NewInitializerAST *node, NewInitializerAST *pattern);
|
||||
virtual bool match(NewTypeIdAST *node, NewTypeIdAST *pattern);
|
||||
virtual bool match(NumericLiteralAST *node, NumericLiteralAST *pattern);
|
||||
virtual bool match(OperatorAST *node, OperatorAST *pattern);
|
||||
virtual bool match(OperatorFunctionIdAST *node, OperatorFunctionIdAST *pattern);
|
||||
virtual bool match(ParameterDeclarationAST *node, ParameterDeclarationAST *pattern);
|
||||
virtual bool match(ParameterDeclarationClauseAST *node, ParameterDeclarationClauseAST *pattern);
|
||||
virtual bool match(PointerAST *node, PointerAST *pattern);
|
||||
virtual bool match(PointerToMemberAST *node, PointerToMemberAST *pattern);
|
||||
virtual bool match(PostIncrDecrAST *node, PostIncrDecrAST *pattern);
|
||||
virtual bool match(PostfixExpressionAST *node, PostfixExpressionAST *pattern);
|
||||
virtual bool match(QualifiedNameAST *node, QualifiedNameAST *pattern);
|
||||
virtual bool match(ReferenceAST *node, ReferenceAST *pattern);
|
||||
virtual bool match(ReturnStatementAST *node, ReturnStatementAST *pattern);
|
||||
virtual bool match(SimpleDeclarationAST *node, SimpleDeclarationAST *pattern);
|
||||
virtual bool match(SimpleNameAST *node, SimpleNameAST *pattern);
|
||||
virtual bool match(SimpleSpecifierAST *node, SimpleSpecifierAST *pattern);
|
||||
virtual bool match(SizeofExpressionAST *node, SizeofExpressionAST *pattern);
|
||||
virtual bool match(StringLiteralAST *node, StringLiteralAST *pattern);
|
||||
virtual bool match(SwitchStatementAST *node, SwitchStatementAST *pattern);
|
||||
virtual bool match(TemplateDeclarationAST *node, TemplateDeclarationAST *pattern);
|
||||
virtual bool match(TemplateIdAST *node, TemplateIdAST *pattern);
|
||||
virtual bool match(TemplateTypeParameterAST *node, TemplateTypeParameterAST *pattern);
|
||||
virtual bool match(ThisExpressionAST *node, ThisExpressionAST *pattern);
|
||||
virtual bool match(ThrowExpressionAST *node, ThrowExpressionAST *pattern);
|
||||
virtual bool match(TranslationUnitAST *node, TranslationUnitAST *pattern);
|
||||
virtual bool match(TryBlockStatementAST *node, TryBlockStatementAST *pattern);
|
||||
virtual bool match(TypeConstructorCallAST *node, TypeConstructorCallAST *pattern);
|
||||
virtual bool match(TypeIdAST *node, TypeIdAST *pattern);
|
||||
virtual bool match(TypeidExpressionAST *node, TypeidExpressionAST *pattern);
|
||||
virtual bool match(TypeofSpecifierAST *node, TypeofSpecifierAST *pattern);
|
||||
virtual bool match(TypenameCallExpressionAST *node, TypenameCallExpressionAST *pattern);
|
||||
virtual bool match(TypenameTypeParameterAST *node, TypenameTypeParameterAST *pattern);
|
||||
virtual bool match(UnaryExpressionAST *node, UnaryExpressionAST *pattern);
|
||||
virtual bool match(UsingAST *node, UsingAST *pattern);
|
||||
virtual bool match(UsingDirectiveAST *node, UsingDirectiveAST *pattern);
|
||||
virtual bool match(WhileStatementAST *node, WhileStatementAST *pattern);
|
||||
virtual bool match(QtMethodAST *node, QtMethodAST *pattern);
|
||||
virtual bool match(ObjCClassDeclarationAST *node, ObjCClassDeclarationAST *pattern);
|
||||
virtual bool match(ObjCClassForwardDeclarationAST *node, ObjCClassForwardDeclarationAST *pattern);
|
||||
virtual bool match(ObjCProtocolDeclarationAST *node, ObjCProtocolDeclarationAST *pattern);
|
||||
virtual bool match(ObjCProtocolForwardDeclarationAST *node, ObjCProtocolForwardDeclarationAST *pattern);
|
||||
virtual bool match(ObjCProtocolRefsAST *node, ObjCProtocolRefsAST *pattern);
|
||||
virtual bool match(ObjCMessageExpressionAST *node, ObjCMessageExpressionAST *pattern);
|
||||
virtual bool match(ObjCMessageArgumentAST *node, ObjCMessageArgumentAST *pattern);
|
||||
virtual bool match(ObjCProtocolExpressionAST *node, ObjCProtocolExpressionAST *pattern);
|
||||
virtual bool match(ObjCTypeNameAST *node, ObjCTypeNameAST *pattern);
|
||||
virtual bool match(ObjCEncodeExpressionAST *node, ObjCEncodeExpressionAST *pattern);
|
||||
virtual bool match(ObjCSelectorWithoutArgumentsAST *node, ObjCSelectorWithoutArgumentsAST *pattern);
|
||||
virtual bool match(ObjCSelectorArgumentAST *node, ObjCSelectorArgumentAST *pattern);
|
||||
virtual bool match(ObjCSelectorWithArgumentsAST *node, ObjCSelectorWithArgumentsAST *pattern);
|
||||
virtual bool match(ObjCSelectorExpressionAST *node, ObjCSelectorExpressionAST *pattern);
|
||||
virtual bool match(ObjCInstanceVariablesDeclarationAST *node, ObjCInstanceVariablesDeclarationAST *pattern);
|
||||
virtual bool match(ObjCVisibilityDeclarationAST *node, ObjCVisibilityDeclarationAST *pattern);
|
||||
virtual bool match(ObjCPropertyAttributeAST *node, ObjCPropertyAttributeAST *pattern);
|
||||
virtual bool match(ObjCPropertyDeclarationAST *node, ObjCPropertyDeclarationAST *pattern);
|
||||
virtual bool match(ObjCMethodPrototypeAST *node, ObjCMethodPrototypeAST *pattern);
|
||||
virtual bool match(ObjCMethodDeclarationAST *node, ObjCMethodDeclarationAST *pattern);
|
||||
virtual bool match(ObjCMessageArgumentDeclarationAST *node, ObjCMessageArgumentDeclarationAST *pattern);
|
||||
virtual bool match(ObjCSynthesizedPropertyAST *node, ObjCSynthesizedPropertyAST *pattern);
|
||||
virtual bool match(ObjCSynthesizedPropertiesDeclarationAST *node, ObjCSynthesizedPropertiesDeclarationAST *pattern);
|
||||
virtual bool match(ObjCDynamicPropertiesDeclarationAST *node, ObjCDynamicPropertiesDeclarationAST *pattern);
|
||||
virtual bool match(ObjCFastEnumerationAST *node, ObjCFastEnumerationAST *pattern);
|
||||
virtual bool match(ObjCSynchronizedStatementAST *node, ObjCSynchronizedStatementAST *pattern);
|
||||
|
||||
private:
|
||||
Control *_control;
|
||||
};
|
||||
|
||||
} // end of namespace CPlusPlus
|
||||
|
||||
#endif // ASTMATCHER_H
|
||||
@@ -57,6 +57,7 @@ template <typename _Tp> class List;
|
||||
|
||||
class AST;
|
||||
class ASTVisitor;
|
||||
class ASTMatcher;
|
||||
|
||||
class AccessDeclarationAST;
|
||||
class ArrayAccessAST;
|
||||
|
||||
@@ -2419,7 +2419,7 @@ bool Parser::parseForStatement(StatementAST *&node)
|
||||
ast->for_token = for_token;
|
||||
ast->lparen_token = lparen_token;
|
||||
parseForInitStatement(ast->initializer);
|
||||
parseExpression(ast->condition);
|
||||
parseCondition(ast->condition);
|
||||
match(T_SEMICOLON, &ast->semicolon_token);
|
||||
parseExpression(ast->expression);
|
||||
match(T_RPAREN, &ast->rparen_token);
|
||||
|
||||
@@ -5,6 +5,7 @@ INCLUDEPATH += $$PWD
|
||||
HEADERS += \
|
||||
$$PWD/AST.h \
|
||||
$$PWD/ASTVisitor.h \
|
||||
$$PWD/ASTMatcher.h \
|
||||
$$PWD/ASTfwd.h \
|
||||
$$PWD/Array.h \
|
||||
$$PWD/CPlusPlusForwardDeclarations.h \
|
||||
@@ -41,7 +42,9 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
$$PWD/AST.cpp \
|
||||
$$PWD/ASTVisit.cpp \
|
||||
$$PWD/ASTMatch0.cpp \
|
||||
$$PWD/ASTVisitor.cpp \
|
||||
$$PWD/ASTMatcher.cpp \
|
||||
$$PWD/Array.cpp \
|
||||
$$PWD/CheckDeclaration.cpp \
|
||||
$$PWD/CheckDeclarator.cpp \
|
||||
|
||||
Reference in New Issue
Block a user