Merge pull request #3627 from ethereum/additional-keywords

[BREAKING] Add new reserved keywords.
This commit is contained in:
Alex Beregszaszi
2018-06-12 16:33:26 +01:00
committed by GitHub
4 changed files with 48 additions and 5 deletions
+20 -2
View File
@@ -491,28 +491,46 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved)
auto keywords = {
"abstract",
"after",
"alias",
"apply",
"auto",
"case",
"catch",
"copyof",
"default",
"define",
"final",
"immutable",
"implements",
"in",
"inline",
"let",
"macro",
"match",
"mutable",
"null",
"of",
"override",
"partial",
"promise",
"reference",
"relocatable",
"sealed",
"sizeof",
"static",
"supports",
"switch",
"try",
"type",
"typeof"
"typedef",
"typeof",
"unchecked"
};
for (const auto& keyword: keywords)
{
auto text = std::string("contract ") + keyword + " {}";
CHECK_PARSE_ERROR(text.c_str(), "Expected identifier but got reserved keyword");
CHECK_PARSE_ERROR(text.c_str(), string("Expected identifier but got reserved keyword '") + keyword + "'");
}
}