Add single character identifiers
This commit is contained in:
parent
fd3f6f9f29
commit
f7c28c6732
3 changed files with 14 additions and 2 deletions
|
@ -9,15 +9,16 @@ pub trait Lexable {
|
|||
fn is_right_paren(&self) -> bool;
|
||||
fn is_identifier_initial(&self) -> bool;
|
||||
fn is_identifier_subsequent(&self) -> bool;
|
||||
fn is_identifier_single(&self) -> bool;
|
||||
}
|
||||
|
||||
impl Lexable for char {
|
||||
fn is_left_paren(&self) -> bool {
|
||||
self == &'('
|
||||
*self == '('
|
||||
}
|
||||
|
||||
fn is_right_paren(&self) -> bool {
|
||||
self == &')'
|
||||
*self == ')'
|
||||
}
|
||||
|
||||
fn is_identifier_initial(&self) -> bool {
|
||||
|
@ -27,5 +28,9 @@ impl Lexable for char {
|
|||
fn is_identifier_subsequent(&self) -> bool {
|
||||
charset::identifier_subsequents().contains(&self)
|
||||
}
|
||||
|
||||
fn is_identifier_single(&self) -> bool {
|
||||
charset::identifier_singles().contains(&self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue