Added loadBatch and loadBatchNamed to the parser

This commit is contained in:
2025-11-23 00:24:15 -07:00
parent 92c1047ef8
commit b3c64a8e17
2 changed files with 38 additions and 0 deletions

View File

@@ -758,6 +758,36 @@ impl Parser {
LiteralOrVariable::Variable(variable.clone()), LiteralOrVariable::Variable(variable.clone()),
))) )))
} }
"loadBatch" => {
check_length(self, &invocation.arguments, 3)?;
let mut args = invocation.arguments.iter();
let device_hash = literal_or_variable!(args.next());
let logic_type = get_arg!(Literal, literal_or_variable!(args.next()));
let batch_mode = get_arg!(Literal, literal_or_variable!(args.next()));
Ok(SysCall::System(sys_call::System::LoadBatch(
device_hash,
logic_type,
batch_mode,
)))
}
"loadBatchNamed" => {
check_length(self, &invocation.arguments, 4)?;
let mut args = invocation.arguments.iter();
let device_hash = literal_or_variable!(args.next());
let name_hash = get_arg!(Literal, literal_or_variable!(args.next()));
let logic_type = get_arg!(Literal, literal_or_variable!(args.next()));
let batch_mode = get_arg!(Literal, literal_or_variable!(args.next()));
Ok(SysCall::System(sys_call::System::LoadBatchNamed(
device_hash,
name_hash,
logic_type,
batch_mode,
)))
}
"setOnDevice" => { "setOnDevice" => {
check_length(self, &invocation.arguments, 3)?; check_length(self, &invocation.arguments, 3)?;
let mut args = invocation.arguments.iter(); let mut args = invocation.arguments.iter();

View File

@@ -121,6 +121,13 @@ pub enum System {
/// ## Examples /// ## Examples
/// lbn r0 HASH("StructureWallLight") HASH("wallLight") On Minimum /// lbn r0 HASH("StructureWallLight") HASH("wallLight") On Minimum
LoadBatchNamed(LiteralOrVariable, Literal, Literal, Literal), LoadBatchNamed(LiteralOrVariable, Literal, Literal, Literal),
/// Loads a LogicType from all connected network devices, aggregating them via a
/// batchMode
/// ## In Game
/// lb r? deviceHash loggicType batchMode
/// ## Examples
/// lb r0 HASH("StructureWallLight") On Minimum
LoadBatch(LiteralOrVariable, Literal, Literal),
/// Represents a function which stores a setting into a specific device. /// Represents a function which stores a setting into a specific device.
/// ## In Game /// ## In Game
/// `s d? logicType r?` /// `s d? logicType r?`
@@ -136,6 +143,7 @@ impl std::fmt::Display for System {
System::Sleep(a) => write!(f, "sleep({})", a), System::Sleep(a) => write!(f, "sleep({})", a),
System::Hash(a) => write!(f, "HASH({})", a), System::Hash(a) => write!(f, "HASH({})", a),
System::LoadFromDevice(a, b) => write!(f, "loadFromDevice({}, {})", a, b), System::LoadFromDevice(a, b) => write!(f, "loadFromDevice({}, {})", a, b),
System::LoadBatch(a, b, c) => write!(f, "loadBatch({}, {}, {})", a, b, c),
System::LoadBatchNamed(a, b, c, d) => { System::LoadBatchNamed(a, b, c, d) => {
write!(f, "loadBatchNamed({}, {}, {}, {})", a, b, c, d) write!(f, "loadBatchNamed({}, {}, {}, {})", a, b, c, d)
} }