combine functions for statements part done

This commit is contained in:
ProgramSnail 2023-07-28 17:58:45 +03:00
parent 437c9692ec
commit 263b58a17c
7 changed files with 515 additions and 120 deletions

View file

@ -17,14 +17,13 @@ inline void print_position(std::ostream &out,
}
inline void
handle_internal_error(const std::string &message, const std::string &place,
std::optional<nodes::Node> node = std::nullopt) {
std::cerr << "\x1b[1;31mInternal Error:\x1b[0m " << message << " at "
<< place;
handle_internal_error(const std::string &message,
std::optional<const nodes::Node *> node = std::nullopt) {
std::cerr << "\x1b[1;31mInternal Error:\x1b[0m " << message;
if (node.has_value()) {
std::cerr << ", at ";
print_position(std::cerr, node.value().get_start_position(),
node.value().get_end_position());
std::cerr << " at ";
print_position(std::cerr, node.value()->get_start_position(),
node.value()->get_end_position());
}
std::cerr << ".\n";
exit(1);