Use the chars() iterator on &str, with the Peekable wrapper on Iterators, to iterate the input, rather than needing to hold the whole input and do iteration by indexes.
14 lines
251 B
Rust
14 lines
251 B
Rust
/* lexer/src/main.rs
|
|
* Eryn Wells <eryn@erynwells.me>
|
|
*/
|
|
|
|
extern crate sibillexer;
|
|
|
|
use sibillexer::Lexer;
|
|
|
|
fn main() {
|
|
let lexer = Lexer::new("(ab (cd) ef)".chars());
|
|
for tok in lexer {
|
|
println!("found {:?}", tok.unwrap());
|
|
}
|
|
}
|