Fix bugs
This commit is contained in:
parent
283b310254
commit
acbf769db8
@ -307,6 +307,7 @@ pub(crate) fn property_spec(s: Span) -> IResult<Span, PropertySpec> {
|
||||
pub(crate) fn property_expr(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
alt((
|
||||
alt((
|
||||
property_expr_binary,
|
||||
property_expr_implication_overlapped,
|
||||
property_expr_implication_nonoverlapped,
|
||||
property_expr_followed_by_overlapped,
|
||||
@ -316,26 +317,18 @@ pub(crate) fn property_expr(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
}),
|
||||
property_expr_strong,
|
||||
property_expr_weak,
|
||||
property_expr_paren,
|
||||
property_expr_not,
|
||||
property_expr_or,
|
||||
property_expr_and,
|
||||
property_expr_paren,
|
||||
)),
|
||||
alt((
|
||||
property_expr_if,
|
||||
property_expr_case,
|
||||
property_expr_nexttime,
|
||||
property_expr_s_nexttime,
|
||||
)),
|
||||
alt((
|
||||
property_expr_always,
|
||||
property_expr_s_always,
|
||||
property_expr_eventually,
|
||||
property_expr_s_eventually,
|
||||
property_expr_until,
|
||||
property_expr_s_until,
|
||||
property_expr_until_with,
|
||||
property_expr_s_until_with,
|
||||
property_expr_implies,
|
||||
property_expr_iff,
|
||||
property_expr_accept_on,
|
||||
property_expr_reject_on,
|
||||
property_expr_sync_accept_on,
|
||||
@ -373,7 +366,7 @@ pub(crate) fn property_expr_weak(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_paren(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = paren(sequence_expr)(s)?;
|
||||
let (s, a) = paren(property_expr)(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::Paren(Box::new(PropertyExprParen { nodes: (a,) })),
|
||||
@ -394,26 +387,22 @@ pub(crate) fn property_expr_not(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
#[recursive_parser]
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_or(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
pub(crate) fn property_expr_binary(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = property_expr(s)?;
|
||||
let (s, b) = keyword("or")(s)?;
|
||||
let (s, b) = alt((
|
||||
keyword("or"),
|
||||
keyword("and"),
|
||||
keyword("until_with"),
|
||||
keyword("until"),
|
||||
keyword("s_until_with"),
|
||||
keyword("s_until"),
|
||||
keyword("implies"),
|
||||
keyword("iff"),
|
||||
))(s)?;
|
||||
let (s, c) = property_expr(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::Or(Box::new(PropertyExprOr { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[recursive_parser]
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_and(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = property_expr(s)?;
|
||||
let (s, b) = keyword("and")(s)?;
|
||||
let (s, c) = property_expr(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::And(Box::new(PropertyExprAnd { nodes: (a, b, c) })),
|
||||
PropertyExpr::Binary(Box::new(PropertyExprBinary { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
@ -580,84 +569,6 @@ pub(crate) fn property_expr_s_eventually(s: Span) -> IResult<Span, PropertyExpr>
|
||||
))
|
||||
}
|
||||
|
||||
#[recursive_parser]
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_until(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = property_expr(s)?;
|
||||
let (s, b) = keyword("until")(s)?;
|
||||
let (s, c) = property_expr(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::Until(Box::new(PropertyExprUntil { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[recursive_parser]
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_s_until(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = property_expr(s)?;
|
||||
let (s, b) = keyword("s_until")(s)?;
|
||||
let (s, c) = property_expr(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::SUntil(Box::new(PropertyExprSUntil { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[recursive_parser]
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_until_with(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = property_expr(s)?;
|
||||
let (s, b) = keyword("until_with")(s)?;
|
||||
let (s, c) = property_expr(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::UntilWith(Box::new(PropertyExprUntilWith { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[recursive_parser]
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_s_until_with(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = property_expr(s)?;
|
||||
let (s, b) = keyword("s_until_with")(s)?;
|
||||
let (s, c) = property_expr(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::SUntilWith(Box::new(PropertyExprSUntilWith { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[recursive_parser]
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_implies(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = property_expr(s)?;
|
||||
let (s, b) = keyword("implies")(s)?;
|
||||
let (s, c) = property_expr(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::Implies(Box::new(PropertyExprImplies { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[recursive_parser]
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_iff(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
let (s, a) = property_expr(s)?;
|
||||
let (s, b) = keyword("iff")(s)?;
|
||||
let (s, c) = property_expr(s)?;
|
||||
Ok((
|
||||
s,
|
||||
PropertyExpr::Iff(Box::new(PropertyExprIff { nodes: (a, b, c) })),
|
||||
))
|
||||
}
|
||||
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn property_expr_accept_on(s: Span) -> IResult<Span, PropertyExpr> {
|
||||
@ -852,15 +763,15 @@ pub(crate) fn sequence_expr(s: Span) -> IResult<Span, SequenceExpr> {
|
||||
alt((
|
||||
sequence_expr_cycle_delay_expr,
|
||||
sequence_expr_expr_cycle_delay_expr,
|
||||
sequence_expr_expression,
|
||||
sequence_expr_instance,
|
||||
sequence_expr_paren,
|
||||
sequence_expr_and,
|
||||
sequence_expr_intersect,
|
||||
sequence_expr_or,
|
||||
sequence_expr_first_match,
|
||||
sequence_expr_throughout,
|
||||
terminated(sequence_expr_expression, peek(not(symbol("(")))),
|
||||
sequence_expr_instance,
|
||||
sequence_expr_and,
|
||||
sequence_expr_or,
|
||||
sequence_expr_intersect,
|
||||
sequence_expr_within,
|
||||
sequence_expr_paren,
|
||||
sequence_expr_first_match,
|
||||
sequence_expr_clocking_event,
|
||||
))(s)
|
||||
}
|
||||
@ -1155,12 +1066,12 @@ pub(crate) fn sequence_list_of_arguments_named(s: Span) -> IResult<Span, Sequenc
|
||||
#[packrat_parser]
|
||||
pub(crate) fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
|
||||
alt((
|
||||
map(event_expression_sequence_actual_arg, |x| {
|
||||
SequenceActualArg::EventExpression(Box::new(x))
|
||||
}),
|
||||
map(sequence_expr, |x| {
|
||||
SequenceActualArg::SequenceExpr(Box::new(x))
|
||||
}),
|
||||
map(event_expression_sequence_actual_arg, |x| {
|
||||
SequenceActualArg::EventExpression(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,18 @@ pub(crate) fn hex_number(s: Span) -> IResult<Span, HexNumber> {
|
||||
#[packrat_parser]
|
||||
pub(crate) fn sign(s: Span) -> IResult<Span, Sign> {
|
||||
alt((
|
||||
map(symbol("+"), |x| Sign::Plus(Box::new(x))),
|
||||
map(symbol("-"), |x| Sign::Minus(Box::new(x))),
|
||||
map(
|
||||
map(tag("+"), |x: Span| Symbol {
|
||||
nodes: (into_locate(x), vec![]),
|
||||
}),
|
||||
|x| Sign::Plus(Box::new(x)),
|
||||
),
|
||||
map(
|
||||
map(tag("-"), |x: Span| Symbol {
|
||||
nodes: (into_locate(x), vec![]),
|
||||
}),
|
||||
|x| Sign::Minus(Box::new(x)),
|
||||
),
|
||||
))(s)
|
||||
}
|
||||
|
||||
@ -146,8 +156,13 @@ pub(crate) fn real_number(s: Span) -> IResult<Span, RealNumber> {
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn real_number_floating(s: Span) -> IResult<Span, RealNumber> {
|
||||
let (s, a) = unsigned_number(s)?;
|
||||
let (s, b) = opt(pair(symbol("."), unsigned_number))(s)?;
|
||||
let (s, a) = unsigned_number_without_ws(s)?;
|
||||
let (s, b) = opt(pair(
|
||||
map(tag("."), |x: Span| Symbol {
|
||||
nodes: (into_locate(x), vec![]),
|
||||
}),
|
||||
unsigned_number_without_ws,
|
||||
))(s)?;
|
||||
let (s, c) = exp(s)?;
|
||||
let (s, d) = opt(sign)(s)?;
|
||||
let (s, e) = unsigned_number(s)?;
|
||||
@ -162,7 +177,7 @@ pub(crate) fn real_number_floating(s: Span) -> IResult<Span, RealNumber> {
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn fixed_point_number(s: Span) -> IResult<Span, FixedPointNumber> {
|
||||
let (s, a) = unsigned_number(s)?;
|
||||
let (s, a) = unsigned_number_without_ws(s)?;
|
||||
let (s, b) = map(tag("."), |x: Span| Symbol {
|
||||
nodes: (into_locate(x), vec![]),
|
||||
})(s)?;
|
||||
@ -173,10 +188,24 @@ pub(crate) fn fixed_point_number(s: Span) -> IResult<Span, FixedPointNumber> {
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn exp(s: Span) -> IResult<Span, Exp> {
|
||||
let (s, a) = alt((symbol("e"), symbol("E")))(s)?;
|
||||
let (s, a) = alt((
|
||||
map(tag("e"), |x: Span| Symbol {
|
||||
nodes: (into_locate(x), vec![]),
|
||||
}),
|
||||
map(tag("E"), |x: Span| Symbol {
|
||||
nodes: (into_locate(x), vec![]),
|
||||
}),
|
||||
))(s)?;
|
||||
Ok((s, Exp { nodes: (a,) }))
|
||||
}
|
||||
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn unsigned_number_without_ws(s: Span) -> IResult<Span, UnsignedNumber> {
|
||||
let (s, a) = unsigned_number_impl(s)?;
|
||||
Ok((s, UnsignedNumber { nodes: (a, vec![]) }))
|
||||
}
|
||||
|
||||
#[tracable_parser]
|
||||
#[packrat_parser]
|
||||
pub(crate) fn unsigned_number(s: Span) -> IResult<Span, UnsignedNumber> {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -163,8 +163,7 @@ pub enum PropertyExpr {
|
||||
Weak(Box<PropertyExprWeak>),
|
||||
Paren(Box<PropertyExprParen>),
|
||||
Not(Box<PropertyExprNot>),
|
||||
Or(Box<PropertyExprOr>),
|
||||
And(Box<PropertyExprAnd>),
|
||||
Binary(Box<PropertyExprBinary>),
|
||||
ImplicationOverlapped(Box<PropertyExprImplicationOverlapped>),
|
||||
ImplicationNonoverlapped(Box<PropertyExprImplicationNonoverlapped>),
|
||||
If(Box<PropertyExprIf>),
|
||||
@ -177,12 +176,6 @@ pub enum PropertyExpr {
|
||||
SAlways(Box<PropertyExprSAlways>),
|
||||
Eventually(Box<PropertyExprEventually>),
|
||||
SEventually(Box<PropertyExprSEventually>),
|
||||
Until(Box<PropertyExprUntil>),
|
||||
SUntil(Box<PropertyExprSUntil>),
|
||||
UntilWith(Box<PropertyExprUntilWith>),
|
||||
SUntilWith(Box<PropertyExprSUntilWith>),
|
||||
Implies(Box<PropertyExprImplies>),
|
||||
Iff(Box<PropertyExprIff>),
|
||||
AcceptOn(Box<PropertyExprAcceptOn>),
|
||||
RejectOn(Box<PropertyExprRejectOn>),
|
||||
SyncAcceptOn(Box<PropertyExprSyncAcceptOn>),
|
||||
@ -203,7 +196,7 @@ pub struct PropertyExprWeak {
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprParen {
|
||||
pub nodes: (Paren<SequenceExpr>,),
|
||||
pub nodes: (Paren<PropertyExpr>,),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
@ -212,12 +205,7 @@ pub struct PropertyExprNot {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprOr {
|
||||
pub nodes: (PropertyExpr, Keyword, PropertyExpr),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprAnd {
|
||||
pub struct PropertyExprBinary {
|
||||
pub nodes: (PropertyExpr, Keyword, PropertyExpr),
|
||||
}
|
||||
|
||||
@ -304,36 +292,6 @@ pub struct PropertyExprSEventually {
|
||||
),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprUntil {
|
||||
pub nodes: (PropertyExpr, Keyword, PropertyExpr),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprSUntil {
|
||||
pub nodes: (PropertyExpr, Keyword, PropertyExpr),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprUntilWith {
|
||||
pub nodes: (PropertyExpr, Keyword, PropertyExpr),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprSUntilWith {
|
||||
pub nodes: (PropertyExpr, Keyword, PropertyExpr),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprImplies {
|
||||
pub nodes: (PropertyExpr, Keyword, PropertyExpr),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprIff {
|
||||
pub nodes: (PropertyExpr, Keyword, PropertyExpr),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Node)]
|
||||
pub struct PropertyExprAcceptOn {
|
||||
pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
|
||||
|
Loading…
x
Reference in New Issue
Block a user