print & read builtin functions, fixes. execution of programs partially works

This commit is contained in:
ProgramSnail 2023-05-20 00:01:54 +03:00
parent 27f643dfbc
commit 2556efcaba
16 changed files with 537 additions and 215 deletions

View file

@ -34,8 +34,15 @@ inline void HandleGeneralError(const std::string& message) {
exit(1);
}
inline void HandleInternalError(const std::string& message, const std::string& place) {
std::cerr << "\x1b[1;31mInternal Error:\x1b[0m " << message << " at " << place << ".\n";
inline void HandleInternalError(const std::string& message,
const std::string& place,
std::optional<const interpreter::tokens::BaseNode*> node) {
std::cerr << "\x1b[1;31mInternal Error:\x1b[0m " << message << " at " << place;
if (node.has_value()) {
std::cerr << ", at ";
PrintPosition(std::cerr, node.value()->start_position, node.value()->end_position);
}
std::cerr << ".\n";
exit(1);
}