mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Make `abstract
` keyword instead of reserved
This commit is contained in:
parent
5b8ff78176
commit
caa127e2a8
@ -143,6 +143,7 @@ namespace langutil
|
||||
/* Inline Assembly Operators */ \
|
||||
T(AssemblyAssign, ":=", 2) \
|
||||
/* Keywords */ \
|
||||
K(Abstract, "abstract", 0) \
|
||||
K(Anonymous, "anonymous", 0) \
|
||||
K(As, "as", 0) \
|
||||
K(Assembly, "assembly", 0) \
|
||||
@ -231,7 +232,6 @@ namespace langutil
|
||||
T(Identifier, nullptr, 0) \
|
||||
\
|
||||
/* Keywords reserved for future use. */ \
|
||||
K(Abstract, "abstract", 0) \
|
||||
K(After, "after", 0) \
|
||||
K(Alias, "alias", 0) \
|
||||
K(Apply, "apply", 0) \
|
||||
@ -313,7 +313,7 @@ namespace TokenTraits
|
||||
|
||||
constexpr bool isEtherSubdenomination(Token op) { return op == Token::SubWei || op == Token::SubSzabo || op == Token::SubFinney || op == Token::SubEther; }
|
||||
constexpr bool isTimeSubdenomination(Token op) { return op == Token::SubSecond || op == Token::SubMinute || op == Token::SubHour || op == Token::SubDay || op == Token::SubWeek || op == Token::SubYear; }
|
||||
constexpr bool isReservedKeyword(Token op) { return (Token::Abstract <= op && op <= Token::Unchecked); }
|
||||
constexpr bool isReservedKeyword(Token op) { return (Token::After <= op && op <= Token::Unchecked); }
|
||||
|
||||
inline Token AssignmentToBinaryOp(Token op)
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ BOOST_AUTO_TEST_SUITE(SolidityParser)
|
||||
BOOST_AUTO_TEST_CASE(reserved_keywords)
|
||||
{
|
||||
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Identifier));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Abstract));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::After));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Unchecked));
|
||||
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Illegal));
|
||||
}
|
||||
@ -532,7 +532,6 @@ BOOST_AUTO_TEST_CASE(multiple_visibility_specifiers)
|
||||
BOOST_AUTO_TEST_CASE(keyword_is_reserved)
|
||||
{
|
||||
auto keywords = {
|
||||
"abstract",
|
||||
"after",
|
||||
"alias",
|
||||
"apply",
|
||||
@ -568,6 +567,8 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved)
|
||||
"unchecked"
|
||||
};
|
||||
|
||||
BOOST_CHECK_EQUAL(std::size(keywords), static_cast<int>(Token::Unchecked) - static_cast<int>(Token::After) + 1);
|
||||
|
||||
for (auto const& keyword: keywords)
|
||||
{
|
||||
auto text = std::string("contract ") + keyword + " {}";
|
||||
|
Loading…
Reference in New Issue
Block a user