From 5c29835f70178e64daeae9b82111fe31376f6f35 Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Sun, 1 Sep 2024 04:26:32 -0600 Subject: Allow escaping characters This patch adds the '\' character as a new rune, Rune::Special. This is for escaping special characters. Also works in strings (", '). Signed-off-by: Rory Dudley --- src/poem/elements/rune.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/poem/elements') diff --git a/src/poem/elements/rune.rs b/src/poem/elements/rune.rs index 64e3326..79d53d0 100644 --- a/src/poem/elements/rune.rs +++ b/src/poem/elements/rune.rs @@ -19,6 +19,9 @@ pub enum Rune { /// The space character, to dilineate words (`' '`) Pause, + /// The backslash character, to escape special character (`\`) + Special, + /// The forward slash character, to dilineate paths (`/`) Path, @@ -81,6 +84,7 @@ impl fmt::Display for Rune { let rune = match self { Rune::None => "", Rune::Pause => " ", + Rune::Special => "\\", Rune::Path => "/", Rune::Remark => "#", Rune::String => "\"", -- cgit v1.2.3