This commit is contained in:
dalance 2019-08-15 18:13:34 +09:00
parent acbf769db8
commit fecbce4852
18 changed files with 2057 additions and 2169 deletions

View File

@ -81,15 +81,15 @@ A parser library for System Verilog.
| Clause | Exist | Pass | Clause | Exist | Pass | Clause | Exist | Pass | Clause | Exist | Pass | | Clause | Exist | Pass | Clause | Exist | Pass | Clause | Exist | Pass | Clause | Exist | Pass |
| ------ | ----- | ---- | ------ | ----- | ---- | ------ | ----- | ---- | ------ | ----- | ---- | | ------ | ----- | ---- | ------ | ----- | ---- | ------ | ----- | ---- | ------ | ----- | ---- |
| 3 | x | x | 13 | x | x | 23 | x | | 33 | x | | | 3 | x | x | 13 | x | x | 23 | x | x | 33 | x | x |
| 4 | x | x | 14 | x | x | 24 | x | x | 34 | x | | | 4 | x | x | 14 | x | x | 24 | x | x | 34 | x | |
| 5 | x | x | 15 | x | x | 25 | x | | 35 | x | | | 5 | x | x | 15 | x | x | 25 | x | x | 35 | x | x |
| 6 | x | x | 16 | x | | 26 | x | | 36 | x | x | | 6 | x | x | 16 | x | x | 26 | x | x | 36 | x | x |
| 7 | x | x | 17 | x | | 27 | x | | | | | | 7 | x | x | 17 | x | x | 27 | x | x | | | |
| 8 | x | x | 18 | x | | 28 | x | x | | | | | 8 | x | x | 18 | x | x | 28 | x | x | | | |
| 9 | x | x | 19 | x | | 29 | x | | | | | | 9 | x | x | 19 | x | | 29 | x | x | | | |
| 10 | x | x | 20 | x | | 30 | x | | | | | | 10 | x | x | 20 | x | | 30 | x | x | | | |
| 11 | x | x | 21 | x | | 31 | x | | | | | | 11 | x | x | 21 | x | x | 31 | x | x | | | |
| 12 | x | x | 22 | | | 32 | x | x | | | | | 12 | x | x | 22 | | | 32 | x | x | | | |
## Missing entry of specification ## Missing entry of specification

View File

