2015-12-01 15:50:11 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Andrew Kelley
|
|
|
|
*
|
|
|
|
* This file is part of zig, which is MIT licensed.
|
|
|
|
* See http://opensource.org/licenses/MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZIG_ERRMSG_HPP
|
|
|
|
#define ZIG_ERRMSG_HPP
|
|
|
|
|
|
|
|
#include "buffer.hpp"
|
|
|
|
#include "list.hpp"
|
|
|
|
|
2015-12-01 16:06:10 +08:00
|
|
|
enum ErrColor {
|
|
|
|
ErrColorAuto,
|
|
|
|
ErrColorOff,
|
|
|
|
ErrColorOn,
|
|
|
|
};
|
|
|
|
|
2015-12-01 15:50:11 +08:00
|
|
|
struct ErrorMsg {
|
2016-09-16 02:05:15 +08:00
|
|
|
size_t line_start;
|
|
|
|
size_t column_start;
|
2015-12-01 15:50:11 +08:00
|
|
|
Buf *msg;
|
|
|
|
Buf *path;
|
2016-01-27 15:01:49 +08:00
|
|
|
Buf line_buf;
|
|
|
|
|
|
|
|
ZigList<ErrorMsg *> notes;
|
2015-12-01 15:50:11 +08:00
|
|
|
};
|
|
|
|
|
2015-12-01 16:06:10 +08:00
|
|
|
void print_err_msg(ErrorMsg *msg, ErrColor color);
|
2015-12-01 15:50:11 +08:00
|
|
|
|
2016-01-27 15:01:49 +08:00
|
|
|
void err_msg_add_note(ErrorMsg *parent, ErrorMsg *note);
|
2016-09-16 02:05:15 +08:00
|
|
|
ErrorMsg *err_msg_create_with_offset(Buf *path, size_t line, size_t column, size_t offset,
|
2016-01-27 15:01:49 +08:00
|
|
|
const char *source, Buf *msg);
|
|
|
|
|
2016-09-16 02:05:15 +08:00
|
|
|
ErrorMsg *err_msg_create_with_line(Buf *path, size_t line, size_t column,
|
|
|
|
Buf *source, ZigList<size_t> *line_offsets, Buf *msg);
|
2016-01-27 15:01:49 +08:00
|
|
|
|
2015-12-01 15:50:11 +08:00
|
|
|
#endif
|