[lexer] move char::is_hash() to chars::Lexable
This commit is contained in:
parent
dc8f5a7686
commit
663ae3a9f1
2 changed files with 5 additions and 8 deletions
|
@ -11,6 +11,7 @@ pub trait Lexable {
|
||||||
|
|
||||||
fn is_exactness(&self) -> bool;
|
fn is_exactness(&self) -> bool;
|
||||||
fn is_radix(&self) -> bool;
|
fn is_radix(&self) -> bool;
|
||||||
|
fn is_hash(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Lexable for char {
|
impl Lexable for char {
|
||||||
|
@ -42,6 +43,10 @@ impl Lexable for char {
|
||||||
let radishes = &['b', 'd', 'o', 'x'];
|
let radishes = &['b', 'd', 'o', 'x'];
|
||||||
radishes.contains(self)
|
radishes.contains(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_hash(&self) -> bool {
|
||||||
|
*self == '#'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait LexableSpecial {
|
trait LexableSpecial {
|
||||||
|
|
|
@ -29,11 +29,3 @@ impl State for Begin {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait BeginLexable {
|
|
||||||
fn is_hash(&self) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BeginLexable for char {
|
|
||||||
fn is_hash(&self) -> bool { *self == '#' }
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue