Lex hashes and booleans

This commit is contained in:
Eryn Wells 2016-12-24 10:29:10 -07:00
parent e9b0eab38a
commit 43054b3f49
4 changed files with 30 additions and 3 deletions

View file

@ -10,6 +10,8 @@ pub trait Lexable {
fn is_identifier_initial(&self) -> bool;
fn is_identifier_subsequent(&self) -> bool;
fn is_identifier_single(&self) -> bool;
fn is_hash(&self) -> bool;
fn is_boolean(&self) -> bool;
fn is_newline(&self) -> bool;
}
@ -34,6 +36,14 @@ impl Lexable for char {
charset::identifier_singles().contains(&self)
}
fn is_hash(&self) -> bool {
*self == '#'
}
fn is_boolean(&self) -> bool {
*self == 't' || *self == 'f'
}
fn is_newline(&self) -> bool {
*self == '\n'
}