1 // =================================
 2 // Copyright (c) 2020 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 #ifndef SNGCPP_AST_READER_INCLUDED
 7 #define SNGCPP_AST_READER_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 <sngcpp/ast/Namespace.hpp>
16 #include <soulng/lexer/Lexer.hpp>
17 #include <soulng/util/BinaryReader.hpp>
18 
19 namespace sngcpp { namespace ast {
20 
21 class Reader 
22 {
23 public:
24     Reader(soulng::util::BinaryReader& binaryReader_);
25     void Read(soulng::lexer::Span& span);
26     soulng::util::BinaryReader& GetBinaryReader() { return binaryReader; }
27     SimpleTypeSpecifier ReadSimpleTypeSpecifier();
28     NodeType ReadNodeType();
29     Specifier ReadSpecifiers();
30     ClassKey ReadClassKey();
31     EnumKey ReadEnumKey();
32     Operator ReadOperator();
33     Suffix ReadSuffix();
34     Base ReadBase();
35     Node* ReadNode();
36     CompoundStatementNode* ReadCompoundStatementNode();
37     StringLiteralNode* ReadStringLiteralNode();
38     NamespaceNode* ReadNamespaceNode();
39     IdentifierNode* ReadIdentifierNode();
40 private:
41     soulng::util::BinaryReader& binaryReader;
42 };
43 
44 } } // namespace sngcpp::ast
45 
46 #endif // SNGCPP_AST_READER_INCLUDED