sv-parser support parse class declare
This commit is contained in:
parent
9b9d25b420
commit
9015bb0a95
@ -50,6 +50,9 @@ pub(crate) fn description(s: Span) -> IResult<Span, Description> {
|
|||||||
map(config_declaration, |x| {
|
map(config_declaration, |x| {
|
||||||
Description::ConfigDeclaration(Box::new(x))
|
Description::ConfigDeclaration(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
map(class_declaration, |x| {
|
||||||
|
Description::ClassDeclaration(Box::new(x))
|
||||||
|
}),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1339,4 +1339,36 @@ endmodule
|
|||||||
);
|
);
|
||||||
assert_eq!(ret.origin(80).unwrap().1, 60);
|
assert_eq!(ret.origin(80).unwrap().1, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test21() {
|
||||||
|
let include_paths = [get_testcase("")];
|
||||||
|
let (ret, _) = preprocess(
|
||||||
|
get_testcase("test21.sv"),
|
||||||
|
&HashMap::new(),
|
||||||
|
&include_paths,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test22() {
|
||||||
|
let include_paths = [get_testcase("")];
|
||||||
|
let (ret, _) = preprocess(
|
||||||
|
get_testcase("test22.sv"),
|
||||||
|
&HashMap::new(),
|
||||||
|
&include_paths,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
7
sv-parser-pp/testcases/test21.sv
Normal file
7
sv-parser-pp/testcases/test21.sv
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class test21 extends base_class /* base class*/;
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
function int funcname();
|
||||||
|
return 2;
|
||||||
|
endfunction : funcname
|
||||||
|
endclass : test21
|
18
sv-parser-pp/testcases/test22.sv
Normal file
18
sv-parser-pp/testcases/test22.sv
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// it's for test
|
||||||
|
|
||||||
|
`ifndef ABCD
|
||||||
|
`define ABCD
|
||||||
|
|
||||||
|
package my_package;
|
||||||
|
|
||||||
|
import uvm_pkg::*;
|
||||||
|
import internal_pkg::*;
|
||||||
|
|
||||||
|
// include
|
||||||
|
`include "test21.sv"
|
||||||
|
|
||||||
|
|
||||||
|
endpackage : my_package
|
||||||
|
|
||||||
|
|
||||||
|
`endif
|
@ -23,6 +23,7 @@ pub enum Description {
|
|||||||
PackageItem(Box<DescriptionPackageItem>),
|
PackageItem(Box<DescriptionPackageItem>),
|
||||||
BindDirective(Box<DescriptionBindDirective>),
|
BindDirective(Box<DescriptionBindDirective>),
|
||||||
ConfigDeclaration(Box<ConfigDeclaration>),
|
ConfigDeclaration(Box<ConfigDeclaration>),
|
||||||
|
ClassDeclaration(Box<ClassDeclaration>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Node)]
|
#[derive(Clone, Debug, PartialEq, Node)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user