1
2
3
4
5
6 #ifndef SNGCM_AST_IDENTIFIER_INCLUDED
7 #define SNGCM_AST_IDENTIFIER_INCLUDED
8 #include <soulng/lexer/Token.hpp>
9 #include <sngcm/ast/Node.hpp>
10
11 namespace sngcm { namespace ast {
12
13 class IdentifierNode : public Node
14 {
15 public:
16 IdentifierNode(const Span& span_);
17 IdentifierNode(const Span& span_, NodeType nodeType_);
18 IdentifierNode(const Span& span_, const std::u32string& identifier_);
19 IdentifierNode(const Span& span_, NodeType nodeType_, const std::u32string& identifier_);
20 IdentifierNode(const Span& span_, const soulng::lexer::Token& token);
21 Node* Clone(CloneContext& cloneContext) const override;
22 void Accept(Visitor& visitor) override;
23 void Write(AstWriter& writer) override;
24 void Read(AstReader& reader) override;
25 const std::u32string& Str() const { return identifier; }
26 void SetStr(const std::u32string& str) { identifier = str; }
27 std::string ToString() const override;
28 private:
29 std::u32string identifier;
30 };
31
32 class CursorIdNode : public IdentifierNode
33 {
34 public:
35 CursorIdNode(const Span& span_);
36 CursorIdNode(const Span& span_, const std::u32string& identifier_);
37 Node* Clone(CloneContext& cloneContext) const override;
38 void Accept(Visitor& visitor) override;
39 void Write(AstWriter& writer) override;
40 void Read(AstReader& reader) override;
41 };
42
43 } }
44
45 #endif // SNGCM_AST_IDENTIFIER_INCLUDED