diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-12-13 18:41:15 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-05-15 15:55:38 +0200 |
commit | 126e69137a7b3cfdf86832c2561f1dde311e9ad6 (patch) | |
tree | a884d65be6c50dfbd876091c295bfd0245f8f30d /src/libs/3rdparty/cplusplus/Token.h | |
parent | ba76baa65fa9ad4d1f3154639be385c7b49dc1dd (diff) |
C++: Clarify units of a Token
This will avoid confusion when later more length and indices methods are
added.
In Token:
length() --> bytes()
begin() --> bytesBegin()
end() --> bytesEnd()
Change-Id: I244c69b022e239ee762b4114559e707f93ff344f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Token.h')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Token.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/libs/3rdparty/cplusplus/Token.h b/src/libs/3rdparty/cplusplus/Token.h index 8889df0653..02d7f5ebe9 100644 --- a/src/libs/3rdparty/cplusplus/Token.h +++ b/src/libs/3rdparty/cplusplus/Token.h @@ -285,7 +285,7 @@ enum Kind { class CPLUSPLUS_EXPORT Token { public: - Token() : flags(0), offset(0), ptr(0) {} + Token() : flags(0), byteOffset(0), ptr(0) {} inline bool is(unsigned k) const { return f.kind == k; } inline bool isNot(unsigned k) const { return f.kind != k; } @@ -298,13 +298,13 @@ public: inline bool joined() const { return f.joined; } inline bool expanded() const { return f.expanded; } inline bool generated() const { return f.generated; } - inline unsigned length() const { return f.length; } + inline unsigned bytes() const { return f.bytes; } - inline unsigned begin() const - { return offset; } + inline unsigned bytesBegin() const + { return byteOffset; } - inline unsigned end() const - { return offset + f.length; } + inline unsigned bytesEnd() const + { return byteOffset + f.bytes; } inline bool isLiteral() const { return f.kind >= T_FIRST_LITERAL && f.kind <= T_LAST_LITERAL; } @@ -333,15 +333,15 @@ public: public: struct Flags { // The token kind. - unsigned kind : 8; + unsigned kind : 8; // The token starts a new line. - unsigned newline : 1; - // The token is preceded by whitespace(s). - unsigned whitespace : 1; + unsigned newline : 1; + // The token is preceeded by whitespace(s). + unsigned whitespace : 1; // The token is joined with the previous one. - unsigned joined : 1; + unsigned joined : 1; // The token originates from a macro expansion. - unsigned expanded : 1; + unsigned expanded : 1; // The token originates from a macro expansion and does not correspond to an // argument that went through substitution. Notice the example: // @@ -351,18 +351,18 @@ public: // After preprocessing we would expect the following tokens: 1 + 2; // Tokens '1', '+', '2', and ';' are all expanded. However only tokens '+' and ';' // are generated. - unsigned generated : 1; + unsigned generated : 1; // Unused... - unsigned pad : 3; - // The token length. - unsigned length : 16; + unsigned pad : 3; + // The token length in bytes. + unsigned bytes : 16; }; union { unsigned flags; Flags f; }; - unsigned offset; + unsigned byteOffset; union { void *ptr; |