diff options
Diffstat (limited to 'libsolidity/inlineasm/AsmParser.cpp')
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 7ecad5ea..a96984f5 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -206,10 +206,29 @@ assembly::Statement Parser::parseElementaryOperation(bool _onlySinglePusher) } case Token::StringLiteral: case Token::Number: + case Token::TrueLiteral: + case Token::FalseLiteral: { + LiteralKind kind = LiteralKind::Number; + switch (m_scanner->currentToken()) + { + case Token::StringLiteral: + kind = LiteralKind::String; + break; + case Token::Number: + kind = LiteralKind::Number; + break; + case Token::TrueLiteral: + case Token::FalseLiteral: + kind = LiteralKind::Boolean; + break; + default: + break; + } + Literal literal{ location(), - m_scanner->currentToken() == Token::Number, + kind, m_scanner->currentLiteral(), "" }; @@ -220,6 +239,8 @@ assembly::Statement Parser::parseElementaryOperation(bool _onlySinglePusher) literal.location.end = endPosition(); literal.type = expectAsmIdentifier(); } + else if (kind == LiteralKind::Boolean) + fatalParserError("True and false are not valid literals."); ret = std::move(literal); break; } @@ -360,7 +381,15 @@ TypedName Parser::parseTypedName() string Parser::expectAsmIdentifier() { string name = m_scanner->currentLiteral(); - if (!m_julia && instructions().count(name)) + if (m_julia) + { + if (m_scanner->currentToken() == Token::Bool) + { + m_scanner->next(); + return name; + } + } + else if (instructions().count(name)) fatalParserError("Cannot use instruction names for identifier names."); expectToken(Token::Identifier); return name; |