This repository was archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparser_result.hpp
More file actions
54 lines (43 loc) · 1.53 KB
/
parser_result.hpp
File metadata and controls
54 lines (43 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef LIB_RUBY_PARSER_PARSER_RESULT_HPP
#define LIB_RUBY_PARSER_PARSER_RESULT_HPP
#include "nodes.hpp"
#include "token.hpp"
#include "diagnostic.hpp"
#include "comment.hpp"
#include "magic_comment.hpp"
#include "decoded_input.hpp"
namespace lib_ruby_parser
{
/// Equivalent of `lib_ruby_parser::ParserResult`
class ParserResult
{
public:
/// Final AST, nullable.
Node *ast;
/// List of tokens, empty if `parser_options.record_tokens` was set to false
TokenList tokens;
/// List of diagnostics (errors/warnings)
DiagnosticList diagnostics;
/// List of comments
CommentList comments;
/// List of magic comments
MagicCommentList magic_comments;
/// Decoded input
///
/// Sometimes source code has a magic encoding comment
/// that forces us to re-encode given source to other encoding.
///
/// In such cases source code on the byte level is different and so
/// all locations (Loc) refer to that new re-encode byte ranges.
///
/// Thus, always use this re-encoded byte array to compute source code
/// of any location.
DecodedInput input;
~ParserResult();
ParserResult(const ParserResult &) = delete;
ParserResult &operator=(ParserResult const &) = delete;
ParserResult(ParserResult &&) = default;
ParserResult &operator=(ParserResult &&) = default;
};
} // namespace lib_ruby_parser
#endif // LIB_RUBY_PARSER_PARSER_RESULT_HPP