Introduce TokenTraits::isYulKeyword helper

This commit is contained in:
Alex Beregszaszi 2020-07-06 18:19:08 +01:00
parent 8402baa45b
commit 2ebc4bb9a7
2 changed files with 7 additions and 0 deletions

View File

@ -152,6 +152,11 @@ static Token keywordByName(string const& _name)
return it == keywords.end() ? Token::Identifier : it->second;
}
bool isYulKeyword(string const& _literal)
{
return _literal == "leave" || isYulKeyword(keywordByName(_literal));
}
tuple<Token, unsigned int, unsigned int> fromIdentifierOrKeyword(string const& _literal)
{
auto positionM = find_if(_literal.begin(), _literal.end(), ::isdigit);

View File

@ -327,6 +327,8 @@ namespace TokenTraits
tok == Token::TrueLiteral || tok == Token::FalseLiteral || tok == Token::HexStringLiteral || tok == Token::Hex;
}
bool isYulKeyword(std::string const& _literal);
inline Token AssignmentToBinaryOp(Token op)
{
solAssert(isAssignmentOp(op) && op != Token::Assign, "");