11#ifndef ARK_ERROR_DIAGNOSTICS_HPP
12#define ARK_ERROR_DIAGNOSTICS_HPP
28 std::optional<internal::FilePos>
end;
32 return !
end.has_value();
52 const ErrorLocation& loc,
54 const std::optional<CodeErrorContext>& maybe_context,
ArkScript homemade exceptions.
Defines position utilities (for text in a file) for the parser, formatter, diagnostics.
A node of an Abstract Syntax Tree for ArkScript.
ARK_API void generate(const CodeError &e, std::ostream &os=std::cout, bool colorize=true)
Generate a diagnostic from an error and print it to the standard output.
std::string makeContextWithNode(const std::string &message, const internal::Node &node)
Helper used by the compiler to generate a colorized context from a node.
ARK_API void makeContext(const ErrorLocation &loc, std::ostream &os, const std::optional< CodeErrorContext > &maybe_context, bool colorize)
Helper to create a colorized context to report errors to the user.
CodeError thrown by the compiler (parser, macro processor, optimizer, and compiler itself)
std::optional< internal::FilePos > end
std::string filename
Complete path to the file where the error is.
bool wholeLineIsError() const
std::optional< decltype(internal::FilePos::line)> maybeEndLine() const noexcept
std::size_t line
0-indexed line number