blob: 281d745a5bf47ed16938fe519da28b81edd620b3 (
plain) (
blame)
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
42
|
#pragma once
#include <util/generic/yexception.h>
#include <util/generic/fwd.h>
namespace NAST {
static const char* INVALID_TOKEN_NAME = "nothing";
static const char* ABSENCE = " absence";
class TTooManyErrors: public yexception {
};
class IErrorCollector {
public:
explicit IErrorCollector(size_t maxErrors);
virtual ~IErrorCollector();
// throws TTooManyErrors
void Error(ui32 line, ui32 col, const TString& message);
private:
virtual void AddError(ui32 line, ui32 col, const TString& message) = 0;
protected:
const size_t MaxErrors;
size_t NumErrors;
};
class TErrorOutput: public IErrorCollector {
public:
TErrorOutput(IOutputStream& err, const TString& name, size_t maxErrors);
virtual ~TErrorOutput();
private:
void AddError(ui32 line, ui32 col, const TString& message) override;
public:
IOutputStream& Err;
TString Name;
};
} // namespace NAST
|