-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathpattern_error.hpp
More file actions
46 lines (33 loc) · 1.25 KB
/
pattern_error.hpp
File metadata and controls
46 lines (33 loc) · 1.25 KB
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
43
44
45
46
#pragma once
#include <pl/patterns/pattern.hpp>
namespace pl::ptrn {
class PatternError : public Pattern {
public:
PatternError(core::Evaluator *evaluator, u64 offset, size_t size, u32 line, std::string errorMessage)
: Pattern(evaluator, offset, size, line), m_errorMessage(std::move(errorMessage)) { }
[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::shared_ptr<Pattern>(new PatternError(*this));
}
[[nodiscard]] std::string getFormattedName() const override {
return "";
}
[[nodiscard]] std::vector<std::pair<u64, Pattern*>> getChildren() override {
return { };
}
[[nodiscard]] bool operator==(const Pattern &other) const override { return compareCommonProperties<decltype(*this)>(other); }
void accept(PatternVisitor &v) override {
v.visit(*this);
}
std::string formatDisplayValue() override {
return m_errorMessage;
}
[[nodiscard]] std::string toString() override {
return m_errorMessage;
}
std::vector<u8> getRawBytes() override {
return { };
}
private:
std::string m_errorMessage;
};
}