1#include "gsc/error.hpp"
4void report(
const int &line,
const std::string &where,
5 const std::string &message) {
6 std::cerr <<
"[line " << line <<
"] Error " << where <<
": " << message
12void error(
const int &line,
const std::string &message) {
13 report(line,
"", message);
16void error(
const Token &token,
const std::string &message) {
17 if (token.getType() == TokenType::END_OF_FILE) {
18 report(token.getLine(),
"at end", message);
20 report(token.getLine(),
"at '" + token.getLexeme() +
"'", message);
25 std::cerr << error.getMessage() <<
"\n[line " << error.getToken()->getLine()
27 hadRuntimeError =
true;
void error(const int &line, const std::string &message)
Report an error in the given line.
void runtimeError(const RuntimeError &error)
Report a runtime error given a RuntimeError object.
void report(const int &line, const std::string &where, const std::string &message)
Report an error in the given line and location.