Pass over whitespace and count lines

This commit is contained in:
Eryn Wells 2016-12-24 09:17:08 -07:00
parent f7c28c6732
commit 8140e3c5e6
2 changed files with 13 additions and 0 deletions

View file

@ -10,6 +10,7 @@ pub trait Lexable {
fn is_identifier_initial(&self) -> bool;
fn is_identifier_subsequent(&self) -> bool;
fn is_identifier_single(&self) -> bool;
fn is_newline(&self) -> bool;
}
impl Lexable for char {
@ -32,5 +33,9 @@ impl Lexable for char {
fn is_identifier_single(&self) -> bool {
charset::identifier_singles().contains(&self)
}
fn is_newline(&self) -> bool {
*self == '\n'
}
}