diff options
author | Christian Parpart <christian@ethereum.org> | 2018-11-23 23:47:34 +0800 |
---|---|---|
committer | Christian Parpart <christian@ethereum.org> | 2018-11-24 19:40:51 +0800 |
commit | e4106bd06eebce9e17d51858a37bf82566b7f640 (patch) | |
tree | d5437b94d64673870c73a946b10bcf6778ec3594 /libsolidity | |
parent | e454737a3cf389ee400a9ef1d9f252c579a2ceea (diff) | |
download | dexon-solidity-e4106bd06eebce9e17d51858a37bf82566b7f640.tar.gz dexon-solidity-e4106bd06eebce9e17d51858a37bf82566b7f640.tar.zst dexon-solidity-e4106bd06eebce9e17d51858a37bf82566b7f640.zip |
Change scanner error diagnostics to be non-intrusive to the token API.
This also implicitly eliminates the magic-token Token::IllegalHex, and
streamlines error diagnostics over a custom enum class.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/parsing/Parser.cpp | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index b78c58c6..3f4a015b 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1555,32 +1555,8 @@ ASTPointer<Expression> Parser::parsePrimaryExpression() expression = nodeFactory.createNode<TupleExpression>(components, isArray); break; } - case Token::IllegalHex: - fatalParserError("Expected even number of hex-nibbles within double-quotes."); - break; - case Token::IllegalCommentTerminator: - fatalParserError("Expected multi-line comment-terminator."); - break; - case Token::IllegalStringEscape: - fatalParserError("Invalid String Escape."); - break; - case Token::IllegalStringEndQuote: - fatalParserError("Expected String end-quote."); - break; - case Token::IllegalNumberSeparator: - fatalParserError("Invalid use of Number Separator '_'."); - break; - case Token::IllegalHexDigit: - fatalParserError("Hex Digit missing or invalid."); - break; - case Token::IllegalOctalNotAllowed: - fatalParserError("Octal Numbers not allowed."); - break; - case Token::IllegalExponent: - fatalParserError("Invalid Exponent."); - break; - case Token::IllegalNumberEnd: - fatalParserError("Digit or Identifier-Start not allowed at end of Number."); + case Token::Illegal: + fatalParserError(to_string(m_scanner->currentError())); break; default: if (TokenTraits::isElementaryTypeName(token)) |