Ruby 3.3.2p78 (2024-05-30 revision e5a195edf62fe1bf7146a191da13fa1c4fecbd71)
options.h
Go to the documentation of this file.
1
6#ifndef PRISM_OPTIONS_H
7#define PRISM_OPTIONS_H
8
9#include "prism/defines.h"
11
12#include <stdbool.h>
13#include <stddef.h>
14#include <stdint.h>
15
26
68
75PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, const char *filepath);
76
84
91PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, const char *encoding);
92
99PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_literal);
100
107PRISM_EXPORTED_FUNCTION void pm_options_suppress_warnings_set(pm_options_t *options, bool suppress_warnings);
108
115PRISM_EXPORTED_FUNCTION void pm_options_scopes_init(pm_options_t *options, size_t scopes_count);
116
125
134
143
150
202void pm_options_read(pm_options_t *options, const char *data);
203
204#endif
PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, const char *encoding)
Set the encoding option on the given options struct.
Definition options.c:15
PRISM_EXPORTED_FUNCTION void pm_options_free(pm_options_t *options)
Free the internal memory associated with the options.
Definition options.c:84
struct pm_options_scope pm_options_scope_t
A scope of locals surrounding the code that is being parsed.
PRISM_EXPORTED_FUNCTION const pm_string_t * pm_options_scope_local_get(const pm_options_scope_t *scope, size_t index)
Return a pointer to the local at the given index within the given scope.
Definition options.c:76
void pm_options_read(pm_options_t *options, const char *data)
Deserialize an options struct from the given binary string.
Definition options.c:141
PRISM_EXPORTED_FUNCTION void pm_options_scopes_init(pm_options_t *options, size_t scopes_count)
Allocate and zero out the scopes array on the given options struct.
Definition options.c:47
PRISM_EXPORTED_FUNCTION void pm_options_suppress_warnings_set(pm_options_t *options, bool suppress_warnings)
Set the suppress warnings option on the given options struct.
Definition options.c:39
PRISM_EXPORTED_FUNCTION void pm_options_line_set(pm_options_t *options, int32_t line)
Set the line option on the given options struct.
Definition options.c:23
PRISM_EXPORTED_FUNCTION const pm_options_scope_t * pm_options_scope_get(const pm_options_t *options, size_t index)
Return a pointer to the scope at the given index within the given options.
Definition options.c:57
PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_literal)
Set the frozen string literal option on the given options struct.
Definition options.c:31
PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, const char *filepath)
Set the filepath option on the given options struct.
Definition options.c:7
PRISM_EXPORTED_FUNCTION void pm_options_scope_init(pm_options_scope_t *scope, size_t locals_count)
Create a new options scope struct.
Definition options.c:66
A generic string type that can have various ownership semantics.
Macro definitions used throughout the prism library.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition defines.h:32
C99 shim for <stdbool.h>
A scope of locals surrounding the code that is being parsed.
Definition options.h:19
size_t locals_count
The number of locals in the scope.
Definition options.h:21
pm_string_t * locals
The names of the locals in the scope.
Definition options.h:24
The options that can be passed to the parser.
Definition options.h:30
pm_options_scope_t * scopes
The scopes surrounding the code that is being parsed.
Definition options.h:56
size_t scopes_count
The number of scopes surrounding the code that is being parsed.
Definition options.h:49
bool suppress_warnings
Whether or not we should suppress warnings.
Definition options.h:66
pm_string_t encoding
The name of the encoding that the source file is in.
Definition options.h:44
bool frozen_string_literal
Whether or not the frozen string literal option has been set.
Definition options.h:59
int32_t line
The line within the file that the parse starts on.
Definition options.h:38
pm_string_t filepath
The name of the file that is currently being parsed.
Definition options.h:32
A generic string type that can have various ownership semantics.
Definition pm_string.h:30