Line |
Branch |
Exec |
Source |
1 |
|
|
// Copyright (c) 2021-2024 ChilliBits. All rights reserved. |
2 |
|
|
|
3 |
|
|
#pragma once |
4 |
|
|
|
5 |
|
|
#include <string> |
6 |
|
|
|
7 |
|
|
#include <exception/SemanticError.h> |
8 |
|
|
#include <util/CodeLoc.h> |
9 |
|
|
|
10 |
|
|
namespace spice::compiler { |
11 |
|
|
|
12 |
|
|
// Forward declarations |
13 |
|
|
class ASTNode; |
14 |
|
|
|
15 |
|
|
class ErrorManager { |
16 |
|
|
public: |
17 |
|
|
// Structs |
18 |
|
|
struct SoftError { |
19 |
|
|
const CodeLoc codeLoc; |
20 |
|
|
std::string message; |
21 |
|
|
}; |
22 |
|
|
|
23 |
|
|
// Constructors |
24 |
|
390 |
ErrorManager() = default; |
25 |
|
|
|
26 |
|
|
// Public methods |
27 |
|
|
void addSoftError(const ASTNode *astNode, SemanticErrorType errorType, const std::string &message); |
28 |
|
|
|
29 |
|
|
// Public members |
30 |
|
|
std::vector<SoftError> softErrors; |
31 |
|
|
|
32 |
|
|
private: |
33 |
|
|
// Private methods |
34 |
|
|
void addSoftError(const CodeLoc &codeLoc, const std::string &message); |
35 |
|
|
}; |
36 |
|
|
|
37 |
|
|
} // namespace spice::compiler |
38 |
|
|
|