Make ascii_* sets private to characters
This commit is contained in:
parent
7c43e93470
commit
08bbaeb7cf
2 changed files with 3 additions and 3 deletions
|
|
@ -7,12 +7,12 @@ use std::iter::FromIterator;
|
||||||
|
|
||||||
pub type CharSet = HashSet<char>;
|
pub type CharSet = HashSet<char>;
|
||||||
|
|
||||||
pub fn ascii_letters() -> CharSet {
|
fn ascii_letters() -> CharSet {
|
||||||
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".chars();
|
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".chars();
|
||||||
CharSet::from_iter(letters)
|
CharSet::from_iter(letters)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ascii_digits() -> CharSet {
|
fn ascii_digits() -> CharSet {
|
||||||
let digits = "1234567890".chars();
|
let digits = "1234567890".chars();
|
||||||
CharSet::from_iter(digits)
|
CharSet::from_iter(digits)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,6 @@ impl Iterator for Lexer {
|
||||||
pub fn hello(person: &str) {
|
pub fn hello(person: &str) {
|
||||||
println!("Hello, {}!", person);
|
println!("Hello, {}!", person);
|
||||||
for (idx, c) in person.char_indices() {
|
for (idx, c) in person.char_indices() {
|
||||||
println!(" {}, {} -> {}", c, idx, characters::ascii_letters().contains(&c));
|
println!(" {}, {} -> {}", c, idx, characters::identifier_initials().contains(&c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue