1
2
3
4
5
6 #include <sngcm/ast/Comment.hpp>
7 #include <sngcm/ast/Visitor.hpp>
8 #include <sngcm/ast/AstWriter.hpp>
9 #include <sngcm/ast/AstReader.hpp>
10
11 namespace sngcm { namespace ast {
12
13 CommentNode::CommentNode(const Span& span_, const boost::uuids::uuid& moduleId_) : Node(NodeType::commentNode, span_, moduleId_)
14 {
15 }
16
17 CommentNode::CommentNode(const Span& span_, const boost::uuids::uuid& moduleId_, const std::u32string& comment_) : Node(NodeType::commentNode, span_, moduleId_), comment(comment_)
18 {
19 }
20
21 Node* CommentNode::Clone(CloneContext& cloneContext) const
22 {
23 CommentNode* clone = new CommentNode(GetSpan(), ModuleId(), comment);
24 return clone;
25 }
26
27 void CommentNode::Accept(Visitor& visitor)
28 {
29 visitor.Visit(*this);
30 }
31
32 void CommentNode::Write(AstWriter& writer)
33 {
34 Node::Write(writer);
35 writer.GetBinaryWriter().Write(comment);
36 }
37
38 void CommentNode::Read(AstReader& reader)
39 {
40 Node::Read(reader);
41 comment = reader.GetBinaryReader().ReadUtf32String();
42 }
43
44 } }