nushell/src/main.rs

21 lines
677 B
Rust
Raw Normal View History

2021-07-01 22:54:04 +00:00
use engine_q::{ParserWorkingSet, Signature, SyntaxShape};
2021-06-30 01:42:56 +00:00
fn main() -> std::io::Result<()> {
if let Some(path) = std::env::args().nth(1) {
let mut working_set = ParserWorkingSet::new(None);
2021-07-01 22:40:08 +00:00
let sig = Signature::build("foo").named("--jazz", SyntaxShape::Int, "jazz!!", Some('j'));
working_set.add_decl((b"foo").to_vec(), sig);
2021-07-01 00:01:04 +00:00
//let file = std::fs::read(&path)?;
//let (output, err) = working_set.parse_file(&path, &file);
let (output, err) = working_set.parse_source(path.as_bytes());
2021-06-30 01:42:56 +00:00
println!("{:?} {:?}", output, err);
Ok(())
} else {
println!("specify file to lex");
Ok(())
}
}