Commit 215d102a authored by hjk's avatar hjk
Browse files

Merge branch 'master' of

parents ff5f9af9 66a3e715
......@@ -69,6 +69,9 @@ Control *ASTVisitor::control() const
TranslationUnit *ASTVisitor::translationUnit() const
{ return _control->translationUnit(); }
const Token &ASTVisitor::tokenAt(unsigned index) const
{ return translationUnit()->tokenAt(index); }
int ASTVisitor::tokenKind(unsigned index) const
{ return translationUnit()->tokenKind(index); }
......@@ -87,10 +90,22 @@ NumericLiteral *ASTVisitor::numericLiteral(unsigned index) const
StringLiteral *ASTVisitor::stringLiteral(unsigned index) const
{ return translationUnit()->stringLiteral(index); }
void ASTVisitor::getPosition(unsigned offset,
unsigned *line,
unsigned *column,
StringLiteral **fileName) const
{ translationUnit()->getPosition(offset, line, column, fileName); }
void ASTVisitor::getTokenPosition(unsigned index,
unsigned *line,
unsigned *column,
StringLiteral **fileName) const
{ translationUnit()->getTokenPosition(index, line, column, fileName); }
void ASTVisitor::getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const
{ getPosition(tokenAt(index).begin(), line, column); }
void ASTVisitor::getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const
{ getPosition(tokenAt(index).end(), line, column); }
......@@ -67,6 +67,7 @@ public:
Control *control() const;
TranslationUnit *translationUnit() const;
const Token &tokenAt(unsigned index) const;
int tokenKind(unsigned index) const;
const char *spell(unsigned index) const;
Identifier *identifier(unsigned index) const;
......@@ -74,11 +75,19 @@ public:
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;
void accept(AST *ast);
virtual bool preVisit(AST *) { return true; }
......@@ -131,6 +131,7 @@ class Enum;
class ForwardClassDeclaration;
class Use;
class Token;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment