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_, const boost::uuids::uuid& moduleId_);
17 IdentifierNode(const Span& span_, const boost::uuids::uuid& moduleId_, NodeType nodeType_);
18 IdentifierNode(const Span& span_, const boost::uuids::uuid& moduleId_, const std::u32string& identifier_);
19 IdentifierNode(const Span& span_, const boost::uuids::uuid& moduleId_, NodeType nodeType_, const std::u32string& identifier_);
20 IdentifierNode(const Span& span_, const boost::uuids::uuid& moduleId_, 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 bool IsInternal() const;
29 private:
30 std::u32string identifier;
31 };
32
33 class CursorIdNode : public IdentifierNode
34 {
35 public:
36 CursorIdNode(const Span& span_, const boost::uuids::uuid& moduleId_);
37 CursorIdNode(const Span& span_, const boost::uuids::uuid& moduleId_, const std::u32string& identifier_);
38 Node* Clone(CloneContext& cloneContext) const override;
39 void Accept(Visitor& visitor) override;
40 void Write(AstWriter& writer) override;
41 void Read(AstReader& reader) override;
42 };
43
44 } }
45
46 #endif // SNGCM_AST_IDENTIFIER_INCLUDED