summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/SimpleLexer.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-02-07 15:24:30 +0100
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2014-12-18 15:46:22 +0100
commit242b3f4110ebbe3882e28b7df75c26768c5f9ecc (patch)
treedaab9f47f597ab278d97c8e737df68efc54f523f /src/libs/cplusplus/SimpleLexer.cpp
parent16becbd29c44e664904a7fb2d698f79fc08b2731 (diff)
downloadqt-creator-242b3f4110ebbe3882e28b7df75c26768c5f9ecc.tar.gz
C++: clean up numeric literal parsing and add support for n3472.
Separate the messy pp-number parsing from the numeric literal parsing. The C/C++ preprocessor makes a grown man cry, but at least we have "proper" literal parsing when we want it, including C++1y binary literals. Next step is digit separators (n3781). Change-Id: Ia069eef454ed5c056f77694a5b8a595d0b76adc4 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/libs/cplusplus/SimpleLexer.cpp')
-rw-r--r--src/libs/cplusplus/SimpleLexer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp
index db76bb4c09..f379e5c91b 100644
--- a/src/libs/cplusplus/SimpleLexer.cpp
+++ b/src/libs/cplusplus/SimpleLexer.cpp
@@ -41,7 +41,8 @@ using namespace CPlusPlus;
SimpleLexer::SimpleLexer()
: _lastState(0),
_skipComments(false),
- _endedJoined(false)
+ _endedJoined(false),
+ _ppMode(false)
{}
SimpleLexer::~SimpleLexer()
@@ -73,6 +74,7 @@ Tokens SimpleLexer::operator()(const QString &text, int state)
Lexer lex(firstChar, lastChar);
lex.setLanguageFeatures(_languageFeatures);
lex.setStartWithNewline(true);
+ lex.setPreprocessorMode(_ppMode);
if (! _skipComments)
lex.setScanCommentTokens(true);