ArkScript
A small, fast, functional and scripting language for video games
|
Classes | |
struct | LineColorContextCounts |
Functions | |
ARK_API void | makeContext (std::ostream &os, const std::string &code, std::size_t target_line, std::size_t col_start, std::size_t sym_size) |
Helper to create a colorized context to report errors to the user. | |
ARK_API 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 | generate (const CodeError &e, std::string code="", std::ostream &os=std::cout) |
Generate a diagnostic from an error and print it to the standard output. | |
bool | isPairableChar (const char c) |
void | colorizeLine (const std::string &line, LineColorContextCounts &line_color_context_counts, std::ostream &ss) |
template<typename T > | |
void | helper (std::ostream &os, const std::string &message, const std::string &filename, const std::string &code, const T &expr, const std::size_t line, std::size_t column, const std::size_t sym_size) |
void Ark::Diagnostics::colorizeLine | ( | const std::string & | line, |
LineColorContextCounts & | line_color_context_counts, | ||
std::ostream & | ss | ||
) |
Definition at line 25 of file Exceptions.cpp.
References isPairableChar(), Ark::Diagnostics::LineColorContextCounts::open_curly_braces, Ark::Diagnostics::LineColorContextCounts::open_parentheses, and Ark::Diagnostics::LineColorContextCounts::open_square_braces.
Referenced by makeContext().
void Ark::Diagnostics::generate | ( | const CodeError & | e, |
std::string | code = "" , |
||
std::ostream & | os = std::cout |
||
) |
Generate a diagnostic from an error and print it to the standard output.
e | code error |
code | code of the file in which the error occurred |
os | output stream |
Definition at line 157 of file Exceptions.cpp.
References ARK_NO_NAME_FILE, Ark::CodeError::col, Ark::CodeError::expr, Ark::CodeError::filename, helper(), Ark::CodeError::line, Ark::Utils::readFile(), and Ark::CodeError::symbol.
Referenced by Ark::Welder::computeAST(), Ark::Welder::generateBytecode(), and Formatter::run().
void Ark::Diagnostics::helper | ( | std::ostream & | os, |
const std::string & | message, | ||
const std::string & | filename, | ||
const std::string & | code, | ||
const T & | expr, | ||
const std::size_t | line, | ||
std::size_t | column, | ||
const std::size_t | sym_size | ||
) |
Definition at line 124 of file Exceptions.cpp.
References ARK_NO_NAME_FILE, and makeContext().
Referenced by generate(), and makeContextWithNode().
|
inline |
Definition at line 20 of file Exceptions.cpp.
Referenced by colorizeLine().
void Ark::Diagnostics::makeContext | ( | std::ostream & | os, |
const std::string & | code, | ||
std::size_t | target_line, | ||
std::size_t | col_start, | ||
std::size_t | sym_size | ||
) |
Helper to create a colorized context to report errors to the user.
os | stream in which the error will be written |
code | content of the source file where the error is |
target_line | line where the error is |
col_start | where the error starts on the given line |
sym_size | bad expression that triggered the error |
Definition at line 79 of file Exceptions.cpp.
References colorizeLine(), and Ark::Utils::splitString().
Referenced by helper().
std::string Ark::Diagnostics::makeContextWithNode | ( | const std::string & | message, |
const internal::Node & | node | ||
) |
Helper used by the compiler to generate a colorized context from a node.
message | error message to be included in the context |
node | AST node with the error |
Definition at line 135 of file Exceptions.cpp.
References ARK_NO_NAME_FILE, Ark::internal::Node::col(), Ark::internal::Node::filename(), helper(), Ark::internal::Node::line(), Ark::internal::Node::nodeType(), Ark::Utils::readFile(), Ark::internal::Node::repr(), Ark::internal::Spread, Ark::internal::Node::string(), Ark::internal::String, and Ark::internal::Symbol.
Referenced by Ark::Compiler::compilerWarning().