read identifier
This commit is contained in:
+15
-1
@@ -1,6 +1,20 @@
|
||||
mod lexer;
|
||||
mod token;
|
||||
|
||||
use crate::lexer::LexerTraits;
|
||||
use lexer::new;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let input = "let five = 5;
|
||||
let ten = 10;
|
||||
let add = fn(x, y) {
|
||||
x + y;
|
||||
};
|
||||
let result = add(five, ten);";
|
||||
|
||||
let mut l = new(input.to_string());
|
||||
|
||||
for (i, tok) in (0..10).map(|_| l.next_token()).enumerate() {
|
||||
println!("{}: {:?}", i, tok.type_);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user