From 527cc04ffb9ea627ca678fe8fb07fe9330420eab Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Thu, 28 Mar 2024 21:01:49 -0600 Subject: Add comments (`#`) to the parser The parser will now interpret the '#' character as a single-line comment string, which works on it's own line, or at the end of an existing line. --- src/poem/elements/rune.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/poem/elements/rune.rs') diff --git a/src/poem/elements/rune.rs b/src/poem/elements/rune.rs index 3f53c67..1742778 100644 --- a/src/poem/elements/rune.rs +++ b/src/poem/elements/rune.rs @@ -25,7 +25,7 @@ use std::sync::{Arc, Mutex}; /// * `None` - A shell command with no additional actions (the end of a poem) /// * `Pause` - The space character, to dilineate words (` `) /// * `Path` - The forward slash character, to dilineate paths (`/`) -/// * `Env` - Indicates an environment variable (`$`) +/// * `Remark` - Indicates a single line comment (`#`) /// * `String` - Interpret all character as one large /// [Word][super::word::Word] (`'` or `"`) /// * `Poem` - A subcommand to run first (`\``) @@ -43,6 +43,7 @@ pub enum Rune { None, // No meter (the end of a poem) Pause, // A space Path, // A forward slash + Remark, // A comment String, // Interpret the following as one large [Word] Poem, // Run a sub-poem before the main one Read, // Read files into STDIN @@ -65,6 +66,7 @@ impl fmt::Display for Rune { Rune::None => "", Rune::Pause => " ", Rune::Path => "/", + Rune::Remark => "#", Rune::String => "\"", Rune::Poem => "`", Rune::Read => "<", -- cgit v1.2.3