xlang/bootstrap/error.cc

24 lines
730 B
C++

#include <error.hh>
#include <iostream>
namespace xlang {
ErrorListener::ErrorListener(std::string_view inputfile)
: file{inputfile}, has_error{false} {}
bool ErrorListener::hasError() {
return has_error;
}
void ErrorListener::syntaxError([[maybe_unused]] antlr4::Recognizer *recognizer,
[[maybe_unused]] antlr4::Token *offendingSymbol,
size_t line, size_t charPositionInLine,
const std::string &msg,
[[maybe_unused]] std::exception_ptr e) {
std::cerr << file << ":" << line << ":" << charPositionInLine << ": " << msg
<< std::endl;
has_error = true;
}
} // namespace xlang