diff options
author | hjk <qtc-committer@nokia.com> | 2009-02-23 16:07:28 +0100 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2009-02-23 16:07:28 +0100 |
commit | c6821e8a923d04402501465bbd47246e7ca34a9a (patch) | |
tree | 424702541473322dee1fb159e1b83af4718e82c6 /src/libs | |
parent | 3cfea5bbc14277e94727cf8d29e588511ef420a6 (diff) | |
parent | e330d9666855fe8cc87eba203d851b2fe4c18eec (diff) | |
download | qt-creator-c6821e8a923d04402501465bbd47246e7ca34a9a.tar.gz |
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/cplusplus/PreprocessorEnvironment.cpp | 24 | ||||
-rw-r--r-- | src/libs/cplusplus/PreprocessorEnvironment.h | 4 | ||||
-rw-r--r-- | src/libs/cplusplus/SimpleLexer.cpp | 5 | ||||
-rw-r--r-- | src/libs/cplusplus/SimpleLexer.h | 1 | ||||
-rw-r--r-- | src/libs/cplusplus/TokenUnderCursor.cpp | 3 |
5 files changed, 37 insertions, 0 deletions
diff --git a/src/libs/cplusplus/PreprocessorEnvironment.cpp b/src/libs/cplusplus/PreprocessorEnvironment.cpp index 930e4b3a6c..5d52e6e53f 100644 --- a/src/libs/cplusplus/PreprocessorEnvironment.cpp +++ b/src/libs/cplusplus/PreprocessorEnvironment.cpp @@ -117,6 +117,13 @@ Macro *Environment::bind(const Macro &__macro) return m; } +void Environment::addMacros(const QList<Macro> ¯os) +{ + foreach (const Macro ¯o, macros) { + bind(macro); + } +} + Macro *Environment::remove(const QByteArray &name) { Macro macro; @@ -127,6 +134,23 @@ Macro *Environment::remove(const QByteArray &name) return bind(macro); } +void Environment::reset() +{ + if (_macros) { + qDeleteAll(firstMacro(), lastMacro()); + free(_macros); + } + + if (_hash) + free(_hash); + + _macros = 0; + _allocated_macros = 0; + _macro_count = -1; + _hash = 0; + _hash_count = 401; +} + bool Environment::isBuiltinMacro(const QByteArray &s) const { if (s.length() != 8) diff --git a/src/libs/cplusplus/PreprocessorEnvironment.h b/src/libs/cplusplus/PreprocessorEnvironment.h index 7f712cd49c..9e0163cfb6 100644 --- a/src/libs/cplusplus/PreprocessorEnvironment.h +++ b/src/libs/cplusplus/PreprocessorEnvironment.h @@ -56,6 +56,7 @@ #include "CPlusPlusForwardDeclarations.h" #include <QVector> +#include <QList> #include <QByteArray> namespace CPlusPlus { @@ -89,6 +90,9 @@ public: Macro **lastMacro() { return _macros + _macro_count + 1; } + void reset(); + void addMacros(const QList<Macro> ¯os); + private: static unsigned hashCode(const QByteArray &s); void rehash(); diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp index 5efa1f02d8..85ad6e645d 100644 --- a/src/libs/cplusplus/SimpleLexer.cpp +++ b/src/libs/cplusplus/SimpleLexer.cpp @@ -54,6 +54,11 @@ bool SimpleToken::isKeyword() const return _kind >= T_FIRST_KEYWORD && _kind < T_FIRST_QT_KEYWORD; } +bool SimpleToken::isComment() const +{ + return _kind == T_COMMENT || _kind == T_DOXY_COMMENT; +} + SimpleLexer::SimpleLexer() : _lastState(0), _skipComments(false), diff --git a/src/libs/cplusplus/SimpleLexer.h b/src/libs/cplusplus/SimpleLexer.h index ed48e9360b..cbcb4e1f6b 100644 --- a/src/libs/cplusplus/SimpleLexer.h +++ b/src/libs/cplusplus/SimpleLexer.h @@ -69,6 +69,7 @@ public: bool isLiteral() const; bool isOperator() const; bool isKeyword() const; + bool isComment() const; public: int _kind; diff --git a/src/libs/cplusplus/TokenUnderCursor.cpp b/src/libs/cplusplus/TokenUnderCursor.cpp index d103a0307f..0caf324076 100644 --- a/src/libs/cplusplus/TokenUnderCursor.cpp +++ b/src/libs/cplusplus/TokenUnderCursor.cpp @@ -49,6 +49,9 @@ TokenUnderCursor::~TokenUnderCursor() SimpleToken TokenUnderCursor::operator()(const QTextCursor &cursor) const { SimpleLexer tokenize; + tokenize.setObjCEnabled(true); + tokenize.setSkipComments(false); + QTextBlock block = cursor.block(); int column = cursor.columnNumber(); |