use super::*;
pub struct ExactMatch {
pub matches: String
}
impl Peeker for ExactMatch {
type Item = String;
fn peek_for_token(&self, parser: &mut Parser) -> Option<Token> {
if let Some(tok) = parser.peek() {
match &tok {
Token::Str(s) => {
if *s == self.matches {
Some(tok)
} else {
None
}
},
_ => None
}
} else {
None
}
}
}
impl ContainerCp for ExactMatch {
type Input = String;
type ContainedType = String;
fn new_contained(value: Self::Input) -> Self::ContainedType {
value
}
fn new(value: Self::Input) -> Self {
ExactMatch { matches: Self::new_contained(value) }
}
}