Bash++
Bash++ compiler internal documentation
Classes | Functions
bpp::ErrorHandling Namespace Reference

Classes

class  ErrorOrWarning
 
struct  InternalError
 An exception thrown when an internal error occurs. More...
 
class  SyntaxError
 An exception thrown when a syntax error is encountered This exception can be constructed from any listener that satisfies the ErrorReportableListener concept, along with an AST node or token that satisfies the ASTNodePtrORToken concept. When thrown, the exception can be caught and printed to display a formatted syntax error message. More...
 
class  Warning
 A compiler warning that is not fatal to compilation This type should never be thrown. Instead, it should be constructed and displayed via the print() method. Throwing it would halt compilation, which is not desired for warnings. This class likewise can be constructed from any listener that satisfies the ErrorReportableListener concept, along with an AST node or token that satisfies the ASTNodePtrORToken concept. More...
 

Functions

void print_syntax_error_or_warning (const std::string &source_file, uint32_t line, uint32_t column, uint32_t text_length, const std::string &msg, const std::vector< std::string > &include_chain, std::shared_ptr< bpp::bpp_program > program, bool lsp_mode, bool is_warning=false)
 Print a syntax error or warning message to stderr.
 
void print_syntax_error_from_parser (const std::string &source_file, uint32_t line, uint32_t start_column, uint32_t end_column, const std::string &msg, const std::vector< std::string > &include_chain)
 
std::string utf8_substr (const std::string &str, uint32_t start, uint32_t length)
 
uint32_t utf8_length (const std::string &str)
 
std::string equal_width_padding (const std::string &str, char padding_char)
 

Function Documentation

◆ equal_width_padding()

std::string bpp::ErrorHandling::equal_width_padding ( const std::string &  str,
char  padding_char 
)

◆ print_syntax_error_from_parser()

void bpp::ErrorHandling::print_syntax_error_from_parser ( const std::string &  source_file,
uint32_t  line,
uint32_t  start_column,
uint32_t  end_column,
const std::string &  msg,
const std::vector< std::string > &  include_chain 
)

◆ print_syntax_error_or_warning()

void bpp::ErrorHandling::print_syntax_error_or_warning ( const std::string &  source_file,
uint32_t  line,
uint32_t  column,
uint32_t  text_length,
const std::string &  msg,
const std::vector< std::string > &  include_chain,
std::shared_ptr< bpp::bpp_program program,
bool  lsp_mode,
bool  is_warning = false 
)

Print a syntax error or warning message to stderr.

Parameters
source_fileThe source file which contains the error
lineThe line number where the error occurred
columnThe column number where the error occurred
text_lengthThe length of the token which caused the error
msgThe error message to display
include_chainA stack of include files which led to the error
is_warningWhether the message is a warning or an error

◆ utf8_length()

uint32_t bpp::ErrorHandling::utf8_length ( const std::string &  str)

◆ utf8_substr()

std::string bpp::ErrorHandling::utf8_substr ( const std::string &  str,
uint32_t  start,
uint32_t  length 
)