Refactor errors and update post draft.
This commit is contained in:
@@ -7,12 +7,26 @@
|
||||
|
||||
using maybe_location = std::optional<yy::location>;
|
||||
|
||||
struct type_error : std::exception {
|
||||
struct compiler_error : std::exception {
|
||||
std::string description;
|
||||
maybe_location loc;
|
||||
|
||||
compiler_error(std::string d, maybe_location l = std::nullopt)
|
||||
: description(std::move(d)), loc(std::move(l)) {}
|
||||
|
||||
const char* what() const noexcept override;
|
||||
|
||||
void print_about(std::ostream& to);
|
||||
void print_location(std::ostream& to, parse_driver& drv, bool highlight = false);
|
||||
|
||||
void pretty_print(std::ostream& to, parse_driver& drv);
|
||||
};
|
||||
|
||||
struct type_error : compiler_error {
|
||||
std::optional<yy::location> loc;
|
||||
|
||||
type_error(std::string d, maybe_location l = std::nullopt)
|
||||
: description(std::move(d)), loc(std::move(l)) {}
|
||||
: compiler_error(std::move(d), std::move(l)) {}
|
||||
|
||||
const char* what() const noexcept override;
|
||||
void pretty_print(std::ostream& to, parse_driver& drv);
|
||||
|
||||
Reference in New Issue
Block a user