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.h
More file actions
53 lines (43 loc) · 1.54 KB
/
parser_result.h
File metadata and controls
53 lines (43 loc) · 1.54 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
#ifndef LIB_RUBY_PARSER_PARSER_RESULT_H
#define LIB_RUBY_PARSER_PARSER_RESULT_H
#include "nodes.h"
#include "token.h"
#include "diagnostic.h"
#include "comment.h"
#include "magic_comment.h"
#include "decoded_input.h"
/// @defgroup output Parser Output
/// @{
/// @}
/// @brief Parser output
/// @ingroup output
typedef struct
{
/// Final AST, nullable.
LIB_RUBY_PARSER_Node *ast;
/// List of tokens, empty if `parser_options.record_tokens` was set to false
LIB_RUBY_PARSER_TokenList tokens;
/// List of diagnostics (errors/warnings)
LIB_RUBY_PARSER_DiagnosticList diagnostics;
/// List of comments
LIB_RUBY_PARSER_CommentList comments;
/// List of magic comments
LIB_RUBY_PARSER_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 (LIB_RUBY_PARSER_Loc) refer to that new re-encode byte ranges.
///
/// Thus, always use this re-encoded byte array to compute source code
/// of any location.
LIB_RUBY_PARSER_DecodedInput input;
} LIB_RUBY_PARSER_ParserResult;
/// ParserResult destructor.
/// Just like Rust/C++ destructor it performs cleanup of "embedded" resources.
/// i.e. it doesn't call `free` on a given pointer.
/// @ingroup output
void LIB_RUBY_PARSER_drop_parser_result(LIB_RUBY_PARSER_ParserResult *parser_result);
#endif // LIB_RUBY_PARSER_PARSER_RESULT_H