From e3279d8af89c9b5e99e6bca206cb5ce6ef5b0291 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 17 Apr 2018 13:28:47 +0100 Subject: [PATCH 1/6] Display nicer error messages in the parser (display tokens and not internal names) --- Changelog.md | 1 + libsolidity/parsing/ParserBase.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Changelog.md b/Changelog.md index 817365b9d..737a11f1b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ Features: * Build System: Update internal dependency of jsoncpp to 1.8.4, which introduces more strictness and reduces memory usage. * Code Generator: Use native shift instructions on target Constantinople. * Optimizer: Remove unnecessary masking of the result of known short instructions (``ADDRESS``, ``CALLER``, ``ORIGIN`` and ``COINBASE``). + * Parser: Display nicer error messages by showing the actual tokens and not internal names. * Type Checker: Deprecate the ``years`` unit denomination and raise a warning for it (or an error as experimental 0.5.0 feature). * Type Checker: Make literals (without explicit type casting) an error for tight packing as experimental 0.5.0 feature. diff --git a/libsolidity/parsing/ParserBase.cpp b/libsolidity/parsing/ParserBase.cpp index 617a17799..1dd3bdd2e 100644 --- a/libsolidity/parsing/ParserBase.cpp +++ b/libsolidity/parsing/ParserBase.cpp @@ -71,10 +71,10 @@ void ParserBase::expectToken(Token::Value _value, bool _advance) if (Token::isReservedKeyword(tok)) { fatalParserError( - string("Expected token ") + - string(Token::name(_value)) + - string(" got reserved keyword '") + - string(Token::name(tok)) + + string("Expected '") + + string(Token::toString(_value)) + + string("' but got reserved keyword '") + + string(Token::toString(tok)) + string("'") ); } @@ -82,19 +82,19 @@ void ParserBase::expectToken(Token::Value _value, bool _advance) { ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); fatalParserError( - string("Expected token ") + - string(Token::name(_value)) + - string(" got '") + + string("Expected '") + + string(Token::toString(_value)) + + string("' but got '") + elemTypeName.toString() + string("'") ); } else fatalParserError( - string("Expected token ") + - string(Token::name(_value)) + - string(" got '") + - string(Token::name(m_scanner->currentToken())) + + string("Expected '") + + string(Token::toString(_value)) + + string("' but got '") + + string(Token::toString(m_scanner->currentToken())) + string("'") ); } From 252bde8542222953f4432c166d83ba6775a546da Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 18 Apr 2018 13:29:44 +0100 Subject: [PATCH 2/6] Introduce Token::friendlyName() helper --- libsolidity/parsing/ParserBase.cpp | 10 +++++----- libsolidity/parsing/Token.h | 11 +++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libsolidity/parsing/ParserBase.cpp b/libsolidity/parsing/ParserBase.cpp index 1dd3bdd2e..797dea712 100644 --- a/libsolidity/parsing/ParserBase.cpp +++ b/libsolidity/parsing/ParserBase.cpp @@ -72,9 +72,9 @@ void ParserBase::expectToken(Token::Value _value, bool _advance) { fatalParserError( string("Expected '") + - string(Token::toString(_value)) + + Token::friendlyName(_value) + string("' but got reserved keyword '") + - string(Token::toString(tok)) + + Token::friendlyName(tok) + string("'") ); } @@ -83,7 +83,7 @@ void ParserBase::expectToken(Token::Value _value, bool _advance) ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); fatalParserError( string("Expected '") + - string(Token::toString(_value)) + + Token::friendlyName(_value) + string("' but got '") + elemTypeName.toString() + string("'") @@ -92,9 +92,9 @@ void ParserBase::expectToken(Token::Value _value, bool _advance) else fatalParserError( string("Expected '") + - string(Token::toString(_value)) + + Token::friendlyName(_value) + string("' but got '") + - string(Token::toString(m_scanner->currentToken())) + + Token::friendlyName(tok) + string("'") ); } diff --git a/libsolidity/parsing/Token.h b/libsolidity/parsing/Token.h index 805fbf5d2..4d7a7bc68 100644 --- a/libsolidity/parsing/Token.h +++ b/libsolidity/parsing/Token.h @@ -304,6 +304,17 @@ public: return m_string[tok]; } + static std::string friendlyName(Value tok) + { + char const* ret = toString(tok); + if (ret == nullptr) + { + ret = name(tok); + solAssert(ret != nullptr, ""); + } + return std::string(ret); + } + // @returns the precedence > 0 for binary and compare // operators; returns 0 otherwise. static int precedence(Value tok) From 882248ce755d8c905b69bc25964b343906bb94ae Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 4 May 2018 13:07:43 +0100 Subject: [PATCH 3/6] Remove code duplication in expectToken --- libsolidity/parsing/ParserBase.cpp | 34 ++++++++++-------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/libsolidity/parsing/ParserBase.cpp b/libsolidity/parsing/ParserBase.cpp index 797dea712..8277ff46f 100644 --- a/libsolidity/parsing/ParserBase.cpp +++ b/libsolidity/parsing/ParserBase.cpp @@ -68,35 +68,23 @@ void ParserBase::expectToken(Token::Value _value, bool _advance) Token::Value tok = m_scanner->currentToken(); if (tok != _value) { + string got; if (Token::isReservedKeyword(tok)) - { - fatalParserError( - string("Expected '") + - Token::friendlyName(_value) + - string("' but got reserved keyword '") + - Token::friendlyName(tok) + - string("'") - ); - } + got = "reserved keyword '" + Token::friendlyName(tok) + "'"; else if (Token::isElementaryTypeName(tok)) //for the sake of accuracy in reporting { ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); - fatalParserError( - string("Expected '") + - Token::friendlyName(_value) + - string("' but got '") + - elemTypeName.toString() + - string("'") - ); + got = "'" + elemTypeName.toString() + "'"; } else - fatalParserError( - string("Expected '") + - Token::friendlyName(_value) + - string("' but got '") + - Token::friendlyName(tok) + - string("'") - ); + got = "'" + Token::friendlyName(tok) + "'"; + + fatalParserError( + string("Expected '") + + Token::friendlyName(_value) + + string("' but got ") + + got + ); } if (_advance) m_scanner->next(); From c7ee649d8033aedf49f83342c76984fe53449679 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 4 May 2018 13:26:23 +0100 Subject: [PATCH 4/6] More user friendly output in case of Identifier and Token keywords --- libsolidity/parsing/ParserBase.cpp | 31 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/libsolidity/parsing/ParserBase.cpp b/libsolidity/parsing/ParserBase.cpp index 8277ff46f..d0c7a5510 100644 --- a/libsolidity/parsing/ParserBase.cpp +++ b/libsolidity/parsing/ParserBase.cpp @@ -68,23 +68,24 @@ void ParserBase::expectToken(Token::Value _value, bool _advance) Token::Value tok = m_scanner->currentToken(); if (tok != _value) { - string got; - if (Token::isReservedKeyword(tok)) - got = "reserved keyword '" + Token::friendlyName(tok) + "'"; - else if (Token::isElementaryTypeName(tok)) //for the sake of accuracy in reporting + auto tokenName = [this](Token::Value _token) { - ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); - got = "'" + elemTypeName.toString() + "'"; - } - else - got = "'" + Token::friendlyName(tok) + "'"; + if (_token == Token::Identifier) + return string("identifier"); + else if (_token == Token::EOS) + return string("end of source"); + else if (Token::isReservedKeyword(_token)) + return string("reserved keyword '") + Token::friendlyName(_token) + "'"; + else if (Token::isElementaryTypeName(_token)) //for the sake of accuracy in reporting + { + ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); + return string("'") + elemTypeName.toString() + "'"; + } + else + return string("'") + Token::friendlyName(_token) + "'"; + }; - fatalParserError( - string("Expected '") + - Token::friendlyName(_value) + - string("' but got ") + - got - ); + fatalParserError(string("Expected ") + tokenName(_value) + string(" but got ") + tokenName(tok)); } if (_advance) m_scanner->next(); From cc108390737dfb8d774622d76e69e94485b0f7b5 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 2 May 2018 19:59:05 +0100 Subject: [PATCH 5/6] Have more uniform parser errors --- libsolidity/inlineasm/AsmParser.cpp | 8 ++++---- libsolidity/parsing/Parser.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 7f618e074..d3b0808b4 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -276,7 +276,7 @@ assembly::Expression Parser::parseExpression() int args = instructionInfo(instr.instruction).args; if (args > 0 && currentToken() != Token::LParen) fatalParserError(string( - "Expected token \"(\" (\"" + + "Expected '(' (instruction \"" + instructionNames().at(instr.instruction) + "\" expects " + boost::lexical_cast(args) + @@ -504,7 +504,7 @@ assembly::Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp) /// check for premature closing parentheses if (currentToken() == Token::RParen) fatalParserError(string( - "Expected expression (\"" + + "Expected expression (instruction \"" + instructionNames().at(instr) + "\" expects " + boost::lexical_cast(args) + @@ -516,7 +516,7 @@ assembly::Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp) { if (currentToken() != Token::Comma) fatalParserError(string( - "Expected comma (\"" + + "Expected ',' (instruction \"" + instructionNames().at(instr) + "\" expects " + boost::lexical_cast(args) + @@ -529,7 +529,7 @@ assembly::Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp) ret.location.end = endPosition(); if (currentToken() == Token::Comma) fatalParserError(string( - "Expected ')' (\"" + + "Expected ')' (instruction \"" + instructionNames().at(instr) + "\" expects " + boost::lexical_cast(args) + diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 37732a370..49745e29b 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -528,7 +528,7 @@ ASTPointer Parser::parseEnumDefinition() break; expectToken(Token::Comma); if (m_scanner->currentToken() != Token::Identifier) - fatalParserError(string("Expected Identifier after ','")); + fatalParserError(string("Expected identifier after ','")); } if (members.size() == 0) parserError({"enum with no members is not allowed."}); From 840ed1e88a8d70bdbc541a1330654cb1e730e298 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 2 May 2018 19:49:36 +0100 Subject: [PATCH 6/6] Update parser test expectations --- test/libjulia/Parser.cpp | 10 +++---- test/libsolidity/InlineAssembly.cpp | 26 +++++++++---------- test/libsolidity/SolidityParser.cpp | 2 +- test/libsolidity/StandardCompiler.cpp | 4 +-- .../function_type_constructor_local.sol | 2 +- .../parsing/constant_is_keyword.sol | 2 +- .../parsing/emit_without_event.sol | 2 +- .../parsing/event_with_no_argument_list.sol | 2 +- .../syntaxTests/parsing/external_variable.sol | 2 +- .../fixed_literal_with_double_radix.sol | 2 +- ...ype_as_storage_variable_with_modifiers.sol | 2 +- .../parsing/local_const_variable.sol | 2 +- ...ocation_specifiers_for_state_variables.sol | 2 +- .../parsing/malformed_enum_declaration.sol | 2 +- .../missing_parameter_name_in_named_args.sol | 2 +- .../missing_variable_name_in_declaration.sol | 2 +- .../parsing/modifier_without_semicolon.sol | 2 +- .../syntaxTests/parsing/payable_accessor.sol | 2 +- .../parsing/tuples_without_commas.sol | 2 +- .../syntaxTests/parsing/var_array.sol | 2 +- 20 files changed, 37 insertions(+), 37 deletions(-) diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp index 9d66658e1..96261decc 100644 --- a/test/libjulia/Parser.cpp +++ b/test/libjulia/Parser.cpp @@ -212,10 +212,10 @@ BOOST_AUTO_TEST_CASE(tokens_as_identifers) BOOST_AUTO_TEST_CASE(lacking_types) { - CHECK_ERROR("{ let x := 1:u256 }", ParserError, "Expected token Identifier got 'Assign'"); - CHECK_ERROR("{ let x:u256 := 1 }", ParserError, "Expected token Colon got 'RBrace'"); - CHECK_ERROR("{ function f(a) {} }", ParserError, "Expected token Colon got 'RParen'"); - CHECK_ERROR("{ function f(a:u256) -> b {} }", ParserError, "Expected token Colon got 'LBrace'"); + CHECK_ERROR("{ let x := 1:u256 }", ParserError, "Expected identifier but got '='"); + CHECK_ERROR("{ let x:u256 := 1 }", ParserError, "Expected ':' but got '}'"); + CHECK_ERROR("{ function f(a) {} }", ParserError, "Expected ':' but got ')'"); + CHECK_ERROR("{ function f(a:u256) -> b {} }", ParserError, "Expected ':' but got '{'"); } BOOST_AUTO_TEST_CASE(invalid_types) @@ -294,7 +294,7 @@ BOOST_AUTO_TEST_CASE(if_statement) BOOST_AUTO_TEST_CASE(if_statement_invalid) { CHECK_ERROR("{ if let x:u256 {} }", ParserError, "Literal or identifier expected."); - CHECK_ERROR("{ if true:bool let x:u256 := 3:u256 }", ParserError, "Expected token LBrace"); + CHECK_ERROR("{ if true:bool let x:u256 := 3:u256 }", ParserError, "Expected '{' but got reserved keyword 'let'"); // TODO change this to an error once we check types. BOOST_CHECK(successParse("{ if 42:u256 { } }")); } diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index 0ced17924..181ca959b 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(smoke_test) BOOST_AUTO_TEST_CASE(surplus_input) { - CHECK_PARSE_ERROR("{ } { }", ParserError, "Expected token EOS"); + CHECK_PARSE_ERROR("{ } { }", ParserError, "Expected end of source but got '{'"); } BOOST_AUTO_TEST_CASE(simple_instructions) @@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE(functional) BOOST_AUTO_TEST_CASE(functional_partial) { - CHECK_PARSE_ERROR("{ let x := byte }", ParserError, "Expected token \"(\""); + CHECK_PARSE_ERROR("{ let x := byte }", ParserError, "Expected '(' (instruction \"byte\" expects 2 arguments)"); } BOOST_AUTO_TEST_CASE(functional_partial_success) @@ -290,10 +290,10 @@ BOOST_AUTO_TEST_CASE(if_statement_scope) BOOST_AUTO_TEST_CASE(if_statement_invalid) { - CHECK_PARSE_ERROR("{ if mload {} }", ParserError, "Expected token \"(\""); + CHECK_PARSE_ERROR("{ if mload {} }", ParserError, "Expected '(' (instruction \"mload\" expects 1 arguments)"); BOOST_CHECK("{ if calldatasize() {}"); CHECK_PARSE_ERROR("{ if mstore(1, 1) {} }", ParserError, "Instruction \"mstore\" not allowed in this context"); - CHECK_PARSE_ERROR("{ if 32 let x := 3 }", ParserError, "Expected token LBrace"); + CHECK_PARSE_ERROR("{ if 32 let x := 3 }", ParserError, "Expected '{' but got reserved keyword 'let'"); } BOOST_AUTO_TEST_CASE(switch_statement) @@ -320,7 +320,7 @@ BOOST_AUTO_TEST_CASE(switch_duplicate_case) BOOST_AUTO_TEST_CASE(switch_invalid_expression) { CHECK_PARSE_ERROR("{ switch {} default {} }", ParserError, "Literal, identifier or instruction expected."); - CHECK_PARSE_ERROR("{ switch mload default {} }", ParserError, "Expected token \"(\""); + CHECK_PARSE_ERROR("{ switch mload default {} }", ParserError, "Expected '(' (instruction \"mload\" expects 1 arguments)"); CHECK_PARSE_ERROR("{ switch mstore(1, 1) default {} }", ParserError, "Instruction \"mstore\" not allowed in this context"); } @@ -341,7 +341,7 @@ BOOST_AUTO_TEST_CASE(switch_invalid_case) BOOST_AUTO_TEST_CASE(switch_invalid_body) { - CHECK_PARSE_ERROR("{ switch 42 case 1 mul case 2 {} default {} }", ParserError, "Expected token LBrace got 'Identifier'"); + CHECK_PARSE_ERROR("{ switch 42 case 1 mul case 2 {} default {} }", ParserError, "Expected '{' but got identifier"); } BOOST_AUTO_TEST_CASE(for_statement) @@ -353,10 +353,10 @@ BOOST_AUTO_TEST_CASE(for_statement) BOOST_AUTO_TEST_CASE(for_invalid_expression) { CHECK_PARSE_ERROR("{ for {} {} {} {} }", ParserError, "Literal, identifier or instruction expected."); - CHECK_PARSE_ERROR("{ for 1 1 {} {} }", ParserError, "Expected token LBrace got 'Number'"); - CHECK_PARSE_ERROR("{ for {} 1 1 {} }", ParserError, "Expected token LBrace got 'Number'"); - CHECK_PARSE_ERROR("{ for {} 1 {} 1 }", ParserError, "Expected token LBrace got 'Number'"); - CHECK_PARSE_ERROR("{ for {} mload {} {} }", ParserError, "Expected token \"(\""); + CHECK_PARSE_ERROR("{ for 1 1 {} {} }", ParserError, "Expected '{' but got 'Number'"); + CHECK_PARSE_ERROR("{ for {} 1 1 {} }", ParserError, "Expected '{' but got 'Number'"); + CHECK_PARSE_ERROR("{ for {} 1 {} 1 }", ParserError, "Expected '{' but got 'Number'"); + CHECK_PARSE_ERROR("{ for {} mload {} {} }", ParserError, "Expected '(' (instruction \"mload\" expects 1 arguments)"); CHECK_PARSE_ERROR("{ for {} mstore(1, 1) {} {} }", ParserError, "Instruction \"mstore\" not allowed in this context"); } @@ -437,13 +437,13 @@ BOOST_AUTO_TEST_CASE(invalid_tuple_assignment) BOOST_AUTO_TEST_CASE(instruction_too_few_arguments) { - CHECK_PARSE_ERROR("{ mul() }", ParserError, "Expected expression (\"mul\" expects 2 arguments)"); - CHECK_PARSE_ERROR("{ mul(1) }", ParserError, "Expected comma (\"mul\" expects 2 arguments)"); + CHECK_PARSE_ERROR("{ mul() }", ParserError, "Expected expression (instruction \"mul\" expects 2 arguments)"); + CHECK_PARSE_ERROR("{ mul(1) }", ParserError, "Expected ',' (instruction \"mul\" expects 2 arguments)"); } BOOST_AUTO_TEST_CASE(instruction_too_many_arguments) { - CHECK_PARSE_ERROR("{ mul(1, 2, 3) }", ParserError, "Expected ')' (\"mul\" expects 2 arguments)"); + CHECK_PARSE_ERROR("{ mul(1, 2, 3) }", ParserError, "Expected ')' (instruction \"mul\" expects 2 arguments)"); } BOOST_AUTO_TEST_CASE(recursion_depth) diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index f428f8925..77686b03c 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -992,7 +992,7 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved) for (const auto& keyword: keywords) { auto text = std::string("contract ") + keyword + " {}"; - CHECK_PARSE_ERROR(text.c_str(), "Expected token Identifier got reserved keyword"); + CHECK_PARSE_ERROR(text.c_str(), "Expected identifier but got reserved keyword"); } } diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index f816905c6..560c9013e 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -326,8 +326,8 @@ BOOST_AUTO_TEST_CASE(compilation_error) { BOOST_CHECK_EQUAL( dev::jsonCompactPrint(error), - "{\"component\":\"general\",\"formattedMessage\":\"fileA:1:23: ParserError: Expected token Identifier got 'RBrace'\\n" - "contract A { function }\\n ^\\n\",\"message\":\"Expected token Identifier got 'RBrace'\"," + "{\"component\":\"general\",\"formattedMessage\":\"fileA:1:23: ParserError: Expected identifier but got '}'\\n" + "contract A { function }\\n ^\\n\",\"message\":\"Expected identifier but got '}'\"," "\"severity\":\"error\",\"sourceLocation\":{\"end\":22,\"file\":\"fileA\",\"start\":22},\"type\":\"ParserError\"}" ); } diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_constructor_local.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_constructor_local.sol index b7763d282..766b98b30 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_constructor_local.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_constructor_local.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (118-118): Expected token Semicolon got 'Identifier' +// ParserError: (118-118): Expected ';' but got identifier diff --git a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol index 59fe8518d..da3fa1c69 100644 --- a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol +++ b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol @@ -2,4 +2,4 @@ contract Foo { uint constant = 4; } // ---- -// ParserError: (30-30): Expected token Identifier got 'Assign' +// ParserError: (30-30): Expected identifier but got '=' diff --git a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol index 5916fc2bb..1af1d4ab5 100644 --- a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol +++ b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (49-49): Expected token LParen got 'Semicolon' +// ParserError: (49-49): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol index ae2591db7..850c3627d 100644 --- a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol +++ b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol @@ -2,4 +2,4 @@ contract c { event e; } // ---- -// ParserError: (21-21): Expected token LParen got 'Semicolon' +// ParserError: (21-21): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/external_variable.sol b/test/libsolidity/syntaxTests/parsing/external_variable.sol index 1d2e65e65..2de70e23d 100644 --- a/test/libsolidity/syntaxTests/parsing/external_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/external_variable.sol @@ -2,4 +2,4 @@ contract c { uint external x; } // ---- -// ParserError: (19-19): Expected token Identifier got 'External' +// ParserError: (19-19): Expected identifier but got 'external' diff --git a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol index 43bb61faa..b3adc03da 100644 --- a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol +++ b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol @@ -2,4 +2,4 @@ contract A { fixed40x40 pi = 3.14.15; } // ---- -// ParserError: (34-34): Expected token Semicolon got 'Number' +// ParserError: (34-34): Expected ';' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol index 124804595..198d250b6 100644 --- a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol +++ b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol @@ -2,4 +2,4 @@ contract test { function (uint, uint) modifier1() returns (uint) f1; } // ---- -// ParserError: (66-66): Expected token LBrace got 'Identifier' +// ParserError: (66-66): Expected '{' but got identifier diff --git a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol index 556731601..f06e2501d 100644 --- a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol @@ -6,4 +6,4 @@ contract Foo { } } // ---- -// ParserError: (67-67): Expected token Semicolon got 'Constant' +// ParserError: (67-67): Expected ';' but got 'constant' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol index 0fc85177f..9cc7a4fa8 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol @@ -2,4 +2,4 @@ contract Foo { uint[] memory x; } // ---- -// ParserError: (23-23): Expected token Identifier got 'Memory' +// ParserError: (23-23): Expected identifier but got 'memory' diff --git a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol index 5a6eb270b..9fc7efff8 100644 --- a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol @@ -2,4 +2,4 @@ contract c { enum foo { WARNING,} } // ---- -// ParserError: (33-33): Expected Identifier after ',' +// ParserError: (33-33): Expected identifier after ',' diff --git a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol index 3604f3b21..b950c76ac 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({: 1, : 2, : 3}); } } // ---- -// ParserError: (143-143): Expected token Identifier got 'Colon' +// ParserError: (143-143): Expected identifier but got ':' diff --git a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol index bb1d015bc..15927f50c 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol @@ -2,4 +2,4 @@ contract test { uint256 ; } // ---- -// ParserError: (28-28): Expected token Identifier got 'Semicolon' +// ParserError: (28-28): Expected identifier but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol index 0d719db42..1b4888373 100644 --- a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol +++ b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol @@ -2,4 +2,4 @@ contract c { modifier mod { if (msg.sender == 0) _ } } // ---- -// ParserError: (52-52): Expected token Semicolon got 'RBrace' +// ParserError: (52-52): Expected ';' but got '}' diff --git a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol index 44b04afdf..46bf6e130 100644 --- a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol +++ b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol @@ -2,4 +2,4 @@ contract test { uint payable x; } // ---- -// ParserError: (22-22): Expected token Identifier got 'Payable' +// ParserError: (22-22): Expected identifier but got 'payable' diff --git a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol index d0e376b0b..e283e0bbf 100644 --- a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol +++ b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (42-42): Expected token Comma got 'Number' +// ParserError: (42-42): Expected ',' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/var_array.sol b/test/libsolidity/syntaxTests/parsing/var_array.sol index 86fc4fcbf..d635a04b0 100644 --- a/test/libsolidity/syntaxTests/parsing/var_array.sol +++ b/test/libsolidity/syntaxTests/parsing/var_array.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var[] a; } } // ---- -// ParserError: (34-34): Expected token Identifier got 'LBrack' +// ParserError: (34-34): Expected identifier but got '['