Line data Source code
1 : #ifndef AST_STRING_H
2 : #define AST_STRING_H
3 :
4 : #include "../ast.h"
5 :
6 : namespace nicole {
7 :
8 : class AST_STRING final : public AST {
9 : private:
10 : std::string value_;
11 :
12 : public:
13 : explicit AST_STRING(const long long unsigned nodeId,
14 : const SourceLocation &srcLoc,
15 : const std::string value) noexcept
16 1 : : AST{nodeId, AST_TYPE::STRING, srcLoc}, value_{value} {}
17 :
18 9 : ~AST_STRING() noexcept = default;
19 :
20 9 : [[nodiscard]] const std::string &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
|