2021-07-03 03:37:27 +02:00
|
|
|
use engine_q::{ParserWorkingSet, Signature, SyntaxShape};
|
2021-06-30 03:42:56 +02:00
|
|
|
|
|
|
|
fn main() -> std::io::Result<()> {
|
|
|
|
if let Some(path) = std::env::args().nth(1) {
|
|
|
|
let mut working_set = ParserWorkingSet::new(None);
|
|
|
|
|
2021-07-02 00:40:08 +02:00
|
|
|
let sig = Signature::build("foo").named("--jazz", SyntaxShape::Int, "jazz!!", Some('j'));
|
|
|
|
working_set.add_decl((b"foo").to_vec(), sig);
|
|
|
|
|
2021-07-02 21:30:03 +02:00
|
|
|
let file = std::fs::read(&path)?;
|
2021-07-03 05:35:15 +02:00
|
|
|
let (output, err) = working_set.parse_file(&path, file);
|
2021-07-02 21:30:03 +02:00
|
|
|
//let (output, err) = working_set.parse_source(path.as_bytes());
|
|
|
|
println!("{}", output.len());
|
2021-07-02 08:44:37 +02:00
|
|
|
println!("error: {:?}", err);
|
2021-07-03 05:35:15 +02:00
|
|
|
// println!("{}", size_of::<Statement>());
|
|
|
|
|
|
|
|
// let mut buffer = String::new();
|
|
|
|
// let stdin = std::io::stdin();
|
|
|
|
// let mut handle = stdin.lock();
|
|
|
|
|
|
|
|
// handle.read_to_string(&mut buffer)?;
|
2021-06-30 03:42:56 +02:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
} else {
|
|
|
|
println!("specify file to lex");
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|