Various parser fixes

This commit is contained in:
2025-11-23 00:10:48 -07:00
parent c3adcf57f5
commit 92c1047ef8
2 changed files with 22 additions and 5 deletions

View File

@@ -1,3 +1,5 @@
use crate::tree_node::Literal;
use super::LiteralOrVariable;
#[derive(Debug, PartialEq, Eq)]
@@ -111,13 +113,20 @@ pub enum System {
/// ## Examples
/// `l r0 d0 Setting`
/// `l r1 d5 Pressure`
LoadFromDevice(LiteralOrVariable, String),
LoadFromDevice(LiteralOrVariable, LiteralOrVariable),
/// Function which gets a LogicType from all connected network devices that match
/// the provided device hash and name, aggregating them via a batchMode
/// ## In Game
/// lbn r? deviceHash nameHash logicType batchMode
/// ## Examples
/// lbn r0 HASH("StructureWallLight") HASH("wallLight") On Minimum
LoadBatchNamed(LiteralOrVariable, Literal, Literal, Literal),
/// Represents a function which stores a setting into a specific device.
/// ## In Game
/// `s d? logicType r?`
/// ## Example
/// `s d0 Setting r0`
SetOnDevice(LiteralOrVariable, String, LiteralOrVariable),
SetOnDevice(LiteralOrVariable, Literal, LiteralOrVariable),
}
impl std::fmt::Display for System {
@@ -127,6 +136,9 @@ impl std::fmt::Display for System {
System::Sleep(a) => write!(f, "sleep({})", a),
System::Hash(a) => write!(f, "HASH({})", a),
System::LoadFromDevice(a, b) => write!(f, "loadFromDevice({}, {})", a, b),
System::LoadBatchNamed(a, b, c, d) => {
write!(f, "loadBatchNamed({}, {}, {}, {})", a, b, c, d)
}
System::SetOnDevice(a, b, c) => write!(f, "setOnDevice({}, {}, {})", a, b, c),
}
}