From 3b6cb44627659e103070760d58edfac00afe1298 Mon Sep 17 00:00:00 2001 From: Raamakrishnan Date: Sat, 25 Jan 2020 13:37:20 +0530 Subject: [PATCH] A simple try in main --- sample/files.f | 5 ++++- src/main.rs | 29 ++++------------------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/sample/files.f b/sample/files.f index 644e3aa..fabaac2 100644 --- a/sample/files.f +++ b/sample/files.f @@ -1,4 +1,7 @@ sample/file1.sv sample/file2.sv sample/file3.sv -sample/file4.sv \ No newline at end of file +sample/file4.sv ++incdir+sample/ +// Some comment ++define+a=b+c=d+e=f \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 300518f..0685df3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,33 +1,12 @@ use std::env; use std::path::PathBuf; use std::fs; +use sv_filelist_parser; fn main() { let args: Vec = env::args().collect(); - // get .f file - let dot_f_file = PathBuf::from(&args[1]); - println!("pathbuf {:?}", dot_f_file); - - // check if .f file exists - if dot_f_file.is_file() { - println!("File exists", ) - } else { - println!("File does not exist", ) - } - - // read .f file - let contents = fs::read_to_string(&dot_f_file) - .expect("Error while reading file"); - - println!("contents:\n{}", contents); - // check if all the files exist - for line in contents.lines() { - if PathBuf::from(line).is_file() { - println!("{} exists", line) - } - else { - println!("{} does not exist", line) - } - } + let filelist = sv_filelist_parser::parse(&args[1]) + .expect("Error parsing"); + println!("{:#?}", filelist); }