diff options
Diffstat (limited to 'src/libs/3rdparty/cplusplus')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Lexer.cpp | 44 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/Lexer.h | 1 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/Token.h | 4 |
3 files changed, 47 insertions, 2 deletions
diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp index db7cb9e0f83..68f87f126c1 100644 --- a/src/libs/3rdparty/cplusplus/Lexer.cpp +++ b/src/libs/3rdparty/cplusplus/Lexer.cpp @@ -336,20 +336,62 @@ void Lexer::scan_helper(Token *tok) break; case '?': - if (_yychar == '?') { + if (_yychar == '?' && f._ppMode) { yyinp(); if (_yychar == '(') { yyinp(); tok->f.kind = T_LBRACKET; + tok->f.trigraph = true; } else if (_yychar == ')') { yyinp(); tok->f.kind = T_RBRACKET; + tok->f.trigraph = true; } else if (_yychar == '<') { yyinp(); tok->f.kind = T_LBRACE; + tok->f.trigraph = true; } else if (_yychar == '>') { yyinp(); tok->f.kind = T_RBRACE; + tok->f.trigraph = true; + } else if (_yychar == '=') { + yyinp(); + tok->f.trigraph = true; + if (_yychar == '?' && *(_currentChar + 1) == '?' && *(_currentChar + 2) == '=') { + yyinp(); + yyinp(); + yyinp(); + tok->f.kind = T_POUND_POUND; + } else { + tok->f.kind = T_POUND; + } + } else if (_yychar == '\'') { + yyinp(); + if (_yychar == '=') { + yyinp(); + tok->f.kind = T_CARET_EQUAL; + } else { + tok->f.kind = T_CARET; + } + tok->f.trigraph = true; + } else if (_yychar == '!') { + yyinp(); + if (_yychar == '=') { + yyinp(); + tok->f.kind = T_PIPE_EQUAL; + } else { + tok->f.kind = T_PIPE; + } + tok->f.trigraph = true; + } else if (_yychar == '-') { + yyinp(); + if (_yychar == '=') { + yyinp(); + tok->f.kind = T_TILDE_EQUAL; + } else { + tok->f.kind = T_TILDE; + } + tok->f.trigraph = true; } } else { tok->f.kind = T_QUESTION; diff --git a/src/libs/3rdparty/cplusplus/Lexer.h b/src/libs/3rdparty/cplusplus/Lexer.h index d47dcdf12ae..8e862ea54c4 100644 --- a/src/libs/3rdparty/cplusplus/Lexer.h +++ b/src/libs/3rdparty/cplusplus/Lexer.h @@ -125,6 +125,7 @@ private: unsigned _scanKeywords: 1; unsigned _scanAngleStringLiteralTokens: 1; unsigned _ppMode: 1; + unsigned _ignoreTrigraph : 1; }; struct State { diff --git a/src/libs/3rdparty/cplusplus/Token.h b/src/libs/3rdparty/cplusplus/Token.h index 39a74031c9e..afe732d4931 100644 --- a/src/libs/3rdparty/cplusplus/Token.h +++ b/src/libs/3rdparty/cplusplus/Token.h @@ -371,8 +371,10 @@ public: // The token is C++11 user-defined literal such as: // 12_km, 0.5_Pa, 'c'_X, "abd"_L, u16"xyz"_M unsigned userDefinedLiteral : 1; + // Indicates the token is a trigraph + unsigned trigraph : 1; // Unused... - unsigned pad : 2; + unsigned pad : 1; // The token length in bytes and UTF16 chars. unsigned bytes : 16; unsigned utf16chars : 16; |