diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-16 22:23:57 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-16 22:23:57 +0200 |
| commit | c5b3f8ee98203191d83d3cfca39bb0f35ee6efc2 (patch) | |
| tree | d41733b9f532a1b4ad0089761315ef69ba413e82 /src/library/structure/list.rs | |
| parent | 2db4b603db7684db7105d7ed627883b5cef6d497 (diff) | |
Switch to `unscanny`
Diffstat (limited to 'src/library/structure/list.rs')
| -rw-r--r-- | src/library/structure/list.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/library/structure/list.rs b/src/library/structure/list.rs index 9d5d3a7d..10dcfb7b 100644 --- a/src/library/structure/list.rs +++ b/src/library/structure/list.rs @@ -1,8 +1,9 @@ +use unscanny::Scanner; + use crate::library::layout::{GridNode, TrackSizing}; use crate::library::prelude::*; use crate::library::text::ParNode; use crate::library::utility::Numbering; -use crate::parse::Scanner; /// An unordered (bulleted) or ordered (numbered) list. #[derive(Debug, Hash)] @@ -190,7 +191,7 @@ impl Cast<Spanned<Value>> for Label { let mut s = Scanner::new(&pattern); let mut prefix; let numbering = loop { - prefix = s.eaten(); + prefix = s.before(); match s.eat().map(|c| c.to_ascii_lowercase()) { Some('1') => break Numbering::Arabic, Some('a') => break Numbering::Letter, @@ -200,8 +201,8 @@ impl Cast<Spanned<Value>> for Label { None => Err("invalid pattern")?, } }; - let upper = s.prev(0).map_or(false, char::is_uppercase); - let suffix = s.rest().into(); + let upper = s.scout(-1).map_or(false, char::is_uppercase); + let suffix = s.after().into(); Ok(Self::Pattern(prefix.into(), numbering, upper, suffix)) } Value::Content(v) => Ok(Self::Content(v)), |
