Refactor errors and update post draft.

This commit is contained in:
2020-09-11 21:29:49 -07:00
parent 725958137a
commit 6b8d3b0f8a
8 changed files with 431 additions and 42 deletions

View File

@@ -14,13 +14,13 @@ void scanner_destroy(yyscan_t* scanner);
struct parse_driver {
std::string file_name;
std::ostringstream string_stream;
std::string file_contents;
yy::location location;
size_t file_offset;
std::vector<size_t> line_offsets;
definition_group global_defs;
std::string file_contents;
parse_driver(const std::string& file)
: file_name(file), file_offset(0) {}
@@ -30,7 +30,10 @@ struct parse_driver {
void mark_line();
size_t get_index(int line, int column);
size_t get_line_end(int line);
void print_highlighted_location(std::ostream& stream, const yy::location& loc);
void print_location(
std::ostream& stream,
const yy::location& loc,
bool highlight = true);
};
#define YY_DECL yy::parser::symbol_type yylex(yyscan_t yyscanner, parse_driver& drv)