diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-09-21 15:11:18 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-09-21 15:14:28 +0200 |
commit | 6c9670c3db856f8be50cf89a03eefefeeb3f6392 (patch) | |
tree | 1a42e010966629d59c27ead8bece244e75764816 /src/libs/cplusplus/SimpleLexer.h | |
parent | caa164a4ab7094fa134031db1a04c1c469542f63 (diff) | |
download | qt-creator-6c9670c3db856f8be50cf89a03eefefeeb3f6392.tar.gz |
Use the backward scanner to indent labeled statements, ctor-initializers and access specifiers.
Diffstat (limited to 'src/libs/cplusplus/SimpleLexer.h')
-rw-r--r-- | src/libs/cplusplus/SimpleLexer.h | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/src/libs/cplusplus/SimpleLexer.h b/src/libs/cplusplus/SimpleLexer.h index 3f15193ee0..0775eccb1c 100644 --- a/src/libs/cplusplus/SimpleLexer.h +++ b/src/libs/cplusplus/SimpleLexer.h @@ -37,21 +37,18 @@ namespace CPlusPlus { class SimpleLexer; +class Token; class CPLUSPLUS_EXPORT SimpleToken { public: - SimpleToken(int kind, int position, int length, const QStringRef &text) - : _kind(kind) - , _position(position) - , _length(length) - , _text(text) - { } + SimpleToken(const Token &token, const QStringRef &text); SimpleToken() - : _kind(0), - _position(0), - _length(0) + : _kind(0) + , _flags(0) + , _position(0) + , _length(0) { } inline int kind() const @@ -72,6 +69,12 @@ public: inline QStringRef text() const { return _text; } + inline bool followsNewline() const + { return f._newline; } + + inline bool followsWhitespace() const + { return f._whitespace; } + inline bool is(int k) const { return _kind == k; } inline bool isNot(int k) const { return _kind != k; } @@ -81,8 +84,27 @@ public: bool isComment() const; bool isObjCAtKeyword() const; + const char *name() const; + + // internal + inline void setPosition(int position) + { _position = position; } + + // internal + inline void setText(const QStringRef &text) + { _text = text; } + public: - int _kind; + short _kind; + union { + short _flags; + + struct { + short _newline: 1; + short _whitespace: 1; + } f; + }; + int _position; int _length; QStringRef _text; |