1 // =================================
 2 // Copyright (c) 2021 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 #ifndef SNGCM_AST_AST_WRITER_INCLUDED
 7 #define SNGCM_AST_AST_WRITER_INCLUDED
 8 #include <sngcm/ast/AstApi.hpp>
 9 #include <sngcm/ast/Specifier.hpp>
10 #include <soulng/util/BinaryWriter.hpp>
11 #include <soulng/lexer/Span.hpp>
12 #include <soulng/lexer/Lexer.hpp>
13 
14 namespace sngcm { namespace ast {
15 
16 using namespace soulng::util;
17 using soulng::lexer::Span;
18 class Node;
19 
20 class AstWriter 
21 {
22 public:
23     AstWriter(const std::string& fileName_);
24     BinaryWriter& GetBinaryWriter() { return binaryWriter; }
25     void Write(Node* node);
26     void Write(Specifiers specifiers);
27     void Write(const Span& spanbool convertExternal);
28     void SetLexers(std::std::vector<soulng::lexer::Lexer*>*lexers_);
29     void SetSpanConversionModuleId(const boost::uuids::uuid& spanConversionModuleId_);
30     const boost::uuids::uuid& SpanConversionModuleId() const { return spanConversionModuleId; }
31 private:
32     BinaryWriter binaryWriter;
33     std::std::vector<soulng::lexer::Lexer*>*lexers;
34     boost::uuids::uuid spanConversionModuleId;
35 };
36 
37 } } // namespace sngcm::ast
38 
39 #endif // SNGCM_AST_AST_WRITER_INCLUDED