use machine-generated PartialEq instance for hashing Constant (#817)

This commit is contained in:
Mark Thom
2021-02-11 18:40:07 -07:00
parent 2429971bcd
commit e7cf5d4f3d
5 changed files with 38 additions and 24 deletions

View File

@@ -33,7 +33,7 @@ macro_rules! consume_chars_with {
};
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone)]
pub enum Token {
Constant(Constant),
Var(Rc<Atom>),
@@ -49,6 +49,17 @@ pub enum Token {
End,
}
impl Token {
#[inline]
pub(super) fn is_end(&self) -> bool {
if let Token::End = self {
true
} else {
false
}
}
}
pub struct Lexer<'a, R: Read> {
pub(crate) atom_tbl: TabledData<Atom>,
pub(crate) reader: &'a mut ParsingStream<R>,