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 pathmagic_comment.h
More file actions
49 lines (42 loc) · 1.5 KB
/
magic_comment.h
File metadata and controls
49 lines (42 loc) · 1.5 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
#ifndef LIB_RUBY_PARSER_MAGIC_COMMENT_H
#define LIB_RUBY_PARSER_MAGIC_COMMENT_H
#include <stddef.h>
#include "loc.h"
/// @defgroup magic_comment Magic Comments
/// @brief A set of structs and functions to work with magic comments
/// @{
/// @}
/// Equivalent of `lib_ruby_parser::source::MagicCommentKind`
/// @ingroup magic_comment
typedef enum
{
LIB_RUBY_PARSER_MAGIC_COMMENT_KIND_ENCODING,
LIB_RUBY_PARSER_MAGIC_COMMENT_KIND_FROZEN_STRING_LITERAL,
LIB_RUBY_PARSER_MAGIC_COMMENT_KIND_WARN_INDENT,
LIB_RUBY_PARSER_MAGIC_COMMENT_KIND_SHAREABLE_CONSTANT_VALUE,
} LIB_RUBY_PARSER_MagicCommentKind;
/// Equivalent of `lib_ruby_parser::source::MagicComment`
/// @ingroup magic_comment
typedef struct
{
/// Kind of the magic comment
LIB_RUBY_PARSER_MagicCommentKind kind;
/// Location of the magic comment key
LIB_RUBY_PARSER_Loc key_l;
/// Location of the magic comment value
LIB_RUBY_PARSER_Loc value_l;
} LIB_RUBY_PARSER_MagicComment;
/// Equivalent of `Vec<lib_ruby_parser::source::MagicComment>`
/// @ingroup magic_comment
typedef struct
{
size_t capacity;
LIB_RUBY_PARSER_MagicComment *ptr;
size_t len;
} LIB_RUBY_PARSER_MagicCommentList;
/// MagicCommentList destructor.
/// Just like Rust/C++ destructor it performs cleanup of "embedded" resources.
/// i.e. it doesn't call `free` on a given pointer.
/// @ingroup magic_comment
void LIB_RUBY_PARSER_drop_magic_comment_list(LIB_RUBY_PARSER_MagicCommentList *magic_comment_list);
#endif // LIB_RUBY_PARSER_MAGIC_COMMENT_H