transliterate/
std_types.rs1use crate::parser::*;
2use bogobble::*;
3
4impl<CF: BackTo> SSParser<CF> for &'static str {
5 fn ss_parse<'a>(&self, it: &PIter<'a>, res: &mut String, _: &CF) -> SSRes<'a> {
6 let mut i2 = it.clone();
7 for x in self.chars() {
8 if i2.next() != Some(x) {
9 return i2.err_rs(self);
10 }
11 }
12 res.push_str(self);
13 Ok((i2, None))
14 }
15}
16
17impl<CF: BackTo> SSParser<CF> for char {
18 fn ss_parse<'a>(&self, it: &PIter<'a>, res: &mut String, _: &CF) -> SSRes<'a> {
19 let mut i2 = it.clone();
20 match i2.next().map(|c| *self == c) {
21 Some(true) => {
22 res.push(*self);
23 Ok((i2, None))
24 }
25 _ => Err(it.err(Expected::Char(*self))),
26 }
27 }
28}