diff options
Diffstat (limited to 'src/poem/read.rs')
-rw-r--r-- | src/poem/read.rs | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/poem/read.rs b/src/poem/read.rs index 875bf76..e5cd25d 100644 --- a/src/poem/read.rs +++ b/src/poem/read.rs @@ -68,6 +68,12 @@ impl Appendable for Poem { return Ok(()); } + // Check the meter + verse.meter = meter; + if last == Rune::Couplet || meter == Rune::Couplet { + verse.couplet = true; + } + // Check for aliases match env.aliases.get(&verse.verb()) { Some(alias) => { @@ -80,32 +86,23 @@ impl Appendable for Poem { None => unreachable!(), // Should be caught by a Mishap above }; - // If the verse has a clause, add it to the last verse in - // the poem from the alias + // The last verse inherits the traits from the original + lv.couplet = verse.couplet; + lv.io = verse.io; + lv.poems = verse.poems.clone(); + lv.meter = verse.meter; if verse.clause().is_some() { for word in verse.clause().unwrap().iter() { lv.stanza.push(word.to_string()); } } - // Check the meter - lv.meter = meter; - if last == Rune::Couplet || meter == Rune::Couplet { - verse.couplet = true; - } - // Push verse(s) for v in poem.iter() { self.push(v.clone()); } } None => { - // Check the meter - verse.meter = meter; - if last == Rune::Couplet || meter == Rune::Couplet { - verse.couplet = true; - } - // Push verse(s) self.push(verse.clone()); } @@ -162,8 +159,6 @@ impl Readable for Poem { None => { // Check for IO parse errors if last == Rune::Read || last == Rune::Write || last == Rune::Addendum { - println!("err 0"); - println!("{:?}", verse); return Err(Mishap::IOMishap(j, i, ' ')); } @@ -173,7 +168,6 @@ impl Readable for Poem { // Throw an error if the verse is empty if verse.is_empty() && (last == Rune::Couplet || last == Rune::And) { - println!("err 1"); return Err(Mishap::ParseMishap(j, i, ' ')); } |