C++: Remove Lexer::{tokenOffset(),tokenLength()}

The necessary data can be retrieved by the resulting Token.

Change-Id: I79afb23183c156240c690beff30bb11dfe943e61
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2014-02-25 11:38:32 -03:00
parent 6f63f6b647
commit a9c15c0bf5
3 changed files with 1 additions and 10 deletions

View File

@@ -104,12 +104,6 @@ void Lexer::pushLineStartOffset()
_translationUnit->pushLineOffset(_currentChar - _firstChar); _translationUnit->pushLineOffset(_currentChar - _firstChar);
} }
unsigned Lexer::tokenOffset() const
{ return _tokenStart - _firstChar; }
unsigned Lexer::tokenLength() const
{ return _currentChar - _tokenStart; }
void Lexer::scan(Token *tok) void Lexer::scan(Token *tok)
{ {
tok->reset(); tok->reset();

View File

@@ -44,9 +44,6 @@ public:
inline void operator()(Token *tok) inline void operator()(Token *tok)
{ scan(tok); } { scan(tok); }
unsigned tokenOffset() const;
unsigned tokenLength() const;
bool scanCommentTokens() const; bool scanCommentTokens() const;
void setScanCommentTokens(bool onoff); void setScanCommentTokens(bool onoff);

View File

@@ -89,7 +89,7 @@ QList<Token> SimpleLexer::operator()(const QString &text, int state)
break; break;
} }
QStringRef spell = text.midRef(lex.tokenOffset(), lex.tokenLength()); QStringRef spell = text.midRef(tk.begin(), tk.length());
lex.setScanAngleStringLiteralTokens(false); lex.setScanAngleStringLiteralTokens(false);
if (tk.f.newline && tk.is(T_POUND)) if (tk.f.newline && tk.is(T_POUND))