style: code style

This commit is contained in:
2020-07-26 15:19:19 +08:00
parent dfbb8889a7
commit ffd49ec6ea
3 changed files with 24 additions and 27 deletions

View File

@@ -9,16 +9,15 @@ pub struct Parser{
impl Parser {
pub fn new(keyword: String, end_filter: Box<dyn Fn(Vec<char>) -> bool>) -> Parser {
let callback = Box::from(|text : String, line : usize, file : &str| {
let callback = Box::from(|text: String, line: usize, file: &str| {
// let path = Path::new(file).strip_prefix(env::current_dir().unwrap().to_str().unwrap()).unwrap();
println!("{} {} {} {} : {}", file, "TODO".green() ,"Line ".green(), line.to_string().green(), text.blue());
});
Parser{keyword: keyword, end_filter: end_filter, callback}
Parser{ keyword, end_filter, callback }
}
pub fn new_callback(keyword: String, end_filter: Box<dyn Fn(Vec<char>) -> bool>, callback: Box<dyn Fn(String, usize, &str)>) -> Parser {
Parser{ keyword: keyword, end_filter : end_filter, callback }
Parser { keyword, end_filter, callback }
}
fn get_keyword(&self) -> String {