-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathErrorReporter.h
More file actions
41 lines (33 loc) · 754 Bytes
/
ErrorReporter.h
File metadata and controls
41 lines (33 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef ERROR_REPORTER_H
#define ERROR_REPORTER_H
#include "token.h"
#include <ostream>
#include <vector>
enum class DiagnosticType
{
ERROR
};
struct Diagnostic
{
DiagnosticType type;
Token token;
std::string message;
void print(std::ostream& os,
std::istream& filestream,
const std::string& filename) const;
};
class ErrorReporter
{
public:
ErrorReporter(std::ostream& outputStream,
std::istream& filestream,
const std::string& filename = "");
void reportDiagnostic(const Diagnostic&);
bool hasErrors() const;
private:
std::ostream& mOutputStream;
std::istream& mFileStream;
const std::string mFileName;
bool mHasErrors;
};
#endif