Fix #8
This commit is contained in:
parent
23a54652d0
commit
2c63dcaeba
@ -2,6 +2,8 @@
|
||||
|
||||
## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.6.4...Unreleased) - ReleaseDate
|
||||
|
||||
* [Fixed] casting parse error [#8](https://github.com/dalance/sv-parser/issues/8)
|
||||
|
||||
## [v0.6.4](https://github.com/dalance/sv-parser/compare/v0.6.3...v0.6.4) - 2020-03-12
|
||||
|
||||
* [Changed] error message of Error::Io
|
||||
|
@ -8,7 +8,9 @@ use crate::*;
|
||||
#[packrat_parser]
|
||||
pub(crate) fn casting_type(s: Span) -> IResult<Span, CastingType> {
|
||||
alt((
|
||||
map(simple_type, |x| CastingType::SimpleType(Box::new(x))),
|
||||
map(terminated(simple_type, peek(tag("'"))), |x| {
|
||||
CastingType::SimpleType(Box::new(x))
|
||||
}),
|
||||
map(signing, |x| CastingType::Signing(Box::new(x))),
|
||||
map(keyword("string"), |x| CastingType::String(Box::new(x))),
|
||||
map(keyword("const"), |x| CastingType::Const(Box::new(x))),
|
||||
@ -24,7 +26,9 @@ pub(crate) fn casting_type(s: Span) -> IResult<Span, CastingType> {
|
||||
#[packrat_parser]
|
||||
pub(crate) fn constant_casting_type(s: Span) -> IResult<Span, CastingType> {
|
||||
alt((
|
||||
map(simple_type, |x| CastingType::SimpleType(Box::new(x))),
|
||||
map(terminated(simple_type, peek(tag("'"))), |x| {
|
||||
CastingType::SimpleType(Box::new(x))
|
||||
}),
|
||||
map(signing, |x| CastingType::Signing(Box::new(x))),
|
||||
map(keyword("string"), |x| CastingType::String(Box::new(x))),
|
||||
map(keyword("const"), |x| CastingType::Const(Box::new(x))),
|
||||
|
@ -423,6 +423,11 @@ mod unit {
|
||||
r##"module a; assign a = a[$clog2(a)'(a)]; endmodule"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
test!(
|
||||
source_text,
|
||||
r##"module a; always begin a = b.c'(0); end endmodule"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15881,6 +15886,10 @@ mod spec {
|
||||
|
||||
#[test]
|
||||
fn debug() {
|
||||
test!(expression, r##"a[$clog2(a)'(a)]"##, Ok((_, _)));
|
||||
test!(
|
||||
source_text,
|
||||
r##"module a; always begin a = b.c'(0); end endmodule"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
nom_tracable::cumulative_histogram();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user