use alloc::format;
use alloc::string::{String, ToString};
use alloc::vec;
use alloc::vec::Vec;
use crate::runtime::{Runtime, RuntimeError, Value};
fn the_answer_of_an_act(
rt: &mut Runtime<'_>,
name: &str,
answer: Result<Value, RuntimeError>,
) -> Result<Value, RuntimeError> {
match answer {
Ok(value) => Ok(value),
Err(failure) => {
rt.note(format!(
"the command {name} did not do the thing: {}",
failure.message
));
Ok(Value::Text(String::new()))
}
}
}
fn the_answer_that_goes_on(
rt: &mut Runtime<'_>,
name: &str,
values: &[Value],
line: u32,
answer: Result<Value, RuntimeError>,
error_level: bool,
) -> Result<Value, RuntimeError> {
match answer {
Ok(value) => {
crate::v1::commands::write_the_answer(rt, name, values, 0, value.clone(), line)?;
if error_level {
rt.set_the_error_level(Value::Int(0));
}
Ok(value)
}
Err(failure) => {
crate::v1::commands::write_the_answer(
rt,
name,
values,
0,
Value::Text(String::new()),
line,
)?;
if error_level {
rt.set_the_error_level(Value::Int(1));
}
rt.note(format!(
"the command {name} did not do the thing: {}",
failure.message
));
Ok(Value::Text(String::new()))
}
}
}
pub(crate) fn com_obj_create(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let class = values
.first()
.map(|value| value.to_text())
.unwrap_or_default();
let interface = values.get(1).map(|value| value.to_text());
let interface = interface.filter(|text| !text.is_empty());
let object = rt
.desktop()
.com_object_of_the_class(&class, interface.as_deref())
.map_err(|reason| RuntimeError {
message: reason,
line,
})?;
crate::classes::comvalue::construct_the_object(&[Value::Int(object.pointer as i64)], rt, line)
.map_err(|failure| RuntimeError {
message: crate::builtins::the_message_of(failure),
line,
})
}
pub(crate) fn com_obj_array(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let kind = values
.first()
.map(|value| value.to_text())
.unwrap_or_default()
.trim()
.parse::<i64>()
.unwrap_or(0);
let count = values
.get(1)
.map(|value| value.to_text())
.unwrap_or_default()
.trim()
.parse::<f64>()
.unwrap_or(0.0);
let object = rt
.desktop()
.com_value_is_made(kind, crate::desktop::ComValue::Number(count))
.map_err(|reason| RuntimeError {
message: reason,
line,
})?;
crate::classes::comvalue::construct_the_object(&[Value::Int(object.pointer as i64)], rt, line)
.map_err(|failure| RuntimeError {
message: crate::builtins::the_message_of(failure),
line,
})
}
pub(crate) fn com_obj_error(
_rt: &mut Runtime<'_>,
values: &[Value],
_line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let before = crate::settings::com_obj_error();
if let Some(setting) = values.first() {
let on = match setting {
Value::Int(number) => *number != 0,
Value::Float(number) => *number != 0.0,
other => !other.to_text().is_empty(),
};
crate::settings::set_com_obj_error(on);
}
Ok(Value::Int(if before { 1 } else { 0 }))
}
pub(crate) fn control(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let sub_command = value_of(values, 0);
let value = value_of(values, 1);
let control = value_of(values, 2);
let title = value_of(values, 3);
let mut rest: Vec<Value> = vec![Value::Text(control.clone()), Value::Text(title.clone())];
rest.extend(values.iter().skip(4).cloned());
let answer = match sub_command.to_ascii_lowercase().as_str() {
"enable" => crate::builtins::control_set_enabled(rt, &rest, line, 0),
"disable" => crate::builtins::control_set_enabled(rt, &rest, line, 0),
"hide" => crate::builtins::control_visibility(rt, &rest, line, 0),
"show" => crate::builtins::control_show(rt, &rest, line, 0),
"focus" => crate::builtins::control_act(rt, &rest, line, 1),
"move" => crate::builtins::control_move(rt, &rest, line, 0),
"click" => crate::builtins::control_act(rt, &rest, line, 0),
"send" => crate::builtins::control_send(rt, &rest, line, 0),
"sendtext" => crate::builtins::control_send_text(rt, &rest, line, 0),
"style" => crate::builtins::control_style(rt, &rest, line, 0),
"exstyle" => crate::builtins::control_style(rt, &rest, line, 1),
"showdropdown" => crate::builtins::control_show_drop_down(rt, &rest, line, 0),
"hidedropdown" => crate::builtins::control_hide_drop_down(rt, &rest, line, 0),
"check" => crate::builtins::control_set_checked(rt, &rest, line, 0),
"uncheck" => crate::builtins::control_set_checked(rt, &rest, line, 0),
_ => Err(RuntimeError {
message: format!("the sub-command {sub_command} of the Control is not known."),
line,
}),
};
let answer = match sub_command.to_ascii_lowercase().as_str() {
"enable" | "disable" | "check" | "uncheck" => {
let mut with_value = rest.clone();
with_value.insert(0, Value::Text(value.clone()));
match sub_command.to_ascii_lowercase().as_str() {
"enable" => crate::builtins::control_set_enabled(rt, &with_value, line, 0),
"disable" => crate::builtins::control_set_enabled(rt, &with_value, line, 0),
"check" => crate::builtins::control_set_checked(rt, &with_value, line, 0),
_ => crate::builtins::control_set_checked(rt, &with_value, line, 0),
}
}
_ => answer,
};
the_answer_of_an_act(rt, "Control", answer)
}
pub(crate) fn drive(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let sub_command = value_of(values, 0);
let value = value_of(values, 1);
let answer = match sub_command.to_ascii_lowercase().as_str() {
"label" => crate::builtins::drive_set_label(rt, &[Value::Text(value)], line, 0),
"lock" => crate::builtins::drive_lock(rt, &[Value::Text(value)], line, 0),
"unlock" => crate::builtins::drive_unlock(rt, &[Value::Text(value)], line, 0),
"eject" => crate::builtins::drive_eject(rt, &[Value::Text(value)], line, 0),
"retract" => crate::builtins::drive_retract(rt, &[Value::Text(value)], line, 0),
_ => Err(RuntimeError {
message: format!("the sub-command {sub_command} of the Drive is not known."),
line,
}),
};
the_answer_of_an_act(rt, "Drive", answer)
}
pub(crate) fn gui(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let sub_command = value_of(values, 0);
let trimmed = sub_command.trim();
let answer = if trimmed.starts_with('+') || trimmed.starts_with('-') {
let on = trimmed.starts_with('+');
let name = trimmed[1..].trim().to_ascii_lowercase();
rt.desktop()
.gui_option(&name, on)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
} else {
match trimmed.to_ascii_lowercase().as_str() {
"new" => {
if rt.desktop().gui_is_open() {
rt.desktop()
.gui_destroy(0)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))?;
}
let title = value_of(values, 1);
rt.desktop()
.gui_open(&title)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"add" => {
let kind = the_kind_of_the_machine(&value_of(values, 1));
let text = value_of(values, 3);
let handle = the_window_of_the_script(rt, line)?;
rt.desktop()
.gui_add(handle, &kind, &text)
.map(|(number, _)| Value::Text(number.to_string()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"show" => {
let handle = the_window_of_the_script(rt, line)?;
rt.desktop()
.gui_show(handle)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"hide" => rt
.desktop()
.gui_hide()
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line)),
"destroy" => rt
.desktop()
.gui_destroy(0)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line)),
"menu" => {
let name = value_of(values, 1);
let items = crate::v1::menus::the_items_of_the_menu(rt, &name);
rt.desktop()
.gui_menu_bar(&items)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"minimize" => the_state_of_the_window(rt, "minimize", line),
"maximize" => the_state_of_the_window(rt, "maximize", line),
"restore" => the_state_of_the_window(rt, "restore", line),
"submit" | "cancel" | "font" | "color" | "margin" | "flash" | "default" | "tab" => {
Err(RuntimeError {
message: the_reason_of_a_gui_that_the_tree_does_not_carry(
&trimmed.to_ascii_lowercase(),
),
line,
})
}
_ => Err(RuntimeError {
message: format!("the sub-command {sub_command} of the Gui is not known."),
line,
}),
}
};
the_answer_of_an_act(rt, "Gui", answer)
}
fn the_window_of_the_script(rt: &mut Runtime<'_>, line: u32) -> Result<u64, RuntimeError> {
if rt.desktop().gui_is_open() {
return Ok(0);
}
rt.desktop()
.gui_open("")
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
fn the_kind_of_the_machine(kind: &str) -> String {
let kind = kind.trim().to_ascii_lowercase();
match kind.as_str() {
"dropdownlist" => "ddl".to_string(),
"trackbar" => "slider".to_string(),
"tab3" => "tab".to_string(),
_ => kind,
}
}
fn the_state_of_the_window(
rt: &mut Runtime<'_>,
state: &str,
line: u32,
) -> Result<Value, RuntimeError> {
rt.desktop()
.gui_option(state, true)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
fn the_reason_of_a_gui_that_the_tree_does_not_carry(sub_command: &str) -> String {
match sub_command {
"font" => "the tree does not carry the font of the window of the script: the machine of the tree has no font for it.".to_string(),
"color" => "the tree does not carry the colour of the window of the script: the machine of the tree has no colour for it.".to_string(),
"margin" => "the tree does not carry the margin of the window of the script: the machine of the tree lays the controls out its own way.".to_string(),
"submit" | "cancel" => "the tree does not carry the submit of the window of the script: the machine of the tree does not speak the messages of the window.".to_string(),
_ => format!("the tree does not carry the {sub_command} of the window of the script."),
}
}
pub(crate) fn gui_control(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let sub_command = value_of(values, 0);
let control = value_of(values, 1);
let value = value_of(values, 2);
let answer = (|| -> Result<Value, RuntimeError> {
match sub_command.trim().to_ascii_lowercase().as_str() {
"enable" => the_state_of_a_control(rt, &control, "enabled", true, line),
"disable" => the_state_of_a_control(rt, &control, "enabled", false, line),
"hide" => rt
.desktop()
.gui_visibility(&control, false)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line)),
"show" => rt
.desktop()
.gui_visibility(&control, true)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line)),
"focus" => {
let number = the_number_of_a_control(rt, &control, line)?;
rt.desktop()
.gui_focus(number as u64)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"text" => {
let number = the_number_of_a_control(rt, &control, line)?;
if value.is_empty() {
rt.desktop()
.gui_value(number as u64, None)
.map(Value::Text)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
} else {
rt.desktop()
.gui_value(number as u64, Some(&value))
.map(Value::Text)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
}
"choose" => {
let number = the_number_of_a_control(rt, &control, line)?;
rt.desktop()
.gui_combo_select(number as u64, &value, false)
.map(|index| Value::Text(index.to_string()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"choosestring" => {
let number = the_number_of_a_control(rt, &control, line)?;
rt.desktop()
.gui_combo_select(number as u64, &value, true)
.map(|index| Value::Text(index.to_string()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"move" | "movedraw" | "font" => Err(RuntimeError {
message: the_reason_of_a_gui_control_that_the_tree_does_not_carry(sub_command.trim()),
line,
}),
_ => Err(RuntimeError {
message: format!("the sub-command {sub_command} of the GuiControl is not known."),
line,
}),
}
})();
the_answer_of_an_act(rt, "GuiControl", answer)
}
fn the_reason_of_a_gui_control_that_the_tree_does_not_carry(sub_command: &str) -> String {
match sub_command.to_ascii_lowercase().as_str() {
"font" => "the tree does not carry the font of a control of the window of the script: the machine of the tree has no font for it.".to_string(),
_ => "the tree does not move a control of the window of the script: the machine of the tree lays the controls out its own way.".to_string(),
}
}
fn the_number_of_a_control(
rt: &mut Runtime<'_>,
control: &str,
line: u32,
) -> Result<i64, RuntimeError> {
rt.desktop()
.gui_number_named(control)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
fn the_state_of_a_control(
rt: &mut Runtime<'_>,
control: &str,
what: &str,
on: bool,
line: u32,
) -> Result<Value, RuntimeError> {
let number = the_number_of_a_control(rt, control, line)?;
rt.desktop()
.gui_flag(number as u64, what, Some(on))
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
pub(crate) fn gui_control_get(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let sub_command = value_of(values, 1);
let control = value_of(values, 2);
let answer = (|| -> Result<Value, RuntimeError> {
match sub_command.trim().to_ascii_lowercase().as_str() {
"" | "text" => {
let number = the_number_of_a_control(rt, &control, line)?;
rt.desktop()
.gui_value(number as u64, None)
.map(Value::Text)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"pos" => {
let number = the_number_of_a_control(rt, &control, line)?;
let (x, y, width, height) = rt
.desktop()
.gui_control_pos(number as u64)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))?;
Ok(Value::Text(format!("{x} {y} {width} {height}")))
}
"focus" => rt
.desktop()
.gui_focused()
.map(Value::Text)
.map_err(|reason| crate::builtins::desktop_failure(reason, line)),
"focusv" => Err(RuntimeError {
message: "the tree does not carry the variable of the control that has the focus: the controls of the window of the script have no variable.".to_string(),
line,
}),
"enabled" => {
let number = the_number_of_a_control(rt, &control, line)?;
rt.desktop()
.gui_flag(number as u64, "enabled", None)
.map(Value::Int)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"visible" => {
let number = the_number_of_a_control(rt, &control, line)?;
rt.desktop()
.gui_flag(number as u64, "visible", None)
.map(Value::Int)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"hwnd" => {
let number = the_number_of_a_control(rt, &control, line)?;
rt.desktop()
.gui_handle(number as u64)
.map(Value::Int)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
"name" => {
let number = the_number_of_a_control(rt, &control, line)?;
rt.desktop()
.gui_classnn(number as u64)
.map(Value::Text)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
_ => Err(RuntimeError {
message: format!(
"the sub-command {sub_command} of the GuiControlGet is not known."
),
line,
}),
}
})();
the_answer_that_goes_on(rt, "GuiControlGet", values, line, answer, true)
}
pub(crate) fn input_hook(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let options = values
.first()
.map(|value| value.to_text())
.unwrap_or_default();
let end_keys = values.get(1).map(|value| value.to_text()).unwrap_or_default();
let match_list = values.get(2).map(|value| value.to_text()).unwrap_or_default();
let mut arguments: Vec<Value> = Vec::new();
if !options.trim().is_empty() {
arguments.push(Value::Text(the_options_of_the_v2(&options, line)?));
}
if !end_keys.trim().is_empty() {
arguments.push(Value::Text(end_keys));
}
if !match_list.trim().is_empty() {
arguments.push(Value::Text(match_list));
}
match crate::classes::construct("InputHook", &arguments, rt, line) {
Some(answer) => answer.map_err(|failure| RuntimeError {
message: crate::builtins::the_message_of(failure),
line,
}),
None => Err(RuntimeError {
message: "the class of the InputHook is not known.".to_string(),
line,
}),
}
}
fn the_options_of_the_v2(options: &str, line: u32) -> Result<String, RuntimeError> {
let mut carried = String::new();
for letter in options.split_whitespace() {
for one in letter.chars() {
let upper = one.to_ascii_uppercase();
match upper {
'B' | 'C' | 'E' | 'H' | 'I' | 'L' | 'M' | 'N' | 'O' | 'P' | 'R' | 'S' | 'T' | 'V'
| 'W' => carried.push(upper),
_ => {
return Err(RuntimeError {
message: format!("the option {one} of the InputHook is not known."),
line,
})
}
}
}
}
Ok(carried)
}
pub(crate) fn menu(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let name = value_of(values, 0);
let sub_command = value_of(values, 1);
let value = value_of(values, 2);
let answer = match sub_command.trim().to_ascii_lowercase().as_str() {
"add" => {
let callback = value_of(values, 3);
crate::v1::menus::add_item(rt, &name, &value, &callback, line)
}
"insert" => {
let callback = value_of(values, 3);
crate::v1::menus::insert_item(rt, &name, &value, &callback, line)
}
"delete" => crate::v1::menus::delete_item(rt, &name, &value, line),
"deleteall" => crate::v1::menus::delete_all(rt, &name, line),
"disable" => crate::v1::menus::set_enabled(rt, &name, &value, false, line),
"enable" => crate::v1::menus::set_enabled(rt, &name, &value, true, line),
"toggleenable" => crate::v1::menus::toggle_enabled(rt, &name, &value, line),
"check" => crate::v1::menus::set_checked(rt, &name, &value, true, line),
"uncheck" => crate::v1::menus::set_checked(rt, &name, &value, false, line),
"togglecheck" => crate::v1::menus::toggle_checked(rt, &name, &value, line),
"default" => crate::v1::menus::set_default(rt, &name, &value, line),
"nodefault" => crate::v1::menus::no_default(rt, &name, line),
"rename" => {
let new_name = value_of(values, 2);
let old_name = value_of(values, 3);
crate::v1::menus::rename_item(rt, &name, &old_name, &new_name, line)
}
"standard" | "nostandard" | "icon" | "noicon" | "tip" | "show" | "color" | "click"
| "mainwindow" | "nomainwindow" | "useerrorlevel" => Err(RuntimeError {
message: the_reason_of_a_menu_that_the_tree_does_not_carry(sub_command.trim()),
line,
}),
_ => Err(RuntimeError {
message: format!("the sub-command {sub_command} of the Menu is not known."),
line,
}),
};
the_answer_of_an_act(rt, "Menu", answer)
}
fn the_reason_of_a_menu_that_the_tree_does_not_carry(sub_command: &str) -> String {
match sub_command.to_ascii_lowercase().as_str() {
"standard" | "nostandard" => "the tree does not carry the standard items of a menu: the menus of the tree have the items that the script puts in them.".to_string(),
_ => "the tree does not carry the menu bar of a window of the machine: the menus of the tree are menus of the script.".to_string(),
}
}
pub(crate) fn menu_get_handle(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let name = values
.first()
.map(|value| value.to_text())
.unwrap_or_default();
crate::v1::menus::the_handle_of(rt, &name, line)
}
pub(crate) fn menu_get_name(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let handle = values
.first()
.map(|value| value.to_text())
.unwrap_or_default();
crate::v1::menus::the_name_of(rt, &handle, line)
}
pub(crate) fn progress(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let percent = value_of(values, 0);
let answer = if percent.trim().eq_ignore_ascii_case("off") {
rt.desktop()
.gui_destroy(0)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
} else {
let number = percent.trim().parse::<i64>().unwrap_or(0);
let handle = rt
.desktop()
.gui_open("Progress")
.map_err(|reason| crate::builtins::desktop_failure(reason, line))?;
let (control, _) = rt
.desktop()
.gui_add(handle, "Progress", &number.to_string())
.map_err(|reason| crate::builtins::desktop_failure(reason, line))?;
rt.desktop()
.gui_value(control, None)
.map(Value::Text)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
};
the_answer_of_an_act(rt, "Progress", answer)
}
pub(crate) fn splash_text_on(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
let width = values.get(1).map(|value| value.to_text()).unwrap_or_default();
let height = values.get(2).map(|value| value.to_text()).unwrap_or_default();
let title = values.get(3).map(|value| value.to_text()).unwrap_or_default();
let text = values.get(4).map(|value| value.to_text()).unwrap_or_default();
let handle = rt
.desktop()
.gui_open(&title)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))?;
let (control, _) = rt
.desktop()
.gui_add(handle, "Text", &text)
.map_err(|reason| crate::builtins::desktop_failure(reason, line))?;
let width = width.trim().parse::<i64>().unwrap_or(200);
let height = height.trim().parse::<i64>().unwrap_or(0);
rt.desktop()
.gui_size(control, width, height)
.map(|_| Value::Text(String::new()))
.map_err(|reason| crate::builtins::desktop_failure(reason, line))
}
pub(crate) fn register_callback(
rt: &mut Runtime<'_>,
values: &[Value],
line: u32,
_variant: u8,
) -> Result<Value, RuntimeError> {
#[cfg(feature = "std")]
{
let name = value_of(values, 0);
if name.is_empty() {
return Err(RuntimeError {
message: "Parameter #1 of RegisterCallback must not be blank.".to_string(),
line,
});
}
let params = match values.get(2).and_then(|value| value.to_number()) {
Some(number) if number >= 0.0 => number as usize,
_ => rt.the_number_of_parameters_of(&name).unwrap_or(0),
};
let address = crate::callback::register(&name, params);
if address == 0 {
return Err(RuntimeError {
message: "the pool of the callbacks is full.".to_string(),
line,
});
}
Ok(Value::Int(address as i64))
}
#[cfg(not(feature = "std"))]
{
let _ = (rt, values);
Err(RuntimeError {
message: "the callback of the machine needs the std of the tree.".to_string(),
line,
})
}
}
fn value_of(values: &[Value], at: usize) -> String {
values.get(at).map(|value| value.to_text()).unwrap_or_default()
}