1 // =================================
 2 // Copyright (c) 2020 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 #ifndef SNGCPP_AST_WRITER_INCLUDED
 7 #define SNGCPP_AST_WRITER_INCLUDED
 8 #include <sngcpp/ast/AstApi.hpp>
 9 #include <sngcpp/ast/SimpleType.hpp>
10 #include <sngcpp/ast/Specifier.hpp>
11 #include <sngcpp/ast/Class.hpp>
12 #include <sngcpp/ast/Enumeration.hpp>
13 #include <sngcpp/ast/Expression.hpp>
14 #include <sngcpp/ast/Literal.hpp>
15 #include <soulng/lexer/Lexer.hpp>
16 #include <soulng/util/BinaryWriter.hpp>
17 
18 namespace sngcpp { namespace ast {
19 
20 class Writer 
21 {
22 public:
23     Writer(const std::std::vector<soulng::lexer::Lexer*>&lexers_soulng::util::BinaryWriter&binaryWriter_);
24     void Write(soulng::lexer::Span& span);
25     void Write(SimpleTypeSpecifier specifier);
26     void Write(NodeType nodeType);
27     void Write(Specifier specifiers);
28     void Write(ClassKey classKey);
29     void Write(EnumKey enumKey);
30     void Write(Operator op);
31     void Write(Suffix suffix);
32     void Write(Base base);
33     soulng::util::BinaryWriter& GetBinaryWriter() { return binaryWriter; }
34 private:
35     const std::std::vector<soulng::lexer::Lexer*>&lexers;
36     soulng::util::BinaryWriter& binaryWriter;
37 };
38 
39 } } // namespace sngcpp::ast
40 
41 #endif // SNGCPP_AST_WRITER_INCLUDED