Ruby
3.4.0dev (2024-11-22 revision 37a72b0150ec36b4ea27175039afc28c62207b0c)
|
The options that can be passed to the parser. More...
#include <options.h>
Data Fields | |
pm_options_shebang_callback_t | shebang_callback |
The callback to call when additional switches are found in a shebang comment. More... | |
void * | shebang_callback_data |
Any additional data that should be passed along to the shebang callback if one was set. More... | |
pm_string_t | filepath |
The name of the file that is currently being parsed. More... | |
int32_t | line |
The line within the file that the parse starts on. More... | |
pm_string_t | encoding |
The name of the encoding that the source file is in. More... | |
size_t | scopes_count |
The number of scopes surrounding the code that is being parsed. More... | |
pm_options_scope_t * | scopes |
The scopes surrounding the code that is being parsed. More... | |
pm_options_version_t | version |
The version of prism that we should be parsing with. More... | |
uint8_t | command_line |
A bitset of the various options that were set on the command line. More... | |
int8_t | frozen_string_literal |
Whether or not the frozen string literal option has been set. More... | |
bool | encoding_locked |
Whether or not the encoding magic comments should be respected. More... | |
bool | main_script |
When the file being parsed is the main script, the shebang will be considered for command-line flags (or for implicit -x). More... | |
bool | partial_script |
When the file being parsed is considered a "partial" script, jumps will not be marked as errors if they are not contained within loops/blocks. More... | |
uint8_t pm_options::command_line |
A bitset of the various options that were set on the command line.
Definition at line 126 of file options.h.
Referenced by pm_options_command_line_set(), and pm_options_read().
pm_string_t pm_options::encoding |
The name of the encoding that the source file is in.
Note that this must correspond to a name that can be found with Encoding.find in Ruby.
Definition at line 103 of file options.h.
Referenced by pm_options_encoding_set(), pm_options_free(), and pm_options_read().
bool pm_options::encoding_locked |
Whether or not the encoding magic comments should be respected.
This is a niche use-case where you want to parse a file with a specific encoding but ignore any encoding magic comments at the top of the file.
Definition at line 142 of file options.h.
Referenced by pm_options_encoding_locked_set(), and pm_options_read().
pm_string_t pm_options::filepath |
The name of the file that is currently being parsed.
Definition at line 91 of file options.h.
Referenced by pm_options_filepath_set(), pm_options_free(), and pm_options_read().
int8_t pm_options::frozen_string_literal |
Whether or not the frozen string literal option has been set.
May be:
Definition at line 135 of file options.h.
Referenced by pm_options_frozen_string_literal_set(), and pm_options_read().
int32_t pm_options::line |
The line within the file that the parse starts on.
This value is 1-indexed.
Definition at line 97 of file options.h.
Referenced by pm_options_line_set(), and pm_options_read().
bool pm_options::main_script |
When the file being parsed is the main script, the shebang will be considered for command-line flags (or for implicit -x).
The caller needs to pass this information to the parser so that it can behave correctly.
Definition at line 149 of file options.h.
Referenced by pm_options_main_script_set(), and pm_options_read().
bool pm_options::partial_script |
When the file being parsed is considered a "partial" script, jumps will not be marked as errors if they are not contained within loops/blocks.
This is used in the case that you're parsing a script that you know will be embedded inside another script later, but you do not have that context yet. For example, when parsing an ERB template that will be evaluated inside another script.
Definition at line 159 of file options.h.
Referenced by pm_options_partial_script_set(), and pm_options_read().
pm_options_scope_t* pm_options::scopes |
The scopes surrounding the code that is being parsed.
For most parses this will be NULL, but for evals it will be the locals that are in scope surrounding the eval. Scopes are ordered from the outermost scope to the innermost one.
Definition at line 116 of file options.h.
Referenced by pm_options_free(), pm_options_read(), pm_options_scope_get(), and pm_options_scopes_init().
size_t pm_options::scopes_count |
The number of scopes surrounding the code that is being parsed.
Definition at line 108 of file options.h.
Referenced by pm_options_free(), and pm_options_scopes_init().
pm_options_shebang_callback_t pm_options::shebang_callback |
The callback to call when additional switches are found in a shebang comment.
Definition at line 82 of file options.h.
Referenced by pm_options_shebang_callback_set().
void* pm_options::shebang_callback_data |
Any additional data that should be passed along to the shebang callback if one was set.
Definition at line 88 of file options.h.
Referenced by pm_options_shebang_callback_set().
pm_options_version_t pm_options::version |
The version of prism that we should be parsing with.
This is used to allow consumers to specify which behavior they want in case they need to parse exactly as a specific version of CRuby.
Definition at line 123 of file options.h.
Referenced by pm_options_read(), and pm_options_version_set().