Line data Source code
1 : #ifndef AST_CHAR_H
2 : #define AST_CHAR_H
3 :
4 : #include "../ast.h"
5 : #include <string>
6 :
7 : namespace nicole {
8 :
9 : class AST_CHAR final : public AST {
10 : private:
11 : char value_;
12 :
13 : public:
14 : explicit AST_CHAR(const long long unsigned nodeId,
15 : const SourceLocation &srcLoc, const char value) noexcept
16 1 : : AST{nodeId, AST_TYPE::CHAR, srcLoc}, value_{value} {}
17 :
18 : ~AST_CHAR() noexcept = default;
19 :
20 9 : [[nodiscard]] char value() const noexcept { return value_; }
21 :
22 : [[nodiscard]] std::expected<std::string, Error>
23 0 : accept(const PrintTree &visitor) const noexcept override {
24 0 : return visitor.visit(this);
25 0 : }
26 :
27 : [[nodiscard]] std::expected<bool, Error>
28 0 : accept(const ValidateTree &visitor) const noexcept override {
29 0 : return visitor.visit(this);
30 0 : }
31 :
32 : [[nodiscard]] std::expected<std::monostate, Error>
33 0 : accept(const FillSemanticInfo &visitor) const noexcept override {
34 0 : return visitor.visit(this);
35 0 : }
36 :
37 : [[nodiscard]] std::expected<std::shared_ptr<Type>, Error>
38 0 : accept(const TypeAnalysis &visitor) const noexcept override {
39 0 : return visitor.visit(this);
40 0 : }
41 :
42 : [[nodiscard]] std::expected<std::monostate, Error>
43 0 : accept(const Monomorphize &visitor) const noexcept override {
44 0 : return visitor.visit(this);
45 0 : }
46 :
47 : [[nodiscard]] std::expected<std::shared_ptr<llvm::Value>, Error>
48 0 : accept(const CodeGeneration &visitor) const noexcept override {
49 0 : return visitor.visit(this);
50 0 : }
51 : };
52 :
53 : } // namespace nicole
54 :
55 : #endif // AST_H
|