diff --git a/lib/token.cpp b/lib/token.cpp index 9016bb168..620b2110b 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -65,7 +65,7 @@ void Token::update_property_info() if (!_str.empty()) { if (_str == "true" || _str == "false") _tokType = eBoolean; - else if (_str[0] == '_' || std::isalpha((unsigned char)_str[0])) { // Name + else if (std::isalpha((unsigned char)_str[0]) || _str[0] == '_' || _str[0] == '$') { // Name if (_varId) _tokType = eVariable; else if (_tokType != eVariable && _tokType != eFunction && _tokType != eType && _tokType != eKeyword) diff --git a/test/testtoken.cpp b/test/testtoken.cpp index f15f8b292..6782b27e8 100644 --- a/test/testtoken.cpp +++ b/test/testtoken.cpp @@ -85,6 +85,7 @@ private: TEST_CASE(isNameGuarantees3) TEST_CASE(isNameGuarantees4) TEST_CASE(isNameGuarantees5) + TEST_CASE(isNameGuarantees6) TEST_CASE(canFindMatchingBracketsNeedsOpen); TEST_CASE(canFindMatchingBracketsInnerPair); @@ -888,6 +889,11 @@ private: ASSERT_EQUALS(false, tok.isNumber()); } + void isNameGuarantees6() const { + Token tok(nullptr); + tok.str("$f"); + ASSERT_EQUALS(true, tok.isName()); + } void canFindMatchingBracketsNeedsOpen() const { givenACodeSampleToTokenize var("std::deque > intsets;");