diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-06-04 12:37:26 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-06-04 12:37:26 +0200 |
commit | 424b9724d6dc4f860cfb8da17d51a715684ad94c (patch) | |
tree | 921120642920dd72762ebeef6919181130ccf4f7 /src/libs/cplusplus/TokenUnderCursor.cpp | |
parent | 5f749306f11dbfd31a6f740ab9b1cb108476e202 (diff) | |
download | qt-creator-424b9724d6dc4f860cfb8da17d51a715684ad94c.tar.gz |
Revert "Introduced a token cache for the C++ editor."
This reverts commit c2393df02332618c8cf6159d9d6f6a40041ced89.
Diffstat (limited to 'src/libs/cplusplus/TokenUnderCursor.cpp')
-rw-r--r-- | src/libs/cplusplus/TokenUnderCursor.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libs/cplusplus/TokenUnderCursor.cpp b/src/libs/cplusplus/TokenUnderCursor.cpp index c1b4b19247..5cbcdfc7a2 100644 --- a/src/libs/cplusplus/TokenUnderCursor.cpp +++ b/src/libs/cplusplus/TokenUnderCursor.cpp @@ -28,14 +28,12 @@ **************************************************************************/ #include "TokenUnderCursor.h" -#include "TokenCache.h" -#include "TokenCache.h" +#include "BackwardsScanner.h" #include <Token.h> #include <QTextCursor> #include <QTextBlock> #include <climits> -#include <QTextDocument> using namespace CPlusPlus; @@ -45,13 +43,17 @@ TokenUnderCursor::TokenUnderCursor() TokenUnderCursor::~TokenUnderCursor() { } -SimpleToken TokenUnderCursor::operator()(TokenCache *cache, const QTextCursor &cursor, QTextBlock *b) +SimpleToken TokenUnderCursor::operator()(const QTextCursor &cursor, QTextBlock *b) { + SimpleLexer tokenize; + tokenize.setObjCEnabled(true); + tokenize.setSkipComments(false); + QTextBlock block = cursor.block(); int column = cursor.position() - cursor.block().position(); _text = block.text(); - _tokens = cache->tokensForBlock(block); + _tokens = tokenize(_text, BackwardsScanner::previousBlockState(block)); for (int index = _tokens.size() - 1; index != -1; --index) { const SimpleToken &tk = _tokens.at(index); if (tk.position() < column) { |