pub struct Interpreter {Show 71 fields
pub scope: Scope,
pub ofs: String,
pub ors: String,
pub irs: Option<String>,
pub errno: String,
pub errno_code: i32,
pub eval_error: String,
pub eval_error_code: i32,
pub eval_error_value: Option<PerlValue>,
pub argv: Vec<String>,
pub env: IndexMap<String, PerlValue>,
pub env_materialized: bool,
pub program_name: String,
pub line_number: i64,
pub last_readline_handle: String,
pub handle_line_numbers: HashMap<String, i64>,
pub sigint_pending_caret: Cell<bool>,
pub auto_split: bool,
pub field_separator: Option<String>,
pub warnings: bool,
pub output_autoflush: bool,
pub default_print_handle: String,
pub suppress_stdout: bool,
pub child_exit_status: i64,
pub last_match: String,
pub prematch: String,
pub postmatch: String,
pub last_paren_match: String,
pub list_separator: String,
pub script_start_time: i64,
pub compile_hints: i64,
pub warning_bits: i64,
pub global_phase: String,
pub subscript_sep: String,
pub inplace_edit: String,
pub debug_flags: i64,
pub perl_debug_flags: i64,
pub eval_nesting: u32,
pub argv_current_file: String,
pub strict_refs: bool,
pub strict_subs: bool,
pub strict_vars: bool,
pub utf8_pragma: bool,
pub open_pragma_utf8: bool,
pub feature_bits: u64,
pub num_threads: usize,
pub struct_defs: HashMap<String, Arc<StructDef>>,
pub enum_defs: HashMap<String, Arc<EnumDef>>,
pub class_defs: HashMap<String, Arc<ClassDef>>,
pub trait_defs: HashMap<String, Arc<TraitDef>>,
pub profiler: Option<Profiler>,
pub format_page_number: i64,
pub format_lines_per_page: i64,
pub format_lines_left: i64,
pub format_line_break_chars: String,
pub format_top_name: String,
pub accumulator_format: String,
pub max_system_fd: i64,
pub emergency_memory: String,
pub last_subpattern_name: String,
pub inc_hook_index: i64,
pub multiline_match: bool,
pub executable_path: String,
pub formfeed_string: String,
pub vm_jit_enabled: bool,
pub disasm_bytecode: bool,
pub pec_precompiled_chunk: Option<Chunk>,
pub pec_cache_fingerprint: Option<[u8; 32]>,
pub line_mode_skip_main: bool,
pub line_mode_stdin_pending: VecDeque<String>,
pub debugger: Option<Debugger>,
/* private fields */
}Fields§
§scope: Scope§ofs: StringOutput separator ($,)
ors: StringOutput record separator ($)
irs: Option<String>Input record separator ($/). None represents undef (slurp mode in <>).
Default at startup: Some("\n"). local $/ (no init) sets None.
errno: String$! — last OS error
errno_code: i32Numeric errno for $! dualvar (raw_os_error()), 0 when unset.
eval_error: String$@ — last eval error (string)
eval_error_code: i32Numeric side of $@ dualvar (0 when cleared; 1 for typical exception strings; or explicit code from assignment / dualvar).
eval_error_value: Option<PerlValue>When die is called with a ref argument, the ref value is preserved here.
argv: Vec<String>@ARGV
env: IndexMap<String, PerlValue>%ENV (mirrors scope hash "ENV" after Self::materialize_env_if_needed)
env_materialized: boolFalse until first Self::materialize_env_if_needed (defers std::env::vars() cost).
program_name: String$0
line_number: i64Current line number $. (global increment; see handle_line_numbers for per-handle)
last_readline_handle: StringLast handle key used for $. (e.g. STDIN, FH, ARGV:path).
handle_line_numbers: HashMap<String, i64>Line count per handle for $. when keyed (Perl-style last-read handle).
sigint_pending_caret: Cell<bool>$^C — set when SIGINT is pending before handler runs (cleared on read).
auto_split: boolAuto-split mode (-a)
field_separator: Option<String>Field separator for -F
warnings: bool-w warnings / use warnings / $^W
output_autoflush: boolOutput autoflush ($|).
default_print_handle: StringDefault handle for print / say / printf with no explicit handle (select FH sets this).
suppress_stdout: boolSuppress stdout output (fan workers with progress bars).
child_exit_status: i64Child wait status ($?) — POSIX-style (exit code in high byte, etc.).
last_match: StringLast successful match ($&, ${^MATCH}).
prematch: StringBefore match ($`, ${^PREMATCH}).
postmatch: StringAfter match ($', ${^POSTMATCH}).
last_paren_match: StringLast bracket match ($+, ${^LAST_SUBMATCH_RESULT}).
list_separator: StringList separator for array stringification in concatenation / interpolation ($").
script_start_time: i64Script start time ($^T) — seconds since Unix epoch.
compile_hints: i64$^H — compile-time hints (bit flags; pragma / BEGIN may update).
warning_bits: i64${^WARNING_BITS} — warnings bitmask (Perl internal; surfaced for compatibility).
global_phase: String${^GLOBAL_PHASE} — interpreter phase (RUN, …).
subscript_sep: String$; — hash subscript separator (multi-key join); Perl default \034.
inplace_edit: String$^I — in-place edit backup suffix (empty when no backup; also unset when -i was not passed).
The stryke driver sets this from -i / -i.ext.
debug_flags: i64$^D — debugging flags (integer; mostly ignored).
perl_debug_flags: i64$^P — debugging / profiling flags (integer; mostly ignored).
eval_nesting: u32Nesting depth for eval / evalblock ($^S is non-zero while inside eval).
argv_current_file: String$ARGV — name of the file last opened by <> (empty for stdin or before first file).
strict_refs: booluse strict / use strict 'refs' / qw(refs subs vars) (Perl names).
strict_subs: bool§strict_vars: bool§utf8_pragma: booluse utf8 — source is UTF-8 (reserved for future lexer/string semantics).
open_pragma_utf8: booluse open ':encoding(UTF-8)' / qw(:std :encoding(UTF-8)) / :utf8 — readline uses UTF-8 lossy decode.
feature_bits: u64use feature — bit flags (FEAT_*).
num_threads: usizeNumber of parallel threads
struct_defs: HashMap<String, Arc<StructDef>>struct Name { ... } definitions (merged from VM chunks and tree-walker).
enum_defs: HashMap<String, Arc<EnumDef>>enum Name { ... } definitions (merged from VM chunks and tree-walker).
class_defs: HashMap<String, Arc<ClassDef>>class Name extends ... impl ... { ... } definitions.
trait_defs: HashMap<String, Arc<TraitDef>>trait Name { ... } definitions.
profiler: Option<Profiler>When set, stryke --profile records timings: VM path uses per-opcode line samples and sub
call/return (JIT disabled); tree-walker fallback uses per-statement lines and subs.
format_page_number: i64$% — format output page number.
format_lines_per_page: i64$= — format lines per page.
format_lines_left: i64$- — lines remaining on format page.
format_line_break_chars: String$: — characters to break format lines (Perl default \n).
format_top_name: String$^ — top-of-form format name.
accumulator_format: String$^A — format write accumulator.
max_system_fd: i64$^F — max system file descriptor (Perl default 2).
emergency_memory: String$^M — emergency memory buffer (no-op pool in stryke).
last_subpattern_name: String$^N — last opened named regexp capture name.
inc_hook_index: i64$INC — @INC hook iterator (Perl 5.37+).
multiline_match: bool$* — multiline matching (deprecated in Perl); when true, compile_regex prepends (?s).
executable_path: String$^X — path to this executable (cached).
formfeed_string: String$^L — formfeed string for formats (Perl default \f).
vm_jit_enabled: boolWhen false, the bytecode VM runs without Cranelift (see crate::try_vm_execute). Disabled by
STRYKE_NO_JIT=1 / true / yes, or stryke --no-jit after Self::new.
disasm_bytecode: boolWhen true, crate::try_vm_execute prints bytecode disassembly to stderr before running the VM.
pec_precompiled_chunk: Option<Chunk>Sideband: precompiled crate::bytecode::Chunk loaded from a .pec cache hit. When
Some, crate::try_vm_execute uses it directly and skips compile_program. Consumed
(.take()) on first read so re-entry compiles normally.
pec_cache_fingerprint: Option<[u8; 32]>Sideband: fingerprint to save the compiled chunk under after a cache miss (pairs with
crate::pec::try_save). None when the cache is disabled or the caller does not want
the compiled chunk persisted.
line_mode_skip_main: bool-n/-p driver: prelude only in Self::execute_tree; body runs in Self::process_line.
line_mode_stdin_pending: VecDeque<String>-n/-p stdin driver: lines peek-read to compute eof / is_last are pushed here so
<> / readline in the body reads them before the real stdin stream (Perl shares one fd).
debugger: Option<Debugger>Interactive debugger state (-d flag).
Implementations§
Source§impl Interpreter
impl Interpreter
pub fn new() -> Self
Sourcepub fn line_mode_worker_clone(&self) -> Interpreter
pub fn line_mode_worker_clone(&self) -> Interpreter
Fork interpreter state for -n/-p over multiple @ARGV files in parallel (rayon).
Clears file descriptors and I/O handles (each worker only runs the line loop).
Sourcepub fn materialize_env_if_needed(&mut self)
pub fn materialize_env_if_needed(&mut self)
Populate Self::env and the %ENV hash from std::env::vars once.
Deferred from Self::new to reduce interpreter startup when %ENV is unused.
Sourcepub fn install_data_handle(&mut self, data: Vec<u8>)
pub fn install_data_handle(&mut self, data: Vec<u8>)
Install the DATA handle from a script __DATA__ section (bytes after the marker line).
pub fn set_file(&mut self, file: &str)
Sourcepub fn repl_completion_names(&self) -> Vec<String>
pub fn repl_completion_names(&self) -> Vec<String>
Keywords, builtins, lexical names, and subroutine names for REPL tab-completion.
Sourcepub fn repl_completion_snapshot(&self) -> ReplCompletionSnapshot
pub fn repl_completion_snapshot(&self) -> ReplCompletionSnapshot
Subroutine keys, blessed scalar classes, and @ISA edges for REPL $obj-> completion.
pub fn execute(&mut self, program: &Program) -> PerlResult<PerlValue>
Sourcepub fn run_end_blocks(&mut self) -> PerlResult<()>
pub fn run_end_blocks(&mut self) -> PerlResult<()>
Run END blocks (after -n/-p line loop when prelude used Self::line_mode_skip_main).
Sourcepub fn run_global_teardown(&mut self) -> PerlResult<()>
pub fn run_global_teardown(&mut self) -> PerlResult<()>
After a top-level program finishes (post-END), set ${^GLOBAL_PHASE} to DESTRUCT
and drain remaining DESTROY callbacks.
Sourcepub fn execute_tree(&mut self, program: &Program) -> PerlResult<PerlValue>
pub fn execute_tree(&mut self, program: &Program) -> PerlResult<PerlValue>
Tree-walking execution (fallback when bytecode compilation fails).
Sourcepub fn process_line(
&mut self,
line_str: &str,
program: &Program,
is_last_input_line: bool,
) -> PerlResult<Option<String>>
pub fn process_line( &mut self, line_str: &str, program: &Program, is_last_input_line: bool, ) -> PerlResult<Option<String>>
Process a line in -n/-p mode.
is_last_input_line is true when this line is the last from the current stdin or @ARGV
file so eof with no arguments matches Perl behavior on that line.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Interpreter
impl !RefUnwindSafe for Interpreter
impl Send for Interpreter
impl !Sync for Interpreter
impl Unpin for Interpreter
impl UnsafeUnpin for Interpreter
impl !UnwindSafe for Interpreter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.