summaryrefslogtreecommitdiffstats
path: root/src/poem/elements/rune.rs
diff options
context:
space:
mode:
authorRory Dudley2024-09-01 04:26:32 -0600
committerRory Dudley2024-09-02 01:00:26 -0600
commit5c29835f70178e64daeae9b82111fe31376f6f35 (patch)
tree8b82edaa874486fe46a12a25e408f796f8a5d875 /src/poem/elements/rune.rs
parent6328666624e59574946f7af1570c5676aa54d0ac (diff)
downloaddwarvish-5c29835f70178e64daeae9b82111fe31376f6f35.tar.gz
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 <rory@netc.lu>
Diffstat (limited to 'src/poem/elements/rune.rs')
-rw-r--r--src/poem/elements/rune.rs4
1 files changed, 4 insertions, 0 deletions
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 => "\"",