Do not emit Solidity-only tokens in the Scanner for Yul

And simplfiy AsmParser greatly.
This commit is contained in:
Alex Beregszaszi
2020-08-28 19:34:52 +01:00
parent bd7283ad22
commit caa329066e
10 changed files with 56 additions and 38 deletions
+3 -23
View File
@@ -284,12 +284,6 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
switch (currentToken())
{
case Token::Identifier:
case Token::Return:
case Token::Byte:
case Token::Bool:
case Token::Address:
case Token::Var:
case Token::In:
{
YulString literal{currentLiteral()};
if (m_dialect.builtin(literal))
@@ -472,24 +466,10 @@ TypedName Parser::parseTypedName()
YulString Parser::expectAsmIdentifier()
{
YulString name{currentLiteral()};
switch (currentToken())
{
case Token::Return:
case Token::Byte:
case Token::Address:
case Token::Bool:
case Token::Identifier:
case Token::Var:
case Token::In:
break;
default:
expectToken(Token::Identifier);
break;
}
if (m_dialect.builtin(name))
if (currentToken() == Token::Identifier && m_dialect.builtin(name))
fatalParserError(5568_error, "Cannot use builtin function name \"" + name.str() + "\" as identifier name.");
advance();
// NOTE: We keep the expectation here to ensure the correct source location for the error above.
expectToken(Token::Identifier);
return name;
}