diff --git a/CHANGELOG.md b/CHANGELOG.md index 9974ecc..8a23f46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.3.6...Unreleased) - ReleaseDate +* [Fixed] apply workaround for static class method call * [Fixed] randomize_call bug ## [v0.3.6](https://github.com/dalance/sv-parser/compare/v0.3.5...v0.3.6) - 2019-11-05 diff --git a/sv-parser-parser/src/general/identifiers.rs b/sv-parser-parser/src/general/identifiers.rs index ef6d4c6..643c78e 100644 --- a/sv-parser-parser/src/general/identifiers.rs +++ b/sv-parser-parser/src/general/identifiers.rs @@ -595,7 +595,10 @@ pub(crate) fn ps_or_hierarchical_tf_identifier( pub(crate) fn ps_or_hierarchical_tf_identifier_package_scope( s: Span, ) -> IResult { - let (s, a) = opt(package_scope)(s)?; + // BNF-WA + // reported at https://accellera.mantishub.io/view.php?id=1642 + //let (s, a) = opt(package_scope)(s)?; + let (s, a) = opt(implicit_class_handle_or_class_scope_or_package_scope)(s)?; let (s, b) = tf_identifier(s)?; Ok(( s, diff --git a/sv-parser-parser/src/tests.rs b/sv-parser-parser/src/tests.rs index cc76888..4704c1b 100644 --- a/sv-parser-parser/src/tests.rs +++ b/sv-parser-parser/src/tests.rs @@ -3177,21 +3177,22 @@ mod spec { bit arr[obj.q]; // illegal: local parameter is not a constant expression"##, Ok((_, _)) ); - // TODO + // BNF-WA + // reported at https://accellera.mantishub.io/view.php?id=1642 // class static method is denied because ps_or_hierarchical_tf_identifier doesn't have class_scope. - //test!( - // many1(module_item), - // r##"class C #(int p = 1, type T = int); - // extern static function T f(); - // endclass + test!( + many1(module_item), + r##"class C #(int p = 1, type T = int); + extern static function T f(); + endclass - // function C::T C::f(); - // return p + C::p; - // endfunction + function C::T C::f(); + return p + C::p; + endfunction - // initial $display("%0d %0d", C#()::f(),C#(5)::f()); // output is "2 10""##, - // Ok((_, _)) - //); + initial $display("%0d %0d", C#()::f(),C#(5)::f()); // output is "2 10""##, + Ok((_, _)) + ); test!( many1(module_item), r##"interface class A; diff --git a/sv-parser-syntaxtree/src/general/identifiers.rs b/sv-parser-syntaxtree/src/general/identifiers.rs index b6d1c47..8ef315a 100644 --- a/sv-parser-syntaxtree/src/general/identifiers.rs +++ b/sv-parser-syntaxtree/src/general/identifiers.rs @@ -392,7 +392,10 @@ pub enum PsOrHierarchicalTfIdentifier { #[derive(Clone, Debug, PartialEq, Node)] pub struct PsOrHierarchicalTfIdentifierPackageScope { - pub nodes: (Option, TfIdentifier), + pub nodes: ( + Option, + TfIdentifier, + ), } #[derive(Clone, Debug, PartialEq, Node)]