Removed unused errors
This commit is contained in:
parent
25e730c8d3
commit
2eee11e476
@ -106,11 +106,8 @@ void assert(bool condition, std::string message, Location loc)
|
||||
std::ostream& operator<<(std::ostream& os, Error const& err)
|
||||
{
|
||||
std::string_view short_description = visit(Overloaded {
|
||||
[](errors::Expected_Keyword const&) { return "Expected keyword"; },
|
||||
[](errors::Failed_Numeric_Parsing const&) { return "Failed to parse a number"; },
|
||||
[](errors::Music_Literal_Used_As_Identifier const&) { return "Music literal in place of identifier"; },
|
||||
[](errors::Not_Callable const&) { return "Value not callable"; },
|
||||
[](errors::Undefined_Identifier const&) { return "Undefined identifier"; },
|
||||
[](errors::Undefined_Operator const&) { return "Undefined operator"; },
|
||||
[](errors::Unexpected_Empty_Source const&) { return "Unexpected end of file"; },
|
||||
[](errors::Unexpected_Keyword const&) { return "Unexpected keyword"; },
|
||||
@ -158,10 +155,7 @@ std::ostream& operator<<(std::ostream& os, Error const& err)
|
||||
}
|
||||
},
|
||||
|
||||
[&os](errors::Expected_Keyword const&) { unimplemented(); },
|
||||
[&os](errors::Music_Literal_Used_As_Identifier const&) { unimplemented(); },
|
||||
[&os](errors::Not_Callable const&) { unimplemented(); },
|
||||
[&os](errors::Undefined_Identifier const&) { unimplemented(); },
|
||||
[&os](errors::Undefined_Operator const&) { unimplemented(); },
|
||||
[&os](errors::Unexpected_Keyword const&) { unimplemented(); },
|
||||
[&os](errors::Unexpected_Empty_Source const&) { unimplemented(); }
|
||||
|
@ -59,16 +59,6 @@ namespace errors
|
||||
std::errc reason;
|
||||
};
|
||||
|
||||
struct Undefined_Identifier
|
||||
{
|
||||
};
|
||||
|
||||
struct Expected_Keyword
|
||||
{
|
||||
std::string_view keyword;
|
||||
std::string_view received_type = {};
|
||||
};
|
||||
|
||||
struct Expected_Expression_Separator_Before
|
||||
{
|
||||
std::string_view what;
|
||||
@ -89,17 +79,15 @@ namespace errors
|
||||
std::string_view type;
|
||||
};
|
||||
|
||||
struct Music_Literal_Used_As_Identifier
|
||||
{
|
||||
std::string_view source;
|
||||
|
||||
/// Why only identifier can be used?
|
||||
std::string_view identifier_context;
|
||||
};
|
||||
|
||||
/// Collection of messages that are considered internal and should not be printed to the end user.
|
||||
namespace internal
|
||||
{
|
||||
struct Expected_Keyword
|
||||
{
|
||||
std::string_view keyword;
|
||||
std::string_view received_type = {};
|
||||
};
|
||||
|
||||
struct Unexpected_Token
|
||||
{
|
||||
/// Type of the token
|
||||
@ -115,11 +103,8 @@ namespace errors
|
||||
|
||||
using Details = std::variant<
|
||||
Expected_Expression_Separator_Before,
|
||||
Expected_Keyword,
|
||||
Failed_Numeric_Parsing,
|
||||
Music_Literal_Used_As_Identifier,
|
||||
Not_Callable,
|
||||
Undefined_Identifier,
|
||||
Undefined_Operator,
|
||||
Unexpected_Empty_Source,
|
||||
Unexpected_Keyword,
|
||||
|
@ -68,16 +68,7 @@ Result<Ast> Parser::parse_expression()
|
||||
|
||||
Result<Ast> Parser::parse_variable_declaration()
|
||||
{
|
||||
if (!expect(Token::Type::Keyword, "var")) {
|
||||
Error error;
|
||||
errors::Expected_Keyword kw { .keyword = "var" };
|
||||
if (token_id >= tokens.size()) {
|
||||
kw.received_type = type_name(peek()->type);
|
||||
error.location = peek()->location;
|
||||
}
|
||||
error.details = std::move(kw);
|
||||
return error;
|
||||
}
|
||||
assert(expect(Token::Type::Keyword, "var"), "Parser::parse_variable_declaration must be called only on expressions that starts with 'var'");
|
||||
auto var = consume();
|
||||
|
||||
auto lvalue = Try(parse_many(*this, &Parser::parse_identifier, std::nullopt, At_Least::One));
|
||||
|
Loading…
Reference in New Issue
Block a user