Fix bugs
This commit is contained in:
parent
c1efdca522
commit
283b310254
10
README.md
10
README.md
@ -81,16 +81,16 @@ 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 | | 23 | x | | 33 | x | |
|
| 3 | x | x | 13 | x | x | 23 | x | | 33 | x | |
|
||||||
| 4 | x | x | 14 | x | | 24 | x | x | 34 | x | |
|
| 4 | x | x | 14 | x | x | 24 | x | x | 34 | x | |
|
||||||
| 5 | x | x | 15 | x | | 25 | x | | 35 | x | |
|
| 5 | x | x | 15 | x | x | 25 | x | | 35 | x | |
|
||||||
| 6 | x | x | 16 | x | | 26 | x | | 36 | x | x |
|
| 6 | x | x | 16 | x | | 26 | x | | 36 | x | x |
|
||||||
| 7 | x | x | 17 | x | | 27 | x | | | | |
|
| 7 | x | x | 17 | x | | 27 | x | | | | |
|
||||||
| 8 | x | x | 18 | x | | 28 | x | x | | | |
|
| 8 | x | x | 18 | x | | 28 | x | x | | | |
|
||||||
| 9 | x | x | 19 | x | | 29 | x | | | | |
|
| 9 | x | x | 19 | x | | 29 | x | | | | |
|
||||||
| 10 | x | x | 20 | x | | 30 | x | | | | |
|
| 10 | x | x | 20 | x | | 30 | x | | | | |
|
||||||
| 11 | x | | 21 | x | | 31 | x | | | | |
|
| 11 | x | x | 21 | x | | 31 | x | | | | |
|
||||||
| 12 | x | | 22 | | | 32 | x | x | | | |
|
| 12 | x | x | 22 | | | 32 | x | x | | | |
|
||||||
|
|
||||||
## Missing entry of specification
|
## Missing entry of specification
|
||||||
|
|
||||||
|
@ -129,9 +129,9 @@ pub(crate) fn clocking_item_assertion(s: Span) -> IResult<Span, ClockingItem> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn default_skew(s: Span) -> IResult<Span, DefaultSkew> {
|
pub(crate) fn default_skew(s: Span) -> IResult<Span, DefaultSkew> {
|
||||||
alt((
|
alt((
|
||||||
|
default_skew_input_output,
|
||||||
default_skew_input,
|
default_skew_input,
|
||||||
default_skew_output,
|
default_skew_output,
|
||||||
default_skew_input_output,
|
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,9 +176,9 @@ pub(crate) fn default_skew_input_output(s: Span) -> IResult<Span, DefaultSkew> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn clocking_direction(s: Span) -> IResult<Span, ClockingDirection> {
|
pub(crate) fn clocking_direction(s: Span) -> IResult<Span, ClockingDirection> {
|
||||||
alt((
|
alt((
|
||||||
|
clocking_direction_input_output,
|
||||||
clocking_direction_input,
|
clocking_direction_input,
|
||||||
clocking_direction_output,
|
clocking_direction_output,
|
||||||
clocking_direction_input_output,
|
|
||||||
clocking_direction_inout,
|
clocking_direction_inout,
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,12 @@ pub(crate) fn cond_predicate(s: Span) -> IResult<Span, CondPredicate> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn expression_or_cond_pattern(s: Span) -> IResult<Span, ExpressionOrCondPattern> {
|
pub(crate) fn expression_or_cond_pattern(s: Span) -> IResult<Span, ExpressionOrCondPattern> {
|
||||||
alt((
|
alt((
|
||||||
map(expression, |x| {
|
|
||||||
ExpressionOrCondPattern::Expression(Box::new(x))
|
|
||||||
}),
|
|
||||||
map(cond_pattern, |x| {
|
map(cond_pattern, |x| {
|
||||||
ExpressionOrCondPattern::CondPattern(Box::new(x))
|
ExpressionOrCondPattern::CondPattern(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
map(expression, |x| {
|
||||||
|
ExpressionOrCondPattern::Expression(Box::new(x))
|
||||||
|
}),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ pub(crate) fn property_port_list(s: Span) -> IResult<Span, PropertyPortList> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn property_port_item(s: Span) -> IResult<Span, PropertyPortItem> {
|
pub(crate) fn property_port_item(s: Span) -> IResult<Span, PropertyPortItem> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = opt(pair(local, opt(property_lvar_port_direction)))(s)?;
|
let (s, b) = opt(pair(keyword("local"), opt(property_lvar_port_direction)))(s)?;
|
||||||
let (s, c) = property_formal_type(s)?;
|
let (s, c) = property_formal_type(s)?;
|
||||||
let (s, d) = formal_port_identifier(s)?;
|
let (s, d) = formal_port_identifier(s)?;
|
||||||
let (s, e) = many0(variable_dimension)(s)?;
|
let (s, e) = many0(variable_dimension)(s)?;
|
||||||
@ -311,7 +311,9 @@ pub(crate) fn property_expr(s: Span) -> IResult<Span, PropertyExpr> {
|
|||||||
property_expr_implication_nonoverlapped,
|
property_expr_implication_nonoverlapped,
|
||||||
property_expr_followed_by_overlapped,
|
property_expr_followed_by_overlapped,
|
||||||
property_expr_followed_by_nonoverlapped,
|
property_expr_followed_by_nonoverlapped,
|
||||||
map(sequence_expr, |x| PropertyExpr::SequenceExpr(Box::new(x))),
|
map(terminated(sequence_expr, peek(not(symbol("(")))), |x| {
|
||||||
|
PropertyExpr::SequenceExpr(Box::new(x))
|
||||||
|
}),
|
||||||
property_expr_strong,
|
property_expr_strong,
|
||||||
property_expr_weak,
|
property_expr_weak,
|
||||||
property_expr_paren,
|
property_expr_paren,
|
||||||
@ -783,7 +785,7 @@ pub(crate) fn sequence_port_list(s: Span) -> IResult<Span, SequencePortList> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn sequence_port_item(s: Span) -> IResult<Span, SequencePortItem> {
|
pub(crate) fn sequence_port_item(s: Span) -> IResult<Span, SequencePortItem> {
|
||||||
let (s, a) = many0(attribute_instance)(s)?;
|
let (s, a) = many0(attribute_instance)(s)?;
|
||||||
let (s, b) = opt(pair(local, opt(sequence_lvar_port_direction)))(s)?;
|
let (s, b) = opt(pair(keyword("local"), opt(sequence_lvar_port_direction)))(s)?;
|
||||||
let (s, c) = sequence_formal_type(s)?;
|
let (s, c) = sequence_formal_type(s)?;
|
||||||
let (s, d) = formal_port_identifier(s)?;
|
let (s, d) = formal_port_identifier(s)?;
|
||||||
let (s, e) = many0(variable_dimension)(s)?;
|
let (s, e) = many0(variable_dimension)(s)?;
|
||||||
@ -1153,7 +1155,7 @@ pub(crate) fn sequence_list_of_arguments_named(s: Span) -> IResult<Span, Sequenc
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
|
pub(crate) fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
|
||||||
alt((
|
alt((
|
||||||
map(event_expression, |x| {
|
map(event_expression_sequence_actual_arg, |x| {
|
||||||
SequenceActualArg::EventExpression(Box::new(x))
|
SequenceActualArg::EventExpression(Box::new(x))
|
||||||
}),
|
}),
|
||||||
map(sequence_expr, |x| {
|
map(sequence_expr, |x| {
|
||||||
@ -1162,6 +1164,30 @@ pub(crate) fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
|
|||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracable_parser]
|
||||||
|
#[packrat_parser]
|
||||||
|
pub(crate) fn event_expression_sequence_actual_arg(s: Span) -> IResult<Span, EventExpression> {
|
||||||
|
alt((
|
||||||
|
event_expression_or_sequence_actual_arg,
|
||||||
|
event_expression_expression,
|
||||||
|
event_expression_sequence,
|
||||||
|
event_expression_paren,
|
||||||
|
))(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[recursive_parser]
|
||||||
|
#[tracable_parser]
|
||||||
|
#[packrat_parser]
|
||||||
|
pub(crate) fn event_expression_or_sequence_actual_arg(s: Span) -> IResult<Span, EventExpression> {
|
||||||
|
let (s, a) = event_expression_sequence_actual_arg(s)?;
|
||||||
|
let (s, b) = keyword("or")(s)?;
|
||||||
|
let (s, c) = event_expression_sequence_actual_arg(s)?;
|
||||||
|
Ok((
|
||||||
|
s,
|
||||||
|
EventExpression::Or(Box::new(EventExpressionOr { nodes: (a, b, c) })),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
#[tracable_parser]
|
#[tracable_parser]
|
||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn boolean_abbrev(s: Span) -> IResult<Span, BooleanAbbrev> {
|
pub(crate) fn boolean_abbrev(s: Span) -> IResult<Span, BooleanAbbrev> {
|
||||||
|
@ -66,10 +66,10 @@ pub(crate) fn delay2_mintypmax(s: Span) -> IResult<Span, Delay2> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn delay_value(s: Span) -> IResult<Span, DelayValue> {
|
pub(crate) fn delay_value(s: Span) -> IResult<Span, DelayValue> {
|
||||||
alt((
|
alt((
|
||||||
|
map(keyword("1step"), |x| DelayValue::Step1(Box::new(x))),
|
||||||
map(time_literal, |x| DelayValue::TimeLiteral(Box::new(x))),
|
map(time_literal, |x| DelayValue::TimeLiteral(Box::new(x))),
|
||||||
map(unsigned_number, |x| DelayValue::UnsignedNumber(Box::new(x))),
|
map(unsigned_number, |x| DelayValue::UnsignedNumber(Box::new(x))),
|
||||||
map(real_number, |x| DelayValue::RealNumber(Box::new(x))),
|
map(real_number, |x| DelayValue::RealNumber(Box::new(x))),
|
||||||
map(ps_identifier, |x| DelayValue::PsIdentifier(Box::new(x))),
|
map(ps_identifier, |x| DelayValue::PsIdentifier(Box::new(x))),
|
||||||
map(keyword("1step"), |x| DelayValue::Step1(Box::new(x))),
|
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -144,15 +144,15 @@ pub(crate) fn constant_mintypmax_expression_ternary(
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamExpression> {
|
pub(crate) fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamExpression> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("$"), |x| {
|
|
||||||
ConstantParamExpression::Dollar(Box::new(x))
|
|
||||||
}),
|
|
||||||
map(constant_mintypmax_expression, |x| {
|
map(constant_mintypmax_expression, |x| {
|
||||||
ConstantParamExpression::ConstantMintypmaxExpression(Box::new(x))
|
ConstantParamExpression::ConstantMintypmaxExpression(Box::new(x))
|
||||||
}),
|
}),
|
||||||
map(data_type, |x| {
|
map(data_type, |x| {
|
||||||
ConstantParamExpression::DataType(Box::new(x))
|
ConstantParamExpression::DataType(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
map(symbol("$"), |x| {
|
||||||
|
ConstantParamExpression::Dollar(Box::new(x))
|
||||||
|
}),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,11 +160,11 @@ pub(crate) fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamE
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
|
pub(crate) fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
|
||||||
alt((
|
alt((
|
||||||
map(symbol("$"), |x| ParamExpression::Dollar(Box::new(x))),
|
|
||||||
map(mintypmax_expression, |x| {
|
map(mintypmax_expression, |x| {
|
||||||
ParamExpression::MintypmaxExpression(Box::new(x))
|
ParamExpression::MintypmaxExpression(Box::new(x))
|
||||||
}),
|
}),
|
||||||
map(data_type, |x| ParamExpression::DataType(Box::new(x))),
|
map(data_type, |x| ParamExpression::DataType(Box::new(x))),
|
||||||
|
map(symbol("$"), |x| ParamExpression::Dollar(Box::new(x))),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
|||||||
map(primary_literal, |x| {
|
map(primary_literal, |x| {
|
||||||
ConstantPrimary::PrimaryLiteral(Box::new(x))
|
ConstantPrimary::PrimaryLiteral(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
map(constant_function_call, |x| {
|
||||||
|
ConstantPrimary::ConstantFunctionCall(Box::new(x))
|
||||||
|
}),
|
||||||
constant_primary_ps_parameter,
|
constant_primary_ps_parameter,
|
||||||
constant_primary_specparam,
|
constant_primary_specparam,
|
||||||
map(genvar_identifier, |x| {
|
map(genvar_identifier, |x| {
|
||||||
@ -22,9 +25,6 @@ pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
|
|||||||
constant_primary_enum,
|
constant_primary_enum,
|
||||||
constant_primary_concatenation,
|
constant_primary_concatenation,
|
||||||
constant_primary_multiple_concatenation,
|
constant_primary_multiple_concatenation,
|
||||||
map(constant_function_call, |x| {
|
|
||||||
ConstantPrimary::ConstantFunctionCall(Box::new(x))
|
|
||||||
}),
|
|
||||||
map(constant_let_expression, |x| {
|
map(constant_let_expression, |x| {
|
||||||
ConstantPrimary::ConstantLetExpression(Box::new(x))
|
ConstantPrimary::ConstantLetExpression(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
@ -22,9 +22,9 @@ pub(crate) fn tf_call(s: Span) -> IResult<Span, TfCall> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn system_tf_call(s: Span) -> IResult<Span, SystemTfCall> {
|
pub(crate) fn system_tf_call(s: Span) -> IResult<Span, SystemTfCall> {
|
||||||
alt((
|
alt((
|
||||||
system_tf_call_arg_optional,
|
|
||||||
system_tf_call_arg_data_type,
|
|
||||||
system_tf_call_arg_expression,
|
system_tf_call_arg_expression,
|
||||||
|
system_tf_call_arg_data_type,
|
||||||
|
system_tf_call_arg_optional,
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,10 @@ pub(crate) fn system_tf_call_arg_data_type(s: Span) -> IResult<Span, SystemTfCal
|
|||||||
pub(crate) fn system_tf_call_arg_expression(s: Span) -> IResult<Span, SystemTfCall> {
|
pub(crate) fn system_tf_call_arg_expression(s: Span) -> IResult<Span, SystemTfCall> {
|
||||||
let (s, a) = system_tf_identifier(s)?;
|
let (s, a) = system_tf_identifier(s)?;
|
||||||
let (s, b) = paren(pair(
|
let (s, b) = paren(pair(
|
||||||
list(symbol(","), opt(expression)),
|
list(
|
||||||
|
terminated(symbol(","), peek(not(clocking_event))),
|
||||||
|
opt(expression),
|
||||||
|
),
|
||||||
opt(pair(symbol(","), opt(clocking_event))),
|
opt(pair(symbol(","), opt(clocking_event))),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -104,7 +107,10 @@ pub(crate) fn list_of_arguments(s: Span) -> IResult<Span, ListOfArguments> {
|
|||||||
#[tracable_parser]
|
#[tracable_parser]
|
||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn list_of_arguments_ordered(s: Span) -> IResult<Span, ListOfArguments> {
|
pub(crate) fn list_of_arguments_ordered(s: Span) -> IResult<Span, ListOfArguments> {
|
||||||
let (s, a) = list(symbol(","), opt(expression))(s)?;
|
let (s, a) = list(
|
||||||
|
terminated(symbol(","), peek(not(symbol(".")))),
|
||||||
|
opt(expression),
|
||||||
|
)(s)?;
|
||||||
let (s, b) = many0(tuple((
|
let (s, b) = many0(tuple((
|
||||||
symbol(","),
|
symbol(","),
|
||||||
symbol("."),
|
symbol("."),
|
||||||
|
@ -316,12 +316,12 @@ pub(crate) fn net_port_header_or_interface_port_header(
|
|||||||
s: Span,
|
s: Span,
|
||||||
) -> IResult<Span, NetPortHeaderOrInterfacePortHeader> {
|
) -> IResult<Span, NetPortHeaderOrInterfacePortHeader> {
|
||||||
alt((
|
alt((
|
||||||
map(net_port_header, |x| {
|
|
||||||
NetPortHeaderOrInterfacePortHeader::NetPortHeader(Box::new(x))
|
|
||||||
}),
|
|
||||||
map(interface_port_header, |x| {
|
map(interface_port_header, |x| {
|
||||||
NetPortHeaderOrInterfacePortHeader::InterfacePortHeader(Box::new(x))
|
NetPortHeaderOrInterfacePortHeader::InterfacePortHeader(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
map(net_port_header, |x| {
|
||||||
|
NetPortHeaderOrInterfacePortHeader::NetPortHeader(Box::new(x))
|
||||||
|
}),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -128,7 +128,7 @@ pub struct PropertyPortList {
|
|||||||
pub struct PropertyPortItem {
|
pub struct PropertyPortItem {
|
||||||
pub nodes: (
|
pub nodes: (
|
||||||
Vec<AttributeInstance>,
|
Vec<AttributeInstance>,
|
||||||
Option<(Local, Option<PropertyLvarPortDirection>)>,
|
Option<(Keyword, Option<PropertyLvarPortDirection>)>,
|
||||||
PropertyFormalType,
|
PropertyFormalType,
|
||||||
FormalPortIdentifier,
|
FormalPortIdentifier,
|
||||||
Vec<VariableDimension>,
|
Vec<VariableDimension>,
|
||||||
@ -399,7 +399,7 @@ pub struct SequencePortList {
|
|||||||
pub struct SequencePortItem {
|
pub struct SequencePortItem {
|
||||||
pub nodes: (
|
pub nodes: (
|
||||||
Vec<AttributeInstance>,
|
Vec<AttributeInstance>,
|
||||||
Option<(Local, Option<SequenceLvarPortDirection>)>,
|
Option<(Keyword, Option<SequenceLvarPortDirection>)>,
|
||||||
SequenceFormalType,
|
SequenceFormalType,
|
||||||
FormalPortIdentifier,
|
FormalPortIdentifier,
|
||||||
Vec<VariableDimension>,
|
Vec<VariableDimension>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user