로딩중...
검색중...
일치하는것 없음
stelaWriter.hpp
이 파일의 문서화 페이지로 가기
1
2#pragma once
3
5
6namespace by {
7
35 class _nout stelaWriter: public stelaVisitor {
37
38 public:
42 std::string write(stela& root);
47 nbool writeFile(stela& root, const std::string& path);
48 nbool writeFile(stela& root, const nchar* path) BY_SIDE_FUNC(path, writeFile(root, std::string(path)), false);
49
50 protected:
51 nbool onVisit(const stelaVisitInfo& i, rootStela& it) override;
52 nbool onVisit(const stelaVisitInfo& i, defStela& it) override;
53 nbool onVisit(const stelaVisitInfo& i, valStela& it) override;
54 nbool onVisit(const stelaVisitInfo& i, strStela& it) override;
55 nbool onVisit(const stelaVisitInfo& i, arrStela& it) override;
56 void onLeave(const stelaVisitInfo& i, arrStela& it) override;
57
58 private:
59 std::string _indent(nint depth);
60 std::stringstream& _open(const stelaVisitInfo& i, stela& it);
61 void _close(const stelaVisitInfo& i);
62
63 private:
64 std::stringstream _ss;
65 };
66} // namespace by
Ordered list of elements.
Definition arrStela.hpp:27
Named block of children — the def form of stela source.
Definition defStela.hpp:24
The compilation unit — the one node with no source form of its own.
Definition rootStela.hpp:22
Definition stela.hpp:63
Traversal context handed to every stelaVisitor callback.
Definition stelaVisitInfo.hpp:17
Preorder visitor for the stela AST.
Definition stelaVisitor.hpp:30
Serializes a stela tree back to stela source text.
Definition stelaWriter.hpp:35
std::string write(stela &root)
Serializes root and its subtree to a string.
nbool writeFile(stela &root, const std::string &path)
Serializes root and writes the result to path (LF, UTF-8, non-atomic).
String-value marker over valStela.
Definition strStela.hpp:15
Weak reference smart pointer with type-safe access
Definition tweak.hpp:16
Scalar value — the abstract base of every leaf form.
Definition valStela.hpp:21
#define BY_SIDE_FUNC(...)
Side function macros for safe pointer operations
Definition sideFunc.hpp:24
to Top