datadog-ruby_core_source 3.5.5 → 3.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/list/list.h +791 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/str/str.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/constant.h +53 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/debug_counter.h +428 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/hrtime.h +237 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/id.h +365 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/id_table.h +74 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/array.h +158 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/basic_operators.h +67 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/bits.h +647 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/box.h +103 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/class.h +797 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/compilers.h +104 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/coverage.h +51 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/gc.h +411 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/imemo.h +302 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/sanitizers.h +346 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/serial.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/set_table.h +77 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/static_assert.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/time.h +34 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/variable.h +81 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/vm.h +144 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/warnings.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal.h +106 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/iseq.h +439 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/method.h +279 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/node.h +122 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/parser_st.h +161 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/parser_value.h +116 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/arena.h +37 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/ast.h +10371 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/buffer.h +52 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/comments.h +43 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/align.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/exported.h +24 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/filesystem.h +32 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nodiscard.h +22 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nonnull.h +18 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/constant_pool.h +81 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/diagnostic.h +93 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/errors_format.h +53 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/excludes.h +29 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/integer.h +41 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/json.h +32 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/line_offset_list.h +61 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/magic_comments.h +35 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/node.h +94 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/options.h +335 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/parser.h +348 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/prettyprint.h +31 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/prism.h +131 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/serialize.h +115 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/source.h +155 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/stream.h +28 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/string_query.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/stringy.h +72 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/version.h +38 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism_compile.h +204 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ractor_core.h +421 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ruby_assert.h +14 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ruby_atomic.h +115 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/rubyparser.h +1389 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/shape.h +733 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/thread_none.h +25 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/thread_pthread.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/thread_sched.h +271 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/vm_core.h +2509 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/vm_debug.h +124 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/vm_opts.h +65 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/vm_sync.h +160 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/zjit.h +221 -0
- data/lib/datadog/ruby_core_source/version.rb +1 -1
- metadata +77 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file node.h
|
|
3
|
+
*
|
|
4
|
+
* Functions related to nodes in the AST.
|
|
5
|
+
*/
|
|
6
|
+
#ifndef PRISM_NODE_H
|
|
7
|
+
#define PRISM_NODE_H
|
|
8
|
+
|
|
9
|
+
#include "prism/compiler/exported.h"
|
|
10
|
+
#include "prism/compiler/nonnull.h"
|
|
11
|
+
|
|
12
|
+
#include "prism/ast.h"
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Loop through each node in the node list, writing each node to the given
|
|
16
|
+
* pm_node_t pointer.
|
|
17
|
+
*/
|
|
18
|
+
#define PM_NODE_LIST_FOREACH(list, index, node) \
|
|
19
|
+
for (size_t index = 0; index < (list)->size && ((node) = (list)->nodes[index]); index++)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns a string representation of the given node type.
|
|
23
|
+
*
|
|
24
|
+
* @param node_type The node type to convert to a string.
|
|
25
|
+
* @returns A string representation of the given node type.
|
|
26
|
+
*/
|
|
27
|
+
PRISM_EXPORTED_FUNCTION const char * pm_node_type(pm_node_type_t node_type);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Visit each of the nodes in this subtree using the given visitor callback. The
|
|
31
|
+
* callback function will be called for each node in the subtree. If it returns
|
|
32
|
+
* false, then that node's children will not be visited. If it returns true,
|
|
33
|
+
* then the children will be visited. The data parameter is treated as an opaque
|
|
34
|
+
* pointer and is passed to the visitor callback for consumers to use as they
|
|
35
|
+
* see fit.
|
|
36
|
+
*
|
|
37
|
+
* As an example:
|
|
38
|
+
*
|
|
39
|
+
* ```c
|
|
40
|
+
* #include "prism.h"
|
|
41
|
+
*
|
|
42
|
+
* bool visit(const pm_node_t *node, void *data) {
|
|
43
|
+
* size_t *indent = (size_t *) data;
|
|
44
|
+
* for (size_t i = 0; i < *indent * 2; i++) putc(' ', stdout);
|
|
45
|
+
* printf("%s\n", pm_node_type(node->type));
|
|
46
|
+
*
|
|
47
|
+
* size_t next_indent = *indent + 1;
|
|
48
|
+
* size_t *next_data = &next_indent;
|
|
49
|
+
* pm_visit_child_nodes(node, visit, next_data);
|
|
50
|
+
*
|
|
51
|
+
* return false;
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* int main(void) {
|
|
55
|
+
* const char *source = "1 + 2; 3 + 4";
|
|
56
|
+
* size_t size = strlen(source);
|
|
57
|
+
*
|
|
58
|
+
* pm_arena_t *arena = pm_arena_new();
|
|
59
|
+
* pm_options_t *options = pm_options_new();
|
|
60
|
+
*
|
|
61
|
+
* pm_parser_t *parser = pm_parser_new(arena, (const uint8_t *) source, size, options);
|
|
62
|
+
*
|
|
63
|
+
* size_t indent = 0;
|
|
64
|
+
* pm_node_t *node = pm_parse(parser);
|
|
65
|
+
*
|
|
66
|
+
* size_t *data = &indent;
|
|
67
|
+
* pm_visit_node(node, visit, data);
|
|
68
|
+
*
|
|
69
|
+
* pm_parser_free(parser);
|
|
70
|
+
* pm_options_free(options);
|
|
71
|
+
* pm_arena_free(arena);
|
|
72
|
+
*
|
|
73
|
+
* return EXIT_SUCCESS;
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param node The root node to start visiting from.
|
|
78
|
+
* @param visitor The callback to call for each node in the subtree.
|
|
79
|
+
* @param data An opaque pointer that is passed to the visitor callback.
|
|
80
|
+
*/
|
|
81
|
+
PRISM_EXPORTED_FUNCTION void pm_visit_node(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data) PRISM_NONNULL(1);
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Visit the children of the given node with the given callback. This is the
|
|
85
|
+
* default behavior for walking the tree that is called from pm_visit_node if
|
|
86
|
+
* the callback returns true.
|
|
87
|
+
*
|
|
88
|
+
* @param node The node to visit the children of.
|
|
89
|
+
* @param visitor The callback to call for each child node.
|
|
90
|
+
* @param data An opaque pointer that is passed to the visitor callback.
|
|
91
|
+
*/
|
|
92
|
+
PRISM_EXPORTED_FUNCTION void pm_visit_child_nodes(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data) PRISM_NONNULL(1);
|
|
93
|
+
|
|
94
|
+
#endif
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file options.h
|
|
3
|
+
*
|
|
4
|
+
* The options that can be passed to parsing.
|
|
5
|
+
*/
|
|
6
|
+
#ifndef PRISM_OPTIONS_H
|
|
7
|
+
#define PRISM_OPTIONS_H
|
|
8
|
+
|
|
9
|
+
#include "prism/compiler/exported.h"
|
|
10
|
+
#include "prism/compiler/nodiscard.h"
|
|
11
|
+
#include "prism/compiler/nonnull.h"
|
|
12
|
+
|
|
13
|
+
#include "prism/stringy.h"
|
|
14
|
+
|
|
15
|
+
#include <stdbool.h>
|
|
16
|
+
#include <stddef.h>
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A scope of locals surrounding the code that is being parsed.
|
|
20
|
+
*/
|
|
21
|
+
typedef struct pm_options_scope_t pm_options_scope_t;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The options that can be passed to the parser.
|
|
25
|
+
*/
|
|
26
|
+
typedef struct pm_options_t pm_options_t;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* String literals should not be frozen.
|
|
30
|
+
*/
|
|
31
|
+
#define PM_OPTIONS_FROZEN_STRING_LITERAL_DISABLED ((int8_t) -1)
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* String literals may be frozen or mutable depending on the implementation
|
|
35
|
+
* default.
|
|
36
|
+
*/
|
|
37
|
+
#define PM_OPTIONS_FROZEN_STRING_LITERAL_UNSET ((int8_t) 0)
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* String literals should be made frozen.
|
|
41
|
+
*/
|
|
42
|
+
#define PM_OPTIONS_FROZEN_STRING_LITERAL_ENABLED ((int8_t) 1)
|
|
43
|
+
|
|
44
|
+
/** The default value for parameters. */
|
|
45
|
+
static const uint8_t PM_OPTIONS_SCOPE_FORWARDING_NONE = 0x0;
|
|
46
|
+
|
|
47
|
+
/** When the scope is forwarding with the * parameter. */
|
|
48
|
+
static const uint8_t PM_OPTIONS_SCOPE_FORWARDING_POSITIONALS = 0x1;
|
|
49
|
+
|
|
50
|
+
/** When the scope is forwarding with the ** parameter. */
|
|
51
|
+
static const uint8_t PM_OPTIONS_SCOPE_FORWARDING_KEYWORDS = 0x2;
|
|
52
|
+
|
|
53
|
+
/** When the scope is forwarding with the & parameter. */
|
|
54
|
+
static const uint8_t PM_OPTIONS_SCOPE_FORWARDING_BLOCK = 0x4;
|
|
55
|
+
|
|
56
|
+
/** When the scope is forwarding with the ... parameter. */
|
|
57
|
+
static const uint8_t PM_OPTIONS_SCOPE_FORWARDING_ALL = 0x8;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The callback called when additional switches are found in a shebang comment
|
|
61
|
+
* that need to be processed by the runtime.
|
|
62
|
+
*
|
|
63
|
+
* @param options The options struct that may be updated by this callback.
|
|
64
|
+
* Certain fields will be checked for changes, specifically encoding,
|
|
65
|
+
* command_line, and frozen_string_literal.
|
|
66
|
+
* @param source The source of the shebang comment.
|
|
67
|
+
* @param length The length of the source.
|
|
68
|
+
* @param shebang_callback_data Any additional data that should be passed along
|
|
69
|
+
* to the callback.
|
|
70
|
+
*/
|
|
71
|
+
typedef void (*pm_options_shebang_callback_t)(pm_options_t *options, const uint8_t *source, size_t length, void *shebang_callback_data);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A bit representing whether or not the command line -a option was set. -a
|
|
75
|
+
* splits the input line $_ into $F.
|
|
76
|
+
*/
|
|
77
|
+
static const uint8_t PM_OPTIONS_COMMAND_LINE_A = 0x1;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* A bit representing whether or not the command line -e option was set. -e
|
|
81
|
+
* allow the user to specify a script to be executed. This is necessary for
|
|
82
|
+
* prism to know because certain warnings are not generated when -e is used.
|
|
83
|
+
*/
|
|
84
|
+
static const uint8_t PM_OPTIONS_COMMAND_LINE_E = 0x2;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A bit representing whether or not the command line -l option was set. -l
|
|
88
|
+
* chomps the input line by default.
|
|
89
|
+
*/
|
|
90
|
+
static const uint8_t PM_OPTIONS_COMMAND_LINE_L = 0x4;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* A bit representing whether or not the command line -n option was set. -n
|
|
94
|
+
* wraps the script in a while gets loop.
|
|
95
|
+
*/
|
|
96
|
+
static const uint8_t PM_OPTIONS_COMMAND_LINE_N = 0x8;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A bit representing whether or not the command line -p option was set. -p
|
|
100
|
+
* prints the value of $_ at the end of each loop.
|
|
101
|
+
*/
|
|
102
|
+
static const uint8_t PM_OPTIONS_COMMAND_LINE_P = 0x10;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A bit representing whether or not the command line -x option was set. -x
|
|
106
|
+
* searches the input file for a shebang that includes "ruby".
|
|
107
|
+
*/
|
|
108
|
+
static const uint8_t PM_OPTIONS_COMMAND_LINE_X = 0x20;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Allocate a new options struct. If the options struct cannot be allocated,
|
|
112
|
+
* this function aborts the process.
|
|
113
|
+
*
|
|
114
|
+
* @returns A new options struct with default values. It is the responsibility
|
|
115
|
+
* of the caller to free this struct using pm_options_free().
|
|
116
|
+
*/
|
|
117
|
+
PRISM_NODISCARD PRISM_EXPORTED_FUNCTION pm_options_t * pm_options_new(void);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Free both the held memory of the given options struct and the struct itself.
|
|
121
|
+
*
|
|
122
|
+
* @param options The options struct to free.
|
|
123
|
+
*/
|
|
124
|
+
PRISM_EXPORTED_FUNCTION void pm_options_free(pm_options_t *options) PRISM_NONNULL(1);
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Set the shebang callback option on the given options struct.
|
|
128
|
+
*
|
|
129
|
+
* @param options The options struct to set the shebang callback on.
|
|
130
|
+
* @param shebang_callback The shebang callback to set.
|
|
131
|
+
* @param shebang_callback_data Any additional data that should be passed along
|
|
132
|
+
* to the callback.
|
|
133
|
+
*/
|
|
134
|
+
PRISM_EXPORTED_FUNCTION void pm_options_shebang_callback_set(pm_options_t *options, pm_options_shebang_callback_t shebang_callback, void *shebang_callback_data) PRISM_NONNULL(1);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get the filepath option on the given options struct.
|
|
138
|
+
*
|
|
139
|
+
* @param options The options struct to get the filepath from.
|
|
140
|
+
* @returns The filepath.
|
|
141
|
+
*/
|
|
142
|
+
PRISM_EXPORTED_FUNCTION const pm_string_t * pm_options_filepath(const pm_options_t *options) PRISM_NONNULL(1);
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Set the filepath option on the given options struct.
|
|
146
|
+
*
|
|
147
|
+
* @param options The options struct to set the filepath on.
|
|
148
|
+
* @param filepath The filepath to set.
|
|
149
|
+
*/
|
|
150
|
+
PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, const char *filepath) PRISM_NONNULL(1);
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Set the line option on the given options struct.
|
|
154
|
+
*
|
|
155
|
+
* @param options The options struct to set the line on.
|
|
156
|
+
* @param line The line to set.
|
|
157
|
+
*/
|
|
158
|
+
PRISM_EXPORTED_FUNCTION void pm_options_line_set(pm_options_t *options, int32_t line) PRISM_NONNULL(1);
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Set the encoding option on the given options struct.
|
|
162
|
+
*
|
|
163
|
+
* @param options The options struct to set the encoding on.
|
|
164
|
+
* @param encoding The encoding to set.
|
|
165
|
+
*/
|
|
166
|
+
PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, const char *encoding) PRISM_NONNULL(1);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Set the encoding_locked option on the given options struct.
|
|
170
|
+
*
|
|
171
|
+
* @param options The options struct to set the encoding_locked value on.
|
|
172
|
+
* @param encoding_locked The encoding_locked value to set.
|
|
173
|
+
*/
|
|
174
|
+
PRISM_EXPORTED_FUNCTION void pm_options_encoding_locked_set(pm_options_t *options, bool encoding_locked) PRISM_NONNULL(1);
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Set the frozen string literal option on the given options struct.
|
|
178
|
+
*
|
|
179
|
+
* @param options The options struct to set the frozen string literal value on.
|
|
180
|
+
* @param frozen_string_literal The frozen string literal value to set.
|
|
181
|
+
*/
|
|
182
|
+
PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_literal) PRISM_NONNULL(1);
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Sets the command line option on the given options struct.
|
|
186
|
+
*
|
|
187
|
+
* @param options The options struct to set the command line option on.
|
|
188
|
+
* @param command_line The command_line value to set.
|
|
189
|
+
*/
|
|
190
|
+
PRISM_EXPORTED_FUNCTION void pm_options_command_line_set(pm_options_t *options, uint8_t command_line) PRISM_NONNULL(1);
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Set the version option on the given options struct by parsing the given
|
|
194
|
+
* string. If the string contains an invalid option, this returns false.
|
|
195
|
+
* Otherwise, it returns true.
|
|
196
|
+
*
|
|
197
|
+
* @param options The options struct to set the version on.
|
|
198
|
+
* @param version The version to set.
|
|
199
|
+
* @param length The length of the version string.
|
|
200
|
+
* @returns Whether or not the version was parsed successfully.
|
|
201
|
+
*/
|
|
202
|
+
PRISM_EXPORTED_FUNCTION bool pm_options_version_set(pm_options_t *options, const char *version, size_t length) PRISM_NONNULL(1);
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Set the version option on the given options struct to the lowest version of
|
|
206
|
+
* Ruby that prism supports.
|
|
207
|
+
*
|
|
208
|
+
* @param options The options struct to set the version on.
|
|
209
|
+
*/
|
|
210
|
+
PRISM_EXPORTED_FUNCTION void pm_options_version_set_lowest(pm_options_t *options) PRISM_NONNULL(1);
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Set the version option on the given options struct to the highest version of
|
|
214
|
+
* Ruby that prism supports.
|
|
215
|
+
*
|
|
216
|
+
* @param options The options struct to set the version on.
|
|
217
|
+
*/
|
|
218
|
+
PRISM_EXPORTED_FUNCTION void pm_options_version_set_highest(pm_options_t *options) PRISM_NONNULL(1);
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Set the main script option on the given options struct.
|
|
222
|
+
*
|
|
223
|
+
* @param options The options struct to set the main script value on.
|
|
224
|
+
* @param main_script The main script value to set.
|
|
225
|
+
*/
|
|
226
|
+
PRISM_EXPORTED_FUNCTION void pm_options_main_script_set(pm_options_t *options, bool main_script) PRISM_NONNULL(1);
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Set the partial script option on the given options struct.
|
|
230
|
+
*
|
|
231
|
+
* @param options The options struct to set the partial script value on.
|
|
232
|
+
* @param partial_script The partial script value to set.
|
|
233
|
+
*/
|
|
234
|
+
PRISM_EXPORTED_FUNCTION void pm_options_partial_script_set(pm_options_t *options, bool partial_script) PRISM_NONNULL(1);
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Get the freeze option on the given options struct.
|
|
238
|
+
*
|
|
239
|
+
* @param options The options struct to get the freeze value from.
|
|
240
|
+
* @returns The freeze value.
|
|
241
|
+
*/
|
|
242
|
+
PRISM_EXPORTED_FUNCTION bool pm_options_freeze(const pm_options_t *options) PRISM_NONNULL(1);
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Set the freeze option on the given options struct.
|
|
246
|
+
*
|
|
247
|
+
* @param options The options struct to set the freeze value on.
|
|
248
|
+
* @param freeze The freeze value to set.
|
|
249
|
+
*/
|
|
250
|
+
PRISM_EXPORTED_FUNCTION void pm_options_freeze_set(pm_options_t *options, bool freeze) PRISM_NONNULL(1);
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Get the raise_error option on the given options struct.
|
|
254
|
+
*
|
|
255
|
+
* @param options The options struct to get the raise_error value from.
|
|
256
|
+
* @returns The raise_error value.
|
|
257
|
+
*/
|
|
258
|
+
PRISM_EXPORTED_FUNCTION uint8_t pm_options_raise_error(const pm_options_t *options) PRISM_NONNULL(1);
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Set the raise_error option on the given options struct.
|
|
262
|
+
*
|
|
263
|
+
* @param options The options struct to set the raise_error value on.
|
|
264
|
+
* @param raise_error The raise_error value to set.
|
|
265
|
+
*/
|
|
266
|
+
PRISM_EXPORTED_FUNCTION void pm_options_raise_error_set(pm_options_t *options, uint8_t raise_error) PRISM_NONNULL(1);
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Allocate and zero out the scopes array on the given options struct.
|
|
270
|
+
*
|
|
271
|
+
* @param options The options struct to initialize the scopes array on.
|
|
272
|
+
* @param scopes_count The number of scopes to allocate.
|
|
273
|
+
* @returns Whether or not the scopes array was initialized successfully.
|
|
274
|
+
*/
|
|
275
|
+
PRISM_EXPORTED_FUNCTION bool pm_options_scopes_init(pm_options_t *options, size_t scopes_count) PRISM_NONNULL(1);
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Return a constant pointer to the scope at the given index within the given
|
|
279
|
+
* options.
|
|
280
|
+
*
|
|
281
|
+
* @param options The options struct to get the scope from.
|
|
282
|
+
* @param index The index of the scope to get.
|
|
283
|
+
* @returns A constant pointer to the scope at the given index.
|
|
284
|
+
*/
|
|
285
|
+
PRISM_EXPORTED_FUNCTION const pm_options_scope_t * pm_options_scope(const pm_options_t *options, size_t index) PRISM_NONNULL(1);
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Return a mutable pointer to the scope at the given index within the given
|
|
289
|
+
* options.
|
|
290
|
+
*
|
|
291
|
+
* @param options The options struct to get the scope from.
|
|
292
|
+
* @param index The index of the scope to get.
|
|
293
|
+
* @returns A mutable pointer to the scope at the given index.
|
|
294
|
+
*/
|
|
295
|
+
PRISM_EXPORTED_FUNCTION pm_options_scope_t * pm_options_scope_mut(pm_options_t *options, size_t index) PRISM_NONNULL(1);
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Create a new options scope struct. This will hold a set of locals that are in
|
|
299
|
+
* scope surrounding the code that is being parsed. If the scope was unable to
|
|
300
|
+
* allocate its locals, this function will abort the process.
|
|
301
|
+
*
|
|
302
|
+
* @param scope The scope struct to initialize.
|
|
303
|
+
* @param locals_count The number of locals to allocate.
|
|
304
|
+
*/
|
|
305
|
+
PRISM_EXPORTED_FUNCTION void pm_options_scope_init(pm_options_scope_t *scope, size_t locals_count) PRISM_NONNULL(1);
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Return a constant pointer to the local at the given index within the given
|
|
309
|
+
* scope.
|
|
310
|
+
*
|
|
311
|
+
* @param scope The scope struct to get the local from.
|
|
312
|
+
* @param index The index of the local to get.
|
|
313
|
+
* @returns A constant pointer to the local at the given index.
|
|
314
|
+
*/
|
|
315
|
+
PRISM_EXPORTED_FUNCTION const pm_string_t * pm_options_scope_local(const pm_options_scope_t *scope, size_t index) PRISM_NONNULL(1);
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Return a mutable pointer to the local at the given index within the given
|
|
319
|
+
* scope.
|
|
320
|
+
*
|
|
321
|
+
* @param scope The scope struct to get the local from.
|
|
322
|
+
* @param index The index of the local to get.
|
|
323
|
+
* @returns A mutable pointer to the local at the given index.
|
|
324
|
+
*/
|
|
325
|
+
PRISM_EXPORTED_FUNCTION pm_string_t * pm_options_scope_local_mut(pm_options_scope_t *scope, size_t index) PRISM_NONNULL(1);
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Set the forwarding option on the given scope struct.
|
|
329
|
+
*
|
|
330
|
+
* @param scope The scope struct to set the forwarding on.
|
|
331
|
+
* @param forwarding The forwarding value to set.
|
|
332
|
+
*/
|
|
333
|
+
PRISM_EXPORTED_FUNCTION void pm_options_scope_forwarding_set(pm_options_scope_t *scope, uint8_t forwarding) PRISM_NONNULL(1);
|
|
334
|
+
|
|
335
|
+
#endif
|