Better error reporting of not mached parens
This commit is contained in:
parent
21bf18bbdd
commit
772686a2fc
@ -185,8 +185,10 @@ std::ostream& operator<<(std::ostream& os, Error const& err)
|
|||||||
|
|
||||||
Lines::the.print(os, std::string(loc->filename), loc->line, loc->line);
|
Lines::the.print(os, std::string(loc->filename), loc->line, loc->line);
|
||||||
|
|
||||||
os << pretty::begin_comment << "\nThis error is considered an internal one. It should not be displayed to the end user.\n" << pretty::end;
|
os << pretty::begin_comment << "\nThis error is considered an internal one. It should not be displayed to the end user.\n";
|
||||||
encourage_contact(os);
|
os << "\n";
|
||||||
|
os << "This error message is temporary and will be replaced by better one in the future\n";
|
||||||
|
os << pretty::end;
|
||||||
},
|
},
|
||||||
|
|
||||||
[&](errors::Expected_Expression_Separator_Before const& err) {
|
[&](errors::Expected_Expression_Separator_Before const& err) {
|
||||||
|
@ -271,7 +271,10 @@ Result<Ast> Parser::parse_atomic_expression()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unimplemented("Don't know why it stopped, maybe end of file?");
|
return Error {
|
||||||
|
.details = errors::Unexpected_Empty_Source {},
|
||||||
|
.location = {}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
consume();
|
consume();
|
||||||
if (is_lambda) {
|
if (is_lambda) {
|
||||||
@ -287,7 +290,15 @@ Result<Ast> Parser::parse_atomic_expression()
|
|||||||
consume();
|
consume();
|
||||||
auto ast = Try(parse_sequence());
|
auto ast = Try(parse_sequence());
|
||||||
if (not expect(Token::Type::Close_Paren)) {
|
if (not expect(Token::Type::Close_Paren)) {
|
||||||
unimplemented("Error handling of this code is not implemented yet");
|
auto const& token = Try(peek());
|
||||||
|
return Error {
|
||||||
|
.details = errors::internal::Unexpected_Token {
|
||||||
|
.type = type_name(token.type),
|
||||||
|
.source = token.source,
|
||||||
|
.when = "waiting for closing paren ')'"
|
||||||
|
},
|
||||||
|
.location = token.location
|
||||||
|
};
|
||||||
}
|
}
|
||||||
consume();
|
consume();
|
||||||
return ast;
|
return ast;
|
||||||
|
Loading…
Reference in New Issue
Block a user