aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/cplusplus/Lexer.cpp
diff options
context:
space:
mode:
authorFrancois Ferrand <thetypz@gmail.com>2015-03-14 12:53:43 +0100
committerFrancois Ferrand <thetypz@gmail.com>2016-03-08 17:24:33 +0000
commit27deb9c876b7a5a35a7445dc96a65eec5f9eb60d (patch)
tree6e9d89b6aaf731ec0cd8ad58f635433e0c888794 /src/libs/3rdparty/cplusplus/Lexer.cpp
parentdc7b6ca6c376714dc65d170f693e40263f422739 (diff)
C++: fix digraph parsing for <:: exception.
According to section 2.5 from the standard: """ If the input stream has been parsed into preprocessing tokens up to a given character: ... Otherwise, if the next three characters are <:: and the subsequent character is neither : nor >, the < is treated as a preprocessor token by itself and not as the first character of the alternative token <:. """ Change-Id: Ib9cdac61e3c2243d1bc1d4471a09ae6bd839fdda Task-number: QTCREATORBUG-13253 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Lexer.cpp')
-rw-r--r--src/libs/3rdparty/cplusplus/Lexer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp
index a508ce3d30..feddf3a5d0 100644
--- a/src/libs/3rdparty/cplusplus/Lexer.cpp
+++ b/src/libs/3rdparty/cplusplus/Lexer.cpp
@@ -610,8 +610,12 @@ void Lexer::scan_helper(Token *tok)
yyinp();
tok->f.kind = T_LESS_EQUAL;
} else if (_yychar == ':') {
- yyinp();
- tok->f.kind = T_LBRACKET;
+ if (*(_currentChar+1) != ':' || *(_currentChar+2) == ':' || *(_currentChar+2) == '>') {
+ yyinp();
+ tok->f.kind = T_LBRACKET;
+ } else {
+ tok->f.kind = T_LESS;
+ }
} else if (_yychar == '%') {
yyinp();
tok->f.kind = T_LBRACE;