mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #3382 from ethereum/julia-identifier-parser
Support some restricted tokens (return, byte, address) as identifier in Julia
This commit is contained in:
commit
bca01f8f68
@ -3,6 +3,7 @@
|
||||
Features:
|
||||
* Limit the number of warnings raised for creating abstract contracts.
|
||||
* Inline Assembly: Issue warning for using jump labels (already existed for jump instructions).
|
||||
* Inline Assembly: Support some restricted tokens (return, byte, address) as identifiers in Julia mode.
|
||||
* SMT Checker: If-else branch conditions are taken into account in the SMT encoding of the program
|
||||
variables.
|
||||
|
||||
|
@ -566,10 +566,16 @@ string Parser::expectAsmIdentifier()
|
||||
string name = currentLiteral();
|
||||
if (m_julia)
|
||||
{
|
||||
if (currentToken() == Token::Bool)
|
||||
switch (currentToken())
|
||||
{
|
||||
case Token::Return:
|
||||
case Token::Byte:
|
||||
case Token::Address:
|
||||
case Token::Bool:
|
||||
advance();
|
||||
return name;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (instructions().count(name))
|
||||
|
@ -196,6 +196,14 @@ BOOST_AUTO_TEST_CASE(empty_call)
|
||||
CHECK_ERROR("{ () }", ParserError, "Literal or identifier expected.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(tokens_as_identifers)
|
||||
{
|
||||
BOOST_CHECK(successParse("{ let return:u256 := 1:u256 }"));
|
||||
BOOST_CHECK(successParse("{ let byte:u256 := 1:u256 }"));
|
||||
BOOST_CHECK(successParse("{ let address:u256 := 1:u256 }"));
|
||||
BOOST_CHECK(successParse("{ let bool:u256 := 1:u256 }"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(lacking_types)
|
||||
{
|
||||
CHECK_ERROR("{ let x := 1:u256 }", ParserError, "Expected token Identifier got 'Assign'");
|
||||
|
Loading…
Reference in New Issue
Block a user