@ -21,7 +21,7 @@ pub(crate) fn randsequence_statement(s: Span) -> IResult<Span, RandsequenceState
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn production(s: Span) -> IResult<Span, Production> { pub(crate) fn production(s: Span) -> IResult<Span, Production> {
let (s, a) = opt(data_type_or_void)(s)?; let (s, a) = opt(terminated(data_type_or_void, peek(production_identifier)))(s)?;
let (s, b) = production_identifier(s)?; let (s, b) = production_identifier(s)?;
let (s, c) = opt(paren(tf_port_list))(s)?; let (s, c) = opt(paren(tf_port_list))(s)?;
let (s, d) = symbol(":")(s)?; let (s, d) = symbol(":")(s)?;

View File

@ -307,11 +307,8 @@ pub(crate) fn property_spec(s: Span) -> IResult<Span, PropertySpec> {
pub(crate) fn property_expr(s: Span) -> IResult<Span, PropertyExpr> { pub(crate) fn property_expr(s: Span) -> IResult<Span, PropertyExpr> {
alt(( alt((
alt(( alt((
property_expr_binary, property_expr_binary_property,
property_expr_implication_overlapped, property_expr_binary_sequence,
property_expr_implication_nonoverlapped,
property_expr_followed_by_overlapped,
property_expr_followed_by_nonoverlapped,
map(terminated(sequence_expr, peek(not(symbol("(")))), |x| { map(terminated(sequence_expr, peek(not(symbol("(")))), |x| {
PropertyExpr::SequenceExpr(Box::new(x)) PropertyExpr::SequenceExpr(Box::new(x))
}), }),
@ -387,7 +384,7 @@ pub(crate) fn property_expr_not(s: Span) -> IResult<Span, PropertyExpr> {
#[recursive_parser] #[recursive_parser]
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn property_expr_binary(s: Span) -> IResult<Span, PropertyExpr> { pub(crate) fn property_expr_binary_property(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = property_expr(s)?; let (s, a) = property_expr(s)?;
let (s, b) = alt(( let (s, b) = alt((
keyword("or"), keyword("or"),
@ -402,37 +399,20 @@ pub(crate) fn property_expr_binary(s: Span) -> IResult<Span, PropertyExpr> {
let (s, c) = property_expr(s)?; let (s, c) = property_expr(s)?;
Ok(( Ok((
s, s,
PropertyExpr::Binary(Box::new(PropertyExprBinary { nodes: (a, b, c) })), PropertyExpr::BinaryProperty(Box::new(PropertyExprBinaryProperty { nodes: (a, b, c) })),
)) ))
} }
#[recursive_parser] #[recursive_parser]
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn property_expr_implication_overlapped(s: Span) -> IResult<Span, PropertyExpr> { pub(crate) fn property_expr_binary_sequence(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("|->")(s)?; let (s, b) = alt((symbol("|->"), symbol("|=>"), symbol("#-#"), symbol("#=#")))(s)?;
let (s, c) = property_expr(s)?; let (s, c) = property_expr(s)?;
Ok(( Ok((
s, s,
PropertyExpr::ImplicationOverlapped(Box::new(PropertyExprImplicationOverlapped { PropertyExpr::BinarySequence(Box::new(PropertyExprBinarySequence { nodes: (a, b, c) })),
nodes: (a, b, c),
})),
))
}
#[recursive_parser]
#[tracable_parser]
#[packrat_parser]
pub(crate) fn property_expr_implication_nonoverlapped(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("|=>")(s)?;
let (s, c) = property_expr(s)?;
Ok((
s,
PropertyExpr::ImplicationNonoverlapped(Box::new(PropertyExprImplicationNonoverlapped {
nodes: (a, b, c),
})),
)) ))
} }
@ -466,37 +446,6 @@ pub(crate) fn property_expr_case(s: Span) -> IResult<Span, PropertyExpr> {
})), })),
)) ))
} }
#[recursive_parser]
#[tracable_parser]
#[packrat_parser]
pub(crate) fn property_expr_followed_by_overlapped(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("#-#")(s)?;
let (s, c) = property_expr(s)?;
Ok((
s,
PropertyExpr::FollowedByOverlapped(Box::new(PropertyExprFollowedByOverlapped {
nodes: (a, b, c),
})),
))
}
#[recursive_parser]
#[tracable_parser]
#[packrat_parser]
pub(crate) fn property_expr_followed_by_nonoverlapped(s: Span) -> IResult<Span, PropertyExpr> {
let (s, a) = sequence_expr(s)?;
let (s, b) = symbol("#=#")(s)?;
let (s, c) = property_expr(s)?;
Ok((
s,
PropertyExpr::FollowedByNonoverlapped(Box::new(PropertyExprFollowedByNonoverlapped {
nodes: (a, b, c),
})),
))
}
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn property_expr_nexttime(s: Span) -> IResult<Span, PropertyExpr> { pub(crate) fn property_expr_nexttime(s: Span) -> IResult<Span, PropertyExpr> {
@ -766,10 +715,7 @@ pub(crate) fn sequence_expr(s: Span) -> IResult<Span, SequenceExpr> {
sequence_expr_throughout, sequence_expr_throughout,
terminated(sequence_expr_expression, peek(not(symbol("(")))), terminated(sequence_expr_expression, peek(not(symbol("(")))),
sequence_expr_instance, sequence_expr_instance,
sequence_expr_and, sequence_expr_binary,
sequence_expr_or,
sequence_expr_intersect,
sequence_expr_within,
sequence_expr_paren, sequence_expr_paren,
sequence_expr_first_match, sequence_expr_first_match,
sequence_expr_clocking_event, sequence_expr_clocking_event,
@ -844,39 +790,18 @@ pub(crate) fn sequence_expr_paren(s: Span) -> IResult<Span, SequenceExpr> {
#[recursive_parser] #[recursive_parser]
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn sequence_expr_and(s: Span) -> IResult<Span, SequenceExpr> { pub(crate) fn sequence_expr_binary(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?; let (s, a) = sequence_expr(s)?;
let (s, b) = keyword("and")(s)?; let (s, b) = alt((
keyword("and"),
keyword("intersect"),
keyword("or"),
keyword("within"),
))(s)?;
let (s, c) = sequence_expr(s)?; let (s, c) = sequence_expr(s)?;
Ok(( Ok((
s, s,
SequenceExpr::And(Box::new(SequenceExprAnd { nodes: (a, b, c) })), SequenceExpr::Binary(Box::new(SequenceExprBinary { nodes: (a, b, c) })),
))
}
#[recursive_parser]
#[tracable_parser]
#[packrat_parser]
pub(crate) fn sequence_expr_intersect(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?;
let (s, b) = keyword("intersect")(s)?;
let (s, c) = sequence_expr(s)?;
Ok((
s,
SequenceExpr::Intersect(Box::new(SequenceExprIntersect { nodes: (a, b, c) })),
))
}
#[recursive_parser]
#[tracable_parser]
#[packrat_parser]
pub(crate) fn sequence_expr_or(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?;
let (s, b) = keyword("or")(s)?;
let (s, c) = sequence_expr(s)?;
Ok((
s,
SequenceExpr::Or(Box::new(SequenceExprOr { nodes: (a, b, c) })),
)) ))
} }
@ -907,19 +832,6 @@ pub(crate) fn sequence_expr_throughout(s: Span) -> IResult<Span, SequenceExpr> {
)) ))
} }
#[recursive_parser]
#[tracable_parser]
#[packrat_parser]
pub(crate) fn sequence_expr_within(s: Span) -> IResult<Span, SequenceExpr> {
let (s, a) = sequence_expr(s)?;
let (s, b) = keyword("within")(s)?;
let (s, c) = sequence_expr(s)?;
Ok((
s,
SequenceExpr::Within(Box::new(SequenceExprWithin { nodes: (a, b, c) })),
))
}
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn sequence_expr_clocking_event(s: Span) -> IResult<Span, SequenceExpr> { pub(crate) fn sequence_expr_clocking_event(s: Span) -> IResult<Span, SequenceExpr> {

View File

@ -291,8 +291,8 @@ pub(crate) fn bins_or_options(s: Span) -> IResult<Span, BinsOrOptions> {
bins_or_options_cover_point, bins_or_options_cover_point,
bins_or_options_set_covergroup, bins_or_options_set_covergroup,
bins_or_options_trans_list, bins_or_options_trans_list,
bins_or_options_default,
bins_or_options_default_sequence, bins_or_options_default_sequence,
bins_or_options_default,
))(s) ))(s)
} }
@ -445,10 +445,10 @@ pub(crate) fn trans_set(s: Span) -> IResult<Span, TransSet> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn trans_range_list(s: Span) -> IResult<Span, TransRangeList> { pub(crate) fn trans_range_list(s: Span) -> IResult<Span, TransRangeList> {
alt(( alt((
map(trans_item, |x| TransRangeList::TransItem(Box::new(x))),
trans_range_list_asterisk, trans_range_list_asterisk,
trans_range_list_arrow, trans_range_list_arrow,
trans_range_list_equal, trans_range_list_equal,
map(trans_item, |x| TransRangeList::TransItem(Box::new(x))),
))(s) ))(s)
} }
@ -499,10 +499,10 @@ pub(crate) fn trans_item(s: Span) -> IResult<Span, TransItem> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn repeat_range(s: Span) -> IResult<Span, RepeatRange> { pub(crate) fn repeat_range(s: Span) -> IResult<Span, RepeatRange> {
alt(( alt((
repeat_range_binary,
map(covergroup_expression, |x| { map(covergroup_expression, |x| {
RepeatRange::CovergroupExpression(Box::new(x)) RepeatRange::CovergroupExpression(Box::new(x))
}), }),
repeat_range_binary,
))(s) ))(s)
} }
@ -539,8 +539,9 @@ pub(crate) fn cover_cross(s: Span) -> IResult<Span, CoverCross> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn list_of_cross_items(s: Span) -> IResult<Span, ListOfCrossItems> { pub(crate) fn list_of_cross_items(s: Span) -> IResult<Span, ListOfCrossItems> {
let (s, a) = cross_item(s)?; let (s, a) = cross_item(s)?;
let (s, b) = list(symbol(","), cross_item)(s)?; let (s, b) = symbol(",")(s)?;
Ok((s, ListOfCrossItems { nodes: (a, b) })) let (s, c) = list(symbol(","), cross_item)(s)?;
Ok((s, ListOfCrossItems { nodes: (a, b, c) }))
} }
#[tracable_parser] #[tracable_parser]
@ -568,7 +569,7 @@ pub(crate) fn cross_body(s: Span) -> IResult<Span, CrossBody> {
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn cross_body_non_empty(s: Span) -> IResult<Span, CrossBody> { pub(crate) fn cross_body_non_empty(s: Span) -> IResult<Span, CrossBody> {
let (s, a) = brace(many0(pair(cross_body_item, symbol(";"))))(s)?; let (s, a) = brace(many0(cross_body_item))(s)?;
Ok(( Ok((
s, s,
CrossBody::NonEmpty(Box::new(CrossBodyNonEmpty { nodes: (a,) })), CrossBody::NonEmpty(Box::new(CrossBodyNonEmpty { nodes: (a,) })),
@ -639,18 +640,18 @@ pub(crate) fn bins_selection(s: Span) -> IResult<Span, BinsSelection> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn select_expression(s: Span) -> IResult<Span, SelectExpression> { pub(crate) fn select_expression(s: Span) -> IResult<Span, SelectExpression> {
alt(( alt((
select_expression_and,
select_expression_or,
select_expression_with,
map(select_condition, |x| { map(select_condition, |x| {
SelectExpression::SelectCondition(Box::new(x)) SelectExpression::SelectCondition(Box::new(x))
}), }),
select_expression_not, select_expression_not,
select_expression_and,
select_expression_or,
select_expression_paren, select_expression_paren,
select_expression_with, select_expression_cross_set,
map(cross_identifier, |x| { map(cross_identifier, |x| {
SelectExpression::CrossIdentifier(Box::new(x)) SelectExpression::CrossIdentifier(Box::new(x))
}), }),
select_expression_cross_set,
))(s) ))(s)
} }
@ -742,10 +743,10 @@ pub(crate) fn select_condition(s: Span) -> IResult<Span, SelectCondition> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn bins_expression(s: Span) -> IResult<Span, BinsExpression> { pub(crate) fn bins_expression(s: Span) -> IResult<Span, BinsExpression> {
alt(( alt((
bins_expression_cover_point,
map(variable_identifier, |x| { map(variable_identifier, |x| {
BinsExpression::VariableIdentifier(Box::new(x)) BinsExpression::VariableIdentifier(Box::new(x))
}), }),
bins_expression_cover_point,
))(s) ))(s)
} }

View File

@ -203,8 +203,8 @@ pub(crate) fn dpi_import_export_export_task(s: Span) -> IResult<Span, DpiImportE
#[packrat_parser] #[packrat_parser]
pub(crate) fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> { pub(crate) fn dpi_spec_string(s: Span) -> IResult<Span, DpiSpecString> {
alt(( alt((
map(keyword("DPI-C"), |x| DpiSpecString::DpiC(Box::new(x))), map(keyword("\"DPI-C\""), |x| DpiSpecString::DpiC(Box::new(x))),
map(keyword("DPI"), |x| DpiSpecString::Dpi(Box::new(x))), map(keyword("\"DPI\""), |x| DpiSpecString::Dpi(Box::new(x))),
))(s) ))(s)
} }

View File

@ -363,14 +363,14 @@ pub(crate) fn module_path_conditional_expression(
#[packrat_parser] #[packrat_parser]
pub(crate) fn module_path_expression(s: Span) -> IResult<Span, ModulePathExpression> { pub(crate) fn module_path_expression(s: Span) -> IResult<Span, ModulePathExpression> {
alt(( alt((
map(module_path_primary, |x| {
ModulePathExpression::ModulePathPrimary(Box::new(x))
}),
module_path_expression_unary,
module_path_expression_binary, module_path_expression_binary,
map(module_path_conditional_expression, |x| { map(module_path_conditional_expression, |x| {
ModulePathExpression::ModulePathConditionalExpression(Box::new(x)) ModulePathExpression::ModulePathConditionalExpression(Box::new(x))
}), }),
map(module_path_primary, |x| {
ModulePathExpression::ModulePathPrimary(Box::new(x))
}),
module_path_expression_unary,
))(s) ))(s)
} }

View File

@ -324,11 +324,10 @@ pub(crate) fn bind_directive_scope(s: Span) -> IResult<Span, BindDirective> {
let (s, b) = bind_target_scope(s)?; let (s, b) = bind_target_scope(s)?;
let (s, c) = opt(pair(symbol(":"), bind_target_instance_list))(s)?; let (s, c) = opt(pair(symbol(":"), bind_target_instance_list))(s)?;
let (s, d) = bind_instantiation(s)?; let (s, d) = bind_instantiation(s)?;
let (s, e) = symbol(";")(s)?;
Ok(( Ok((
s, s,
BindDirective::Scope(Box::new(BindDirectiveScope { BindDirective::Scope(Box::new(BindDirectiveScope {
nodes: (a, b, c, d, e), nodes: (a, b, c, d),
})), })),
)) ))
} }
@ -339,12 +338,9 @@ pub(crate) fn bind_directive_instance(s: Span) -> IResult<Span, BindDirective> {
let (s, a) = keyword("bind")(s)?; let (s, a) = keyword("bind")(s)?;
let (s, b) = bind_target_instance(s)?; let (s, b) = bind_target_instance(s)?;
let (s, c) = bind_instantiation(s)?; let (s, c) = bind_instantiation(s)?;
let (s, d) = symbol(";")(s)?;
Ok(( Ok((
s, s,
BindDirective::Instance(Box::new(BindDirectiveInstance { BindDirective::Instance(Box::new(BindDirectiveInstance { nodes: (a, b, c) })),
nodes: (a, b, c, d),
})),
)) ))
} }

View File

@ -178,7 +178,7 @@ pub(crate) fn port_declaration_interface(s: Span) -> IResult<Span, PortDeclarati
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn port(s: Span) -> IResult<Span, Port> { pub(crate) fn port(s: Span) -> IResult<Span, Port> {
alt((port_non_named, port_named))(s) alt((port_named, port_non_named))(s)
} }
#[recursive_parser] #[recursive_parser]
@ -205,13 +205,13 @@ pub(crate) fn port_expression(s: Span) -> IResult<Span, PortExpression> {
map(port_reference, |x| { map(port_reference, |x| {
PortExpression::PortReference(Box::new(x)) PortExpression::PortReference(Box::new(x))
}), }),
port_expressio_named, port_expression_named,
))(s) ))(s)
} }
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn port_expressio_named(s: Span) -> IResult<Span, PortExpression> { pub(crate) fn port_expression_named(s: Span) -> IResult<Span, PortExpression> {
let (s, a) = brace(list(symbol(","), port_reference))(s)?; let (s, a) = brace(list(symbol(","), port_reference))(s)?;
Ok(( Ok((
s, s,

View File

@ -48,7 +48,7 @@ pub(crate) fn pulsestyle_declaration(s: Span) -> IResult<Span, PulsestyleDeclara
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn showcancelled_declaration(s: Span) -> IResult<Span, ShowcancelledDeclaration> { pub(crate) fn showcancelled_declaration(s: Span) -> IResult<Span, ShowcancelledDeclaration> {
let (s, a) = alt((keyword("showcalcelled"), keyword("noshowcancelled")))(s)?; let (s, a) = alt((keyword("showcancelled"), keyword("noshowcancelled")))(s)?;
let (s, b) = list_of_path_outputs(s)?; let (s, b) = list_of_path_outputs(s)?;
let (s, c) = symbol(";")(s)?; let (s, c) = symbol(";")(s)?;
Ok((s, ShowcancelledDeclaration { nodes: (a, b, c) })) Ok((s, ShowcancelledDeclaration { nodes: (a, b, c) }))

View File

@ -26,13 +26,13 @@ pub(crate) fn specify_output_terminal_descriptor(
#[packrat_parser] #[packrat_parser]
pub(crate) fn input_identifier(s: Span) -> IResult<Span, InputIdentifier> { pub(crate) fn input_identifier(s: Span) -> IResult<Span, InputIdentifier> {
alt(( alt((
input_identifier_interface,
map(input_port_identifier, |x| { map(input_port_identifier, |x| {
InputIdentifier::InputPortIdentifier(Box::new(x)) InputIdentifier::InputPortIdentifier(Box::new(x))
}), }),
map(inout_port_identifier, |x| { map(inout_port_identifier, |x| {
InputIdentifier::InoutPortIdentifier(Box::new(x)) InputIdentifier::InoutPortIdentifier(Box::new(x))
}), }),
input_identifier_interface,
))(s) ))(s)
} }
@ -52,13 +52,13 @@ pub(crate) fn input_identifier_interface(s: Span) -> IResult<Span, InputIdentifi
#[packrat_parser] #[packrat_parser]
pub(crate) fn output_identifier(s: Span) -> IResult<Span, OutputIdentifier> { pub(crate) fn output_identifier(s: Span) -> IResult<Span, OutputIdentifier> {
alt(( alt((
output_identifier_interface,
map(output_port_identifier, |x| { map(output_port_identifier, |x| {
OutputIdentifier::OutputPortIdentifier(Box::new(x)) OutputIdentifier::OutputPortIdentifier(Box::new(x))
}), }),
map(inout_port_identifier, |x| { map(inout_port_identifier, |x| {
OutputIdentifier::InoutPortIdentifier(Box::new(x)) OutputIdentifier::InoutPortIdentifier(Box::new(x))
}), }),
output_identifier_interface,
))(s) ))(s)
} }

View File

@ -39,8 +39,8 @@ pub(crate) fn system_timing_check(s: Span) -> IResult<Span, SystemTimingCheck> {
map(width_timing_check, |x| { map(width_timing_check, |x| {
SystemTimingCheck::WidthTimingCheck(Box::new(x)) SystemTimingCheck::WidthTimingCheck(Box::new(x))
}), }),
map(nocharge_timing_check, |x| { map(nochange_timing_check, |x| {
SystemTimingCheck::NochargeTimingCheck(Box::new(x)) SystemTimingCheck::NochangeTimingCheck(Box::new(x))
}), }),
))(s) ))(s)
} }
@ -64,7 +64,7 @@ pub(crate) fn setup_timing_check(s: Span) -> IResult<Span, SetupTimingCheck> {
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn hold_timing_check(s: Span) -> IResult<Span, HoldTimingCheck> { pub(crate) fn hold_timing_check(s: Span) -> IResult<Span, HoldTimingCheck> {
let (s, a) = keyword("$setup")(s)?; let (s, a) = keyword("$hold")(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
referecne_event, referecne_event,
symbol(","), symbol(","),
@ -275,8 +275,8 @@ pub(crate) fn width_timing_check(s: Span) -> IResult<Span, WidthTimingCheck> {
#[tracable_parser] #[tracable_parser]
#[packrat_parser] #[packrat_parser]
pub(crate) fn nocharge_timing_check(s: Span) -> IResult<Span, NochargeTimingCheck> { pub(crate) fn nochange_timing_check(s: Span) -> IResult<Span, NochangeTimingCheck> {
let (s, a) = keyword("$nocharge")(s)?; let (s, a) = keyword("$nochange")(s)?;
let (s, b) = paren(tuple(( let (s, b) = paren(tuple((
referecne_event, referecne_event,
symbol(","), symbol(","),
@ -288,5 +288,5 @@ pub(crate) fn nocharge_timing_check(s: Span) -> IResult<Span, NochargeTimingChec
opt(pair(symbol(","), opt(notifier))), opt(pair(symbol(","), opt(notifier))),
)))(s)?; )))(s)?;
let (s, c) = symbol(";")(s)?; let (s, c) = symbol(";")(s)?;
Ok((s, NochargeTimingCheck { nodes: (a, b, c) })) Ok((s, NochangeTimingCheck { nodes: (a, b, c) }))
} }

File diff suppressed because it is too large Load Diff

View File

@ -113,12 +113,12 @@ pub(crate) fn sequential_entry(s: Span) -> IResult<Span, SequentialEntry> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn seq_input_list(s: Span) -> IResult<Span, SeqInputList> { pub(crate) fn seq_input_list(s: Span) -> IResult<Span, SeqInputList> {
alt(( alt((
map(level_input_list, |x| {
SeqInputList::LevelInputList(Box::new(x))
}),
map(edge_input_list, |x| { map(edge_input_list, |x| {
SeqInputList::EdgeInputList(Box::new(x)) SeqInputList::EdgeInputList(Box::new(x))
}), }),
map(level_input_list, |x| {
SeqInputList::LevelInputList(Box::new(x))
}),
))(s) ))(s)
} }
@ -178,10 +178,10 @@ pub(crate) fn next_state(s: Span) -> IResult<Span, NextState> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn output_symbol(s: Span) -> IResult<Span, OutputSymbol> { pub(crate) fn output_symbol(s: Span) -> IResult<Span, OutputSymbol> {
alt(( alt((
map(keyword("0"), |x| OutputSymbol { nodes: (x,) }), map(symbol("0"), |x| OutputSymbol { nodes: (x,) }),
map(keyword("1"), |x| OutputSymbol { nodes: (x,) }), map(symbol("1"), |x| OutputSymbol { nodes: (x,) }),
map(keyword("x"), |x| OutputSymbol { nodes: (x,) }), map(symbol("x"), |x| OutputSymbol { nodes: (x,) }),
map(keyword("X"), |x| OutputSymbol { nodes: (x,) }), map(symbol("X"), |x| OutputSymbol { nodes: (x,) }),
))(s) ))(s)
} }
@ -189,13 +189,13 @@ pub(crate) fn output_symbol(s: Span) -> IResult<Span, OutputSymbol> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn level_symbol(s: Span) -> IResult<Span, LevelSymbol> { pub(crate) fn level_symbol(s: Span) -> IResult<Span, LevelSymbol> {
alt(( alt((
map(keyword("0"), |x| LevelSymbol { nodes: (x,) }), map(symbol("0"), |x| LevelSymbol { nodes: (x,) }),
map(keyword("1"), |x| LevelSymbol { nodes: (x,) }), map(symbol("1"), |x| LevelSymbol { nodes: (x,) }),
map(keyword("x"), |x| LevelSymbol { nodes: (x,) }), map(symbol("x"), |x| LevelSymbol { nodes: (x,) }),
map(keyword("X"), |x| LevelSymbol { nodes: (x,) }), map(symbol("X"), |x| LevelSymbol { nodes: (x,) }),
map(keyword("?"), |x| LevelSymbol { nodes: (x,) }), map(symbol("?"), |x| LevelSymbol { nodes: (x,) }),
map(keyword("b"), |x| LevelSymbol { nodes: (x,) }), map(symbol("b"), |x| LevelSymbol { nodes: (x,) }),
map(keyword("B"), |x| LevelSymbol { nodes: (x,) }), map(symbol("B"), |x| LevelSymbol { nodes: (x,) }),
))(s) ))(s)
} }
@ -203,14 +203,14 @@ pub(crate) fn level_symbol(s: Span) -> IResult<Span, LevelSymbol> {
#[packrat_parser] #[packrat_parser]
pub(crate) fn edge_symbol(s: Span) -> IResult<Span, EdgeSymbol> { pub(crate) fn edge_symbol(s: Span) -> IResult<Span, EdgeSymbol> {
alt(( alt((
map(keyword("r"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("r"), |x| EdgeSymbol { nodes: (x,) }),
map(keyword("R"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("R"), |x| EdgeSymbol { nodes: (x,) }),
map(keyword("f"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("f"), |x| EdgeSymbol { nodes: (x,) }),
map(keyword("F"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("F"), |x| EdgeSymbol { nodes: (x,) }),
map(keyword("p"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("p"), |x| EdgeSymbol { nodes: (x,) }),
map(keyword("P"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("P"), |x| EdgeSymbol { nodes: (x,) }),
map(keyword("n"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("n"), |x| EdgeSymbol { nodes: (x,) }),
map(keyword("N"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("N"), |x| EdgeSymbol { nodes: (x,) }),
map(keyword("*"), |x| EdgeSymbol { nodes: (x,) }), map(symbol("*"), |x| EdgeSymbol { nodes: (x,) }),
))(s) ))(s)
} }

View File

@ -163,13 +163,10 @@ pub enum PropertyExpr {
Weak(Box<PropertyExprWeak>), Weak(Box<PropertyExprWeak>),
Paren(Box<PropertyExprParen>), Paren(Box<PropertyExprParen>),
Not(Box<PropertyExprNot>), Not(Box<PropertyExprNot>),
Binary(Box<PropertyExprBinary>), BinaryProperty(Box<PropertyExprBinaryProperty>),
ImplicationOverlapped(Box<PropertyExprImplicationOverlapped>), BinarySequence(Box<PropertyExprBinarySequence>),
ImplicationNonoverlapped(Box<PropertyExprImplicationNonoverlapped>),
If(Box<PropertyExprIf>), If(Box<PropertyExprIf>),
Case(Box<PropertyExprCase>), Case(Box<PropertyExprCase>),
FollowedByOverlapped(Box<PropertyExprFollowedByOverlapped>),
FollowedByNonoverlapped(Box<PropertyExprFollowedByNonoverlapped>),
Nexttime(Box<PropertyExprNexttime>), Nexttime(Box<PropertyExprNexttime>),
SNexttime(Box<PropertyExprSNexttime>), SNexttime(Box<PropertyExprSNexttime>),
Always(Box<PropertyExprAlways>), Always(Box<PropertyExprAlways>),
@ -205,17 +202,12 @@ pub struct PropertyExprNot {
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprBinary { pub struct PropertyExprBinaryProperty {
pub nodes: (PropertyExpr, Keyword, PropertyExpr), pub nodes: (PropertyExpr, Keyword, PropertyExpr),
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprImplicationOverlapped { pub struct PropertyExprBinarySequence {
pub nodes: (SequenceExpr, Symbol, PropertyExpr),
}
#[derive(Clone, Debug, Node)]
pub struct PropertyExprImplicationNonoverlapped {
pub nodes: (SequenceExpr, Symbol, PropertyExpr), pub nodes: (SequenceExpr, Symbol, PropertyExpr),
} }
@ -240,16 +232,6 @@ pub struct PropertyExprCase {
), ),
} }
#[derive(Clone, Debug, Node)]
pub struct PropertyExprFollowedByOverlapped {
pub nodes: (SequenceExpr, Symbol, PropertyExpr),
}
#[derive(Clone, Debug, Node)]
pub struct PropertyExprFollowedByNonoverlapped {
pub nodes: (SequenceExpr, Symbol, PropertyExpr),
}
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct PropertyExprNexttime { pub struct PropertyExprNexttime {
pub nodes: (Keyword, Option<Bracket<ConstantExpression>>, PropertyExpr), pub nodes: (Keyword, Option<Bracket<ConstantExpression>>, PropertyExpr),
@ -386,12 +368,9 @@ pub enum SequenceExpr {
Expression(Box<SequenceExprExpression>), Expression(Box<SequenceExprExpression>),
Instance(Box<SequenceExprInstance>), Instance(Box<SequenceExprInstance>),
Paren(Box<SequenceExprParen>), Paren(Box<SequenceExprParen>),
And(Box<SequenceExprAnd>), Binary(Box<SequenceExprBinary>),
Intersect(Box<SequenceExprIntersect>),
Or(Box<SequenceExprOr>),
FirstMatch(Box<SequenceExprFirstMatch>), FirstMatch(Box<SequenceExprFirstMatch>),
Throughout(Box<SequenceExprThroughout>), Throughout(Box<SequenceExprThroughout>),
Within(Box<SequenceExprWithin>),
ClockingEvent(Box<SequenceExprClockingEvent>), ClockingEvent(Box<SequenceExprClockingEvent>),
} }
@ -433,17 +412,7 @@ pub struct SequenceExprParen {
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprAnd { pub struct SequenceExprBinary {
pub nodes: (SequenceExpr, Keyword, SequenceExpr),
}
#[derive(Clone, Debug, Node)]
pub struct SequenceExprIntersect {
pub nodes: (SequenceExpr, Keyword, SequenceExpr),
}
#[derive(Clone, Debug, Node)]
pub struct SequenceExprOr {
pub nodes: (SequenceExpr, Keyword, SequenceExpr), pub nodes: (SequenceExpr, Keyword, SequenceExpr),
} }
@ -460,11 +429,6 @@ pub struct SequenceExprThroughout {
pub nodes: (ExpressionOrDist, Keyword, SequenceExpr), pub nodes: (ExpressionOrDist, Keyword, SequenceExpr),
} }
#[derive(Clone, Debug, Node)]
pub struct SequenceExprWithin {
pub nodes: (SequenceExpr, Keyword, SequenceExpr),
}
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct SequenceExprClockingEvent { pub struct SequenceExprClockingEvent {
pub nodes: (ClockingEvent, SequenceExpr), pub nodes: (ClockingEvent, SequenceExpr),

View File

@ -303,7 +303,7 @@ pub struct CoverCross {
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct ListOfCrossItems { pub struct ListOfCrossItems {
pub nodes: (CrossItem, List<Symbol, CrossItem>), pub nodes: (CrossItem, Symbol, List<Symbol, CrossItem>),
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
@ -320,7 +320,7 @@ pub enum CrossBody {
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct CrossBodyNonEmpty { pub struct CrossBodyNonEmpty {
pub nodes: (Brace<Vec<(CrossBodyItem, Symbol)>>,), pub nodes: (Brace<Vec<CrossBodyItem>>,),
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]

View File

@ -152,13 +152,12 @@ pub struct BindDirectiveScope {
BindTargetScope, BindTargetScope,
Option<(Symbol, BindTargetInstanceList)>, Option<(Symbol, BindTargetInstanceList)>,
BindInstantiation, BindInstantiation,
Symbol,
), ),
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct BindDirectiveInstance { pub struct BindDirectiveInstance {
pub nodes: (Keyword, BindTargetInstance, BindInstantiation, Symbol), pub nodes: (Keyword, BindTargetInstance, BindInstantiation),
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]

View File

@ -15,7 +15,7 @@ pub enum SystemTimingCheck {
FullskewTimingCheck(Box<FullskewTimingCheck>), FullskewTimingCheck(Box<FullskewTimingCheck>),
PeriodTimingCheck(Box<PeriodTimingCheck>), PeriodTimingCheck(Box<PeriodTimingCheck>),
WidthTimingCheck(Box<WidthTimingCheck>), WidthTimingCheck(Box<WidthTimingCheck>),
NochargeTimingCheck(Box<NochargeTimingCheck>), NochangeTimingCheck(Box<NochangeTimingCheck>),
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
@ -247,7 +247,7 @@ pub struct WidthTimingCheck {
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct NochargeTimingCheck { pub struct NochangeTimingCheck {
pub nodes: ( pub nodes: (
Keyword, Keyword,
Paren<( Paren<(

View File

@ -96,15 +96,15 @@ pub enum NextState {
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct OutputSymbol { pub struct OutputSymbol {
pub nodes: (Keyword,), pub nodes: (Symbol,),
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct LevelSymbol { pub struct LevelSymbol {
pub nodes: (Keyword,), pub nodes: (Symbol,),
} }
#[derive(Clone, Debug, Node)] #[derive(Clone, Debug, Node)]
pub struct EdgeSymbol { pub struct EdgeSymbol {
pub nodes: (Keyword,), pub nodes: (Symbol,),
} }