mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix TestFileParser to support empty strings
Previously empty strings would be replaced with the token name, e.g. "string" in this case.
This commit is contained in:
parent
39f6286e9f
commit
f2a51bcf38
@ -503,9 +503,9 @@ void TestFileParser::Scanner::scanNextToken()
|
|||||||
return TokenDesc{Token::Identifier, _literal};
|
return TokenDesc{Token::Identifier, _literal};
|
||||||
};
|
};
|
||||||
|
|
||||||
auto selectToken = [this](Token _token, std::string const& _literal = "") -> TokenDesc {
|
auto selectToken = [this](Token _token, std::optional<std::string> _literal = std::nullopt) -> TokenDesc {
|
||||||
advance();
|
advance();
|
||||||
return make_pair(_token, !_literal.empty() ? _literal : formatToken(_token));
|
return make_pair(_token, _literal.has_value() ? *_literal : formatToken(_token));
|
||||||
};
|
};
|
||||||
|
|
||||||
TokenDesc token = make_pair(Token::Unknown, "");
|
TokenDesc token = make_pair(Token::Unknown, "");
|
||||||
|
@ -120,8 +120,6 @@ private:
|
|||||||
std::string m_line;
|
std::string m_line;
|
||||||
std::string::const_iterator m_char;
|
std::string::const_iterator m_char;
|
||||||
|
|
||||||
std::string m_currentLiteral;
|
|
||||||
|
|
||||||
TokenDesc m_currentToken;
|
TokenDesc m_currentToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user