summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/SimpleLexer.h
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-09-21 15:11:18 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2009-09-21 15:14:28 +0200
commit6c9670c3db856f8be50cf89a03eefefeeb3f6392 (patch)
tree1a42e010966629d59c27ead8bece244e75764816 /src/libs/cplusplus/SimpleLexer.h
parentcaa164a4ab7094fa134031db1a04c1c469542f63 (diff)
downloadqt-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.h42
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;