Skip to content

Instantly share code, notes, and snippets.

@skeleten
Created January 4, 2018 01:27
Show Gist options
  • Save skeleten/8c9ec1252c730ca7e1f03e201e585d4e to your computer and use it in GitHub Desktop.
Save skeleten/8c9ec1252c730ca7e1f03e201e585d4e to your computer and use it in GitHub Desktop.
Compiling rusty-lisp v0.1.0 (file:///home/skeleten/Source/skeleten/rusty-lisp)
warning: unused import: `lexer::LexableInput`
--> src/main.rs:7:5
|
7 | use lexer::LexableInput;
| ^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
error[E0597]: `buf` does not live long enough
--> src/main.rs:14:36
|
14 | let inp = lexer::StrInput::new(&buf);
| ^^^^ borrowed value does not live long enough
...
20 | }
| - borrowed value only lives until here
|
= note: borrowed value must be valid for lifetime '_#19r...
error: aborting due to previous error
error: Could not compile `rusty-lisp`.
To learn more, run the command again with --verbose.
#![feature(nll)]
mod lexer;
use std::io::Write;
use lexer::LexableInput;
fn main() {
let mut buf = String::new();
print!(">> ");
std::io::stdout().flush().unwrap();
std::io::stdin().read_line(&mut buf).unwrap();
let inp = lexer::StrInput::new(&buf);
let mut l = lexer::Lexer::new(inp);
while let Some(lexem) = l.next_lexem() {
println!("{:?}", lexem.ty);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment