pub struct Environment {
pub condition_info: Option<ConditionInfoData>,
/* private fields */
}Expand description
A variable environment (scope).
Fields§
§condition_info: Option<ConditionInfoData>Most recent condition trap info (for CONDITION() BIF).
Implementations§
Source§impl Environment
impl Environment
pub fn new() -> Self
Sourcepub fn get(&self, name: &str) -> RexxValue
pub fn get(&self, name: &str) -> RexxValue
Get a simple variable’s value. In REXX, an unset variable returns its own name in uppercase.
REXX scoping: PROCEDURE creates an opaque wall. Only the current (topmost) scope is searched. EXPOSE copies specific variables into the new scope — that’s the only way through.
Sourcepub fn get_compound(&self, stem: &str, resolved_tail: &str) -> RexxValue
pub fn get_compound(&self, stem: &str, resolved_tail: &str) -> RexxValue
Get a compound variable: stem.tail The tail components are resolved (each variable in the tail is looked up) and concatenated with dots.
Sourcepub fn set_compound(
&mut self,
stem: &str,
resolved_tail: &str,
value: RexxValue,
)
pub fn set_compound( &mut self, stem: &str, resolved_tail: &str, value: RexxValue, )
Set a compound variable.
Sourcepub fn set_stem_default(&mut self, stem: &str, value: RexxValue)
pub fn set_stem_default(&mut self, stem: &str, value: RexxValue)
Set the default value for a stem (e.g., stem. = 0).
Sourcepub fn push_procedure(&mut self)
pub fn push_procedure(&mut self)
PROCEDURE — push a new empty scope.
Sourcepub fn push_procedure_expose(&mut self, names: &[String])
pub fn push_procedure_expose(&mut self, names: &[String])
PROCEDURE EXPOSE — push a new scope that shares specified variables.
Sourcepub fn pop_procedure(&mut self)
pub fn pop_procedure(&mut self)
Pop the current scope (on RETURN from a PROCEDURE). Writes back any exposed variables to the parent scope.
Sourcepub fn set_address(&mut self, env: &str)
pub fn set_address(&mut self, env: &str)
Set a new default ADDRESS environment, saving the old as previous.
Sourcepub fn swap_address(&mut self)
pub fn swap_address(&mut self)
Swap default ↔ previous ADDRESS environment.
Sourcepub fn set_source_path(&mut self, path: PathBuf)
pub fn set_source_path(&mut self, path: PathBuf)
Set the source file path (for external function resolution and PARSE SOURCE).
Sourcepub fn clear_source_path(&mut self)
pub fn clear_source_path(&mut self)
Clear the source file path (restores REPL/no-file state).
Sourcepub fn source_path(&self) -> Option<&Path>
pub fn source_path(&self) -> Option<&Path>
Get the source file path.
Sourcepub fn source_dir(&self) -> Option<&Path>
pub fn source_dir(&self) -> Option<&Path>
Get the directory containing the source file.
Sourcepub fn set_condition_info(&mut self, info: ConditionInfoData)
pub fn set_condition_info(&mut self, info: ConditionInfoData)
Set condition info (called when a trap fires).
Sourcepub fn is_set(&self, name: &str) -> bool
pub fn is_set(&self, name: &str) -> bool
Check if a simple variable has been explicitly set (for SIGNAL ON NOVALUE).
Sourcepub fn is_compound_set(&self, stem: &str, resolved_tail: &str) -> bool
pub fn is_compound_set(&self, stem: &str, resolved_tail: &str) -> bool
Check if a compound variable has been explicitly set (for SIGNAL ON NOVALUE). Returns true if the specific tail has a value OR the stem has a default.
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more