aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-23 19:25:29 +0800
committerchriseth <c@ethdev.com>2015-10-23 19:25:29 +0800
commit7a9f8d9f35ee3791ba4e41bcee224fbffa9d2b28 (patch)
treef30359769a06b4be70a5dc1c78752e5407da01a9 /libsolidity
parentcefe9ae8224483e3ecc399ccbed122c489ae2b62 (diff)
parentd8865f9f0540a4aff270a9c2caf5d63c3d70e7c4 (diff)
downloaddexon-solidity-7a9f8d9f35ee3791ba4e41bcee224fbffa9d2b28.tar.gz
dexon-solidity-7a9f8d9f35ee3791ba4e41bcee224fbffa9d2b28.tar.zst
dexon-solidity-7a9f8d9f35ee3791ba4e41bcee224fbffa9d2b28.zip
Merge pull request #171 from LianaHus/sol_change_expected_error_in_parser
Sol change "expected" errors in parser
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/parsing/Parser.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index 57f3e913..35872f78 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -1180,7 +1180,13 @@ ASTPointer<Expression> Parser::expressionFromIndexAccessStructure(
void Parser::expectToken(Token::Value _value)
{
if (m_scanner->currentToken() != _value)
- fatalParserError(std::string(string("Expected token ") + string(Token::name(_value))));
+ fatalParserError(
+ string("Expected token ") +
+ string(Token::name(_value)) +
+ string(" got '") +
+ string(Token::name(m_scanner->currentToken())) +
+ string("'")
+ );
m_scanner->next();
}
@@ -1188,7 +1194,12 @@ Token::Value Parser::expectAssignmentOperator()
{
Token::Value op = m_scanner->currentToken();
if (!Token::isAssignmentOp(op))
- fatalParserError(std::string("Expected assignment operator"));
+ fatalParserError(
+ std::string("Expected assignment operator ") +
+ string(" got '") +
+ string(Token::name(m_scanner->currentToken())) +
+ string("'")
+ );
m_scanner->next();
return op;
}
@@ -1196,7 +1207,12 @@ Token::Value Parser::expectAssignmentOperator()
ASTPointer<ASTString> Parser::expectIdentifierToken()
{
if (m_scanner->currentToken() != Token::Identifier)
- fatalParserError(std::string("Expected identifier"));
+ fatalParserError(
+ std::string("Expected identifier ") +
+ string(" got '") +
+ string(Token::name(m_scanner->currentToken())) +
+ string("'")
+ );
return getLiteralAndAdvance();
}