Fix wrong space at define macro usage
This commit is contained in:
parent
0ae50c97d6
commit
048e39755f
@ -2,6 +2,8 @@
|
||||
|
||||
## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.4.4...Unreleased) - ReleaseDate
|
||||
|
||||
* [Fix] wrong space at define macro usage
|
||||
|
||||
## [v0.4.4](https://github.com/dalance/sv-parser/compare/v0.4.3...v0.4.4) - 2019-11-22
|
||||
|
||||
* [Fix] \`resetall wrongly clear define list
|
||||
|
@ -501,6 +501,8 @@ fn resolve_text_macro_usage<T: AsRef<Path>, U: AsRef<Path>>(
|
||||
}
|
||||
// separator is required
|
||||
replaced.push_str(" ");
|
||||
// remove leading whitespace
|
||||
replaced = String::from(replaced.trim_start());
|
||||
|
||||
let (replaced, new_defines) =
|
||||
preprocess_str(&replaced, path.as_ref(), &defines, include_paths)?;
|
||||
@ -628,7 +630,7 @@ module a ();
|
||||
r##"
|
||||
module a ();
|
||||
|
||||
always @(posedge clk) begin if (!(!(a[i].b && c[i]))) begin $display ("xxx(()[]]{}}}", a[i].b, c[i])
|
||||
always @(posedge clk) begin if (!(!(a[i].b && c[i]))) begin $display ("xxx(()[]]{}}}", a[i].b, c[i])
|
||||
; end end ;
|
||||
|
||||
endmodule
|
||||
@ -648,8 +650,8 @@ endmodule
|
||||
|
||||
initial begin
|
||||
$display("`HI, world");
|
||||
$display( "`HI, world" );
|
||||
$display( "Hello, x" );
|
||||
$display("`HI, world" );
|
||||
$display("Hello, x" );
|
||||
end
|
||||
endmodule
|
||||
"##
|
||||
@ -666,7 +668,7 @@ endmodule
|
||||
|
||||
module a;
|
||||
initial begin
|
||||
$display( "left side: \"right side\"" );
|
||||
$display("left side: \"right side\"" );
|
||||
end
|
||||
endmodule
|
||||
"##
|
||||
|
@ -6,6 +6,7 @@ use std::{cmp, process};
|
||||
use structopt::StructOpt;
|
||||
use sv_parser::parse_sv;
|
||||
use sv_parser_error::ErrorKind;
|
||||
use sv_parser_pp::preprocess::preprocess;
|
||||
|
||||
#[derive(StructOpt)]
|
||||
struct Opt {
|
||||
@ -19,6 +20,10 @@ struct Opt {
|
||||
#[structopt(short = "t", long = "tree")]
|
||||
pub tree: bool,
|
||||
|
||||
/// Show preprocesed text
|
||||
#[structopt(short = "p", long = "pp")]
|
||||
pub pp: bool,
|
||||
|
||||
/// Quiet
|
||||
#[structopt(short = "q", long = "quiet")]
|
||||
pub quiet: bool,
|
||||
@ -29,6 +34,15 @@ fn main() {
|
||||
let mut defines = HashMap::new();
|
||||
let mut exit = 0;
|
||||
for path in &opt.files {
|
||||
if opt.pp {
|
||||
match preprocess(&path, &defines, &opt.includes) {
|
||||
Ok((preprocessed_text, new_defines)) => {
|
||||
println!("{}", preprocessed_text.text());
|
||||
defines = new_defines;
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
} else {
|
||||
match parse_sv(&path, &defines, &opt.includes) {
|
||||
Ok((syntax_tree, new_defines)) => {
|
||||
if opt.tree {
|
||||
@ -53,6 +67,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
process::exit(exit);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user