summaryrefslogtreecommitdiffstats
path: root/src/poem/read.rs
diff options
context:
space:
mode:
authorRory Dudley2024-03-28 21:01:49 -0600
committerRory Dudley2024-03-28 21:01:49 -0600
commit527cc04ffb9ea627ca678fe8fb07fe9330420eab (patch)
tree823bdf5d034def38e07c5299a8758ef616bc488a /src/poem/read.rs
parent9b2fcdb6bb6598786827e9f211df3db09de54567 (diff)
downloaddwarvish-527cc04ffb9ea627ca678fe8fb07fe9330420eab.tar.gz
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.
Diffstat (limited to 'src/poem/read.rs')
-rw-r--r--src/poem/read.rs7
1 files changed, 6 insertions, 1 deletions
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);