From 5d06ba11c981430aca68f2ea31771fca7f18529b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 22 Jan 2025 22:22:46 +0100 Subject: Implement echo control statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/node.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/xixanta/src/node.rs') diff --git a/lib/xixanta/src/node.rs b/lib/xixanta/src/node.rs index 243b478..8273967 100644 --- a/lib/xixanta/src/node.rs +++ b/lib/xixanta/src/node.rs @@ -121,6 +121,13 @@ impl PString { } } +#[derive(Debug, Clone, PartialEq)] +pub enum EchoKind { + Info, + Warning, + Error, +} + /// The type of control function being used. Use this enum in order to detect /// which control function was detected instead of the node value. #[derive(Debug, Clone, PartialEq)] @@ -150,6 +157,7 @@ pub enum ControlType { Else, EndIf, Defined, + Echo(EchoKind), } impl fmt::Display for ControlType { @@ -180,6 +188,11 @@ impl fmt::Display for ControlType { ControlType::Else => write!(f, ".else"), ControlType::EndIf => write!(f, ".endif"), ControlType::Defined => write!(f, ".defined"), + ControlType::Echo(t) => match t { + EchoKind::Info => write!(f, ".info"), + EchoKind::Warning => write!(f, ".warning"), + EchoKind::Error => write!(f, ".error"), + }, } } } -- cgit v1.2.3