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/read.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/poem/read.rs') diff --git a/src/poem/read.rs b/src/poem/read.rs index 0956700..d88cf0d 100644 --- a/src/poem/read.rs +++ b/src/poem/read.rs @@ -4,7 +4,7 @@ use super::{ }; use core::fmt; mod parse; -use crate::{next, poem, string}; +use crate::{next, poem, remark, string}; #[derive(Debug, PartialEq, Eq)] pub enum Mishap { @@ -127,6 +127,7 @@ impl Readable for Poem { let rune = match c { ' ' => Rune::Pause, '/' => Rune::Path, + '#' => Rune::Remark, '\'' | '"' => Rune::String, '`' => Rune::Poem, '<' => { @@ -195,6 +196,10 @@ impl Readable for Poem { verse.add(&mut word); } + Rune::Remark => { + remark!(chars); + } + // Indicates a string (' or ") Rune::String => { string!(chars, j, i, c, word); -- cgit v1.2.3