Fix parser priority about specify

This commit is contained in:
dalance 2020-01-22 19:24:14 +09:00
parent d3d090c3d4
commit d429e77fc8
4 changed files with 16 additions and 5 deletions

View File

@ -2,6 +2,7 @@
## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.4.19...Unreleased) - ReleaseDate ## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.4.19...Unreleased) - ReleaseDate
* [Fixed] parser priority about specify
* [Fixed] escaped_ideitifier including `` ` `` * [Fixed] escaped_ideitifier including `` ` ``
* [Fixed] time_literal spacing * [Fixed] time_literal spacing

View File

@ -27,10 +27,10 @@ pub(crate) fn data_event(s: Span) -> IResult<Span, DataEvent> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn delayed_data(s: Span) -> IResult<Span, DelayedData> { pub(crate) fn delayed_data(s: Span) -> IResult<Span, DelayedData> {
alt(( alt((
delayed_data_with_mintypmax,
map(terminal_identifier, |x| { map(terminal_identifier, |x| {
DelayedData::TerminalIdentifier(Box::new(x)) DelayedData::TerminalIdentifier(Box::new(x))
}), }),
delayed_data_with_mintypmax,
))(s) ))(s)
} }
@ -49,10 +49,10 @@ pub(crate) fn delayed_data_with_mintypmax(s: Span) -> IResult<Span, DelayedData>
#[packrat_parser] #[packrat_parser]
pub(crate) fn delayed_reference(s: Span) -> IResult<Span, DelayedReference> { pub(crate) fn delayed_reference(s: Span) -> IResult<Span, DelayedReference> {
alt(( alt((
delayed_reference_with_mintypmax,
map(terminal_identifier, |x| { map(terminal_identifier, |x| {
DelayedReference::TerminalIdentifier(Box::new(x)) DelayedReference::TerminalIdentifier(Box::new(x))
}), }),
delayed_reference_with_mintypmax,
))(s) ))(s)
} }

View File

@ -30,12 +30,12 @@ pub(crate) fn timing_check_event_control(s: Span) -> IResult<Span, TimingCheckEv
map(keyword("negedge"), |x| { map(keyword("negedge"), |x| {
TimingCheckEventControl::Negedge(Box::new(x)) TimingCheckEventControl::Negedge(Box::new(x))
}), }),
map(keyword("edge"), |x| {
TimingCheckEventControl::Edge(Box::new(x))
}),
map(edge_control_specifier, |x| { map(edge_control_specifier, |x| {
TimingCheckEventControl::EdgeControlSpecifier(Box::new(x)) TimingCheckEventControl::EdgeControlSpecifier(Box::new(x))
}), }),
map(keyword("edge"), |x| {
TimingCheckEventControl::Edge(Box::new(x))
}),
))(s) ))(s)
} }

View File

@ -408,6 +408,16 @@ mod unit {
r##"module a; reg \`~!-_=+\|[]{};:'"",./<>? ; endmodule"##, r##"module a; reg \`~!-_=+\|[]{};:'"",./<>? ; endmodule"##,
Ok((_, _)) Ok((_, _))
); );
test!(
source_text,
r##"module test(); specify $setuphold(posedge A &&& B, BL_0 , 0, 0, C,,,D, BL_X[0]); endspecify endmodule"##,
Ok((_, _))
);
test!(
source_text,
r##"module test(); specify $setup(posedge CSB, edge[01,0x,x1,1x] CL, tps, a); endspecify endmodule"##,
Ok((_, _))
);
} }
} }