From 40a403c412be52b713a7363840bfa3f507985a9f Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Fri, 17 May 2024 16:14:42 -0600 Subject: Rewrite of the next! macro This patch replaces the next! macro with a next() function. It serves the same purpose, but instead of only checking for two different runes (a fallback, or one that matches the peek), it can now take a list of runes/characters to look ahead for, in addition to the fallback. --- src/poem/read.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/poem/read.rs') diff --git a/src/poem/read.rs b/src/poem/read.rs index afa35e7..35ca2e1 100644 --- a/src/poem/read.rs +++ b/src/poem/read.rs @@ -5,7 +5,8 @@ use super::{ use core::fmt; mod parse; use crate::compose::Environment; -use crate::{next, poem, remark, string}; +use crate::{poem, remark, string}; +use parse::next; #[derive(Debug, PartialEq, Eq)] pub enum Mishap { @@ -191,9 +192,9 @@ impl Readable for Poem { verse.couplet = true; Rune::Read } - '>' => next!(chars, i, Rune::Write, Rune::Addendum, '>'), + '>' => next(&mut chars, &mut i, Rune::Write, vec![('>', Rune::Addendum)]), '|' => Rune::Couplet, - '&' => next!(chars, i, Rune::Quiet, Rune::And, '&'), + '&' => next(&mut chars, &mut i, Rune::Quiet, vec![('&', Rune::And)]), ';' => Rune::Continue, '\n' => { j += 1; -- cgit v1.2.3