mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Try to recover from parser errors where possible
This commit is contained in:
parent
54e97d1c34
commit
0eaae03bbf
@ -347,7 +347,11 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _forceEmptyN
|
||||
else if (Token::isVisibilitySpecifier(token))
|
||||
{
|
||||
if (result.visibility != Declaration::Visibility::Default)
|
||||
fatalParserError(string("Multiple visibility specifiers."));
|
||||
{
|
||||
parserError(string("Multiple visibility specifiers."));
|
||||
m_scanner->next();
|
||||
}
|
||||
else
|
||||
result.visibility = parseVisibilitySpecifier(token);
|
||||
}
|
||||
else
|
||||
@ -501,7 +505,11 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
||||
if (_options.isStateVariable && Token::isVariableVisibilitySpecifier(token))
|
||||
{
|
||||
if (visibility != Declaration::Visibility::Default)
|
||||
fatalParserError(string("Visibility already specified."));
|
||||
{
|
||||
parserError(string("Visibility already specified."));
|
||||
m_scanner->next();
|
||||
}
|
||||
else
|
||||
visibility = parseVisibilitySpecifier(token);
|
||||
}
|
||||
else
|
||||
@ -513,9 +521,10 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
||||
else if (_options.allowLocationSpecifier && Token::isLocationSpecifier(token))
|
||||
{
|
||||
if (location != VariableDeclaration::Location::Default)
|
||||
fatalParserError(string("Location already specified."));
|
||||
if (!type)
|
||||
fatalParserError(string("Location specifier needs explicit type name."));
|
||||
parserError(string("Location already specified."));
|
||||
else if (!type)
|
||||
parserError(string("Location specifier needs explicit type name."));
|
||||
else
|
||||
location = (
|
||||
token == Token::Memory ?
|
||||
VariableDeclaration::Location::Memory :
|
||||
@ -702,7 +711,7 @@ ASTPointer<TypeName> Parser::parseTypeName(bool _allowVar)
|
||||
else if (token == Token::Var)
|
||||
{
|
||||
if (!_allowVar)
|
||||
fatalParserError(string("Expected explicit type name."));
|
||||
parserError(string("Expected explicit type name."));
|
||||
m_scanner->next();
|
||||
}
|
||||
else if (token == Token::Function)
|
||||
|
Loading…
Reference in New Issue
Block a user