use std::{env::args, fs}; use testing::tokenize_str; use tuker::tokenizer::*; use tuker::*; // cargo run --example tokenizer_standalone examples/inputs/lisp.toml examples/inputs/lisp_input.lisp fn main() { let args: Vec<_> = args().collect(); let table_path = args .get(1) .expect("Please provide two arguments, path_to_definition_file.toml and input_text"); let table_input = fs::read_to_string(table_path) .unwrap_or_else(|e| panic!("Couldn't read table at {}: {e}", table_path)); let table_input = &table_input.replace("'", "\""); let tokenizer = &Tokenizer::from_toml(table_input).expect("Couldn't deserialize test tokenizer"); let input_path = args .get(2) .expect("Please provide two arguments, path_to_definition_file.toml and input_text"); let input_text = fs::read_to_string(input_path) .unwrap_or_else(|e| panic!("Couldn't read input at {}: {e}", input_path)); let matches = tokenize_str(table_input, &input_text, false); for m in matches { println!("{}", m.to_string(tokenizer)); } }