1 // =================================
 2 // Copyright (c) 2020 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& span);
28     void SetLexers(std::std::vector<soulng::lexer::Lexer*>*lexers_);
29 private:
30     BinaryWriter binaryWriter;
31     std::std::vector<soulng::lexer::Lexer*>*lexers;
32 };
33 
34 } } // namespace sngcm::ast
35 
36 #endif // SNGCM_AST_AST_WRITER_INCLUDED