forked from qt-creator/qt-creator
Fixed the generator.
This commit is contained in:
@@ -89,8 +89,6 @@ void ASTMatcher::getTokenStartPosition(unsigned index, unsigned *line, unsigned
|
|||||||
void ASTMatcher::getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const
|
void ASTMatcher::getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const
|
||||||
{ getPosition(tokenAt(index).end(), line, column); }
|
{ getPosition(tokenAt(index).end(), line, column); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ASTMatcher::match(SimpleSpecifierAST *node, SimpleSpecifierAST *pattern)
|
bool ASTMatcher::match(SimpleSpecifierAST *node, SimpleSpecifierAST *pattern)
|
||||||
{
|
{
|
||||||
if (node->specifier_token != pattern->specifier_token)
|
if (node->specifier_token != pattern->specifier_token)
|
||||||
|
|||||||
@@ -325,12 +325,69 @@ public:
|
|||||||
QTextStream output(&file);
|
QTextStream output(&file);
|
||||||
out = &output;
|
out = &output;
|
||||||
|
|
||||||
*out << copyrightHeader <<
|
*out << copyrightHeader << endl
|
||||||
"\n"
|
<< "#include \"AST.h\"" << endl
|
||||||
"#include \"AST.h\"\n"
|
<< "#include \"ASTMatcher.h\"" << endl
|
||||||
"#include \"ASTMatcher.h\"\n"
|
<< "#include \"Control.h\"" << endl
|
||||||
"\n"
|
<< "#include \"TranslationUnit.h\"" << endl
|
||||||
"using namespace CPlusPlus;\n" << endl;
|
<< endl
|
||||||
|
<< "using namespace CPlusPlus;" << endl
|
||||||
|
<< endl
|
||||||
|
<< "ASTMatcher::ASTMatcher(Control *control)" << endl
|
||||||
|
<< " : _control(control)" << endl
|
||||||
|
<< "{ }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "ASTMatcher::~ASTMatcher()" << endl
|
||||||
|
<< "{ }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "Control *ASTMatcher::control() const" << endl
|
||||||
|
<< "{ return _control; }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "TranslationUnit *ASTMatcher::translationUnit() const" << endl
|
||||||
|
<< "{ return _control->translationUnit(); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "unsigned ASTMatcher::tokenCount() const" << endl
|
||||||
|
<< "{ return translationUnit()->tokenCount(); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "const Token &ASTMatcher::tokenAt(unsigned index) const" << endl
|
||||||
|
<< "{ return translationUnit()->tokenAt(index); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "int ASTMatcher::tokenKind(unsigned index) const" << endl
|
||||||
|
<< "{ return translationUnit()->tokenKind(index); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "const char *ASTMatcher::spell(unsigned index) const" << endl
|
||||||
|
<< "{ return translationUnit()->spell(index); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "Identifier *ASTMatcher::identifier(unsigned index) const" << endl
|
||||||
|
<< "{ return translationUnit()->identifier(index); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "Literal *ASTMatcher::literal(unsigned index) const" << endl
|
||||||
|
<< "{ return translationUnit()->literal(index); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "NumericLiteral *ASTMatcher::numericLiteral(unsigned index) const" << endl
|
||||||
|
<< "{ return translationUnit()->numericLiteral(index); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "StringLiteral *ASTMatcher::stringLiteral(unsigned index) const" << endl
|
||||||
|
<< "{ return translationUnit()->stringLiteral(index); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "void ASTMatcher::getPosition(unsigned offset," << endl
|
||||||
|
<< " unsigned *line," << endl
|
||||||
|
<< " unsigned *column," << endl
|
||||||
|
<< " StringLiteral **fileName) const" << endl
|
||||||
|
<< "{ translationUnit()->getPosition(offset, line, column, fileName); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "void ASTMatcher::getTokenPosition(unsigned index," << endl
|
||||||
|
<< " unsigned *line," << endl
|
||||||
|
<< " unsigned *column," << endl
|
||||||
|
<< " StringLiteral **fileName) const" << endl
|
||||||
|
<< "{ translationUnit()->getTokenPosition(index, line, column, fileName); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "void ASTMatcher::getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const" << endl
|
||||||
|
<< "{ getPosition(tokenAt(index).begin(), line, column); }" << endl
|
||||||
|
<< endl
|
||||||
|
<< "void ASTMatcher::getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const" << endl
|
||||||
|
<< "{ getPosition(tokenAt(index).end(), line, column); }" << endl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
accept(ast);
|
accept(ast);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user