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

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents ff5f9af9 66a3e715
...@@ -69,6 +69,9 @@ Control *ASTVisitor::control() const ...@@ -69,6 +69,9 @@ Control *ASTVisitor::control() const
TranslationUnit *ASTVisitor::translationUnit() const TranslationUnit *ASTVisitor::translationUnit() const
{ return _control->translationUnit(); } { return _control->translationUnit(); }
const Token &ASTVisitor::tokenAt(unsigned index) const
{ return translationUnit()->tokenAt(index); }
int ASTVisitor::tokenKind(unsigned index) const int ASTVisitor::tokenKind(unsigned index) const
{ return translationUnit()->tokenKind(index); } { return translationUnit()->tokenKind(index); }
...@@ -87,10 +90,22 @@ NumericLiteral *ASTVisitor::numericLiteral(unsigned index) const ...@@ -87,10 +90,22 @@ NumericLiteral *ASTVisitor::numericLiteral(unsigned index) const
StringLiteral *ASTVisitor::stringLiteral(unsigned index) const StringLiteral *ASTVisitor::stringLiteral(unsigned index) const
{ return translationUnit()->stringLiteral(index); } { 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, void ASTVisitor::getTokenPosition(unsigned index,
unsigned *line, unsigned *line,
unsigned *column, unsigned *column,
StringLiteral **fileName) const StringLiteral **fileName) const
{ translationUnit()->getTokenPosition(index, line, column, fileName); } { 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); }
CPLUSPLUS_END_NAMESPACE CPLUSPLUS_END_NAMESPACE
...@@ -67,6 +67,7 @@ public: ...@@ -67,6 +67,7 @@ public:
Control *control() const; Control *control() const;
TranslationUnit *translationUnit() const; TranslationUnit *translationUnit() const;
const Token &tokenAt(unsigned index) const;
int tokenKind(unsigned index) const; int tokenKind(unsigned index) const;
const char *spell(unsigned index) const; const char *spell(unsigned index) const;
Identifier *identifier(unsigned index) const; Identifier *identifier(unsigned index) const;
...@@ -74,11 +75,19 @@ public: ...@@ -74,11 +75,19 @@ public:
NumericLiteral *numericLiteral(unsigned index) const; NumericLiteral *numericLiteral(unsigned index) const;
StringLiteral *stringLiteral(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, void getTokenPosition(unsigned index,
unsigned *line, unsigned *line,
unsigned *column = 0, unsigned *column = 0,
StringLiteral **fileName = 0) const; 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); void accept(AST *ast);
virtual bool preVisit(AST *) { return true; } virtual bool preVisit(AST *) { return true; }
......
...@@ -131,6 +131,7 @@ class Enum; ...@@ -131,6 +131,7 @@ class Enum;
class ForwardClassDeclaration; class ForwardClassDeclaration;
class Use; class Use;
class Token;
CPLUSPLUS_END_NAMESPACE CPLUSPLUS_END_NAMESPACE
CPLUSPLUS_END_HEADER CPLUSPLUS_END_HEADER
......
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