Skip to content

Commit fe5053f

Browse files
committed
fix #14077
* allow member access on user defined literals * allow (tokens that look like) user defined literals in msvc asm blocks
1 parent 6570cfc commit fe5053f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/token.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void Token::update_property_info()
154154
if ((MathLib::isInt(mStr) || MathLib::isFloat(mStr)) && mStr.find('_') == std::string::npos)
155155
tokType(eNumber);
156156
else
157-
tokType(eName); // assume it is a user defined literal
157+
tokType(eLiteral); // assume it is a user defined literal
158158
} else if (mStr == "=" || mStr == "<<=" || mStr == ">>=" ||
159159
(mStr.size() == 2U && mStr[1] == '=' && std::strchr("+-*/%&^|", mStr[0])))
160160
tokType(eAssignmentOp);

lib/tokenize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8869,6 +8869,7 @@ void Tokenizer::findGarbageCode() const
88698869
!Token::simpleMatch(tok->previous(), ".") &&
88708870
!Token::simpleMatch(tok->next(), ".") &&
88718871
!Token::Match(tok->previous(), "{|, . %name% =|.|[|{") &&
8872+
!(tok->previous() && tok->previous()->isLiteral()) &&
88728873
!Token::Match(tok->previous(), ", . %name%")) {
88738874
if (!Token::Match(tok->previous(), "%name%|)|]|>|}"))
88748875
syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1));
@@ -9847,7 +9848,7 @@ void Tokenizer::simplifyAsm()
98479848
Token *endasm = tok->next();
98489849
const Token *firstSemiColon = nullptr;
98499850
int comment = 0;
9850-
while (Token::Match(endasm, "%num%|%name%|,|:|;") || (endasm && endasm->linenr() == comment)) {
9851+
while (Token::Match(endasm, "%num%|%name%|,|:|;") || (endasm && endasm->isLiteral()) || (endasm && endasm->linenr() == comment)) {
98519852
if (Token::Match(endasm, "_asm|__asm|__endasm"))
98529853
break;
98539854
if (endasm->str() == ";") {

0 commit comments

Comments
 (0)