This commit is contained in:
dalance 2019-08-14 01:47:19 +09:00
parent c1efdca522
commit 283b310254
11 changed files with 561 additions and 553 deletions

View File

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

View File

@ -129,9 +129,9 @@ pub(crate) fn clocking_item_assertion(s: Span) -> IResult<Span, ClockingItem> {
#[packrat_parser]
pub(crate) fn default_skew(s: Span) -> IResult<Span, DefaultSkew> {
alt((
default_skew_input_output,
default_skew_input,
default_skew_output,
default_skew_input_output,
))(s)
}
@ -176,9 +176,9 @@ pub(crate) fn default_skew_input_output(s: Span) -> IResult<Span, DefaultSkew> {
#[packrat_parser]
pub(crate) fn clocking_direction(s: Span) -> IResult<Span, ClockingDirection> {
alt((
clocking_direction_input_output,
clocking_direction_input,
clocking_direction_output,
clocking_direction_input_output,
clocking_direction_inout,
))(s)
}

View File

@ -49,12 +49,12 @@ pub(crate) fn cond_predicate(s: Span) -> IResult<Span, CondPredicate> {
#[packrat_parser]
pub(crate) fn expression_or_cond_pattern(s: Span) -> IResult<Span, ExpressionOrCondPattern> {
alt((
map(expression, |x| {
ExpressionOrCondPattern::Expression(Box::new(x))
}),
map(cond_pattern, |x| {
ExpressionOrCondPattern::CondPattern(Box::new(x))
}),
map(expression, |x| {
ExpressionOrCondPattern::Expression(Box::new(x))
}),
))(s)
}

View File

@ -255,7 +255,7 @@ pub(crate) fn property_port_list(s: Span) -> IResult<Span, PropertyPortList> {
#[packrat_parser]
pub(crate) fn property_port_item(s: Span) -> IResult<Span, PropertyPortItem> {
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, d) = formal_port_identifier(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_followed_by_overlapped,
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_weak,
property_expr_paren,
@ -783,7 +785,7 @@ pub(crate) fn sequence_port_list(s: Span) -> IResult<Span, SequencePortList> {
#[packrat_parser]
pub(crate) fn sequence_port_item(s: Span) -> IResult<Span, SequencePortItem> {
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, d) = formal_port_identifier(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]
pub(crate) fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
alt((
map(event_expression, |x| {
map(event_expression_sequence_actual_arg, |x| {
SequenceActualArg::EventExpression(Box::new(x))
}),
map(sequence_expr, |x| {
@ -1162,6 +1164,30 @@ pub(crate) fn sequence_actual_arg(s: Span) -> IResult<Span, SequenceActualArg> {
))(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]
#[packrat_parser]
pub(crate) fn boolean_abbrev(s: Span) -> IResult<Span, BooleanAbbrev> {

View File

@ -66,10 +66,10 @@ pub(crate) fn delay2_mintypmax(s: Span) -> IResult<Span, Delay2> {
#[packrat_parser]
pub(crate) fn delay_value(s: Span) -> IResult<Span, DelayValue> {
alt((
map(keyword("1step"), |x| DelayValue::Step1(Box::new(x))),
map(time_literal, |x| DelayValue::TimeLiteral(Box::new(x))),
map(unsigned_number, |x| DelayValue::UnsignedNumber(Box::new(x))),
map(real_number, |x| DelayValue::RealNumber(Box::new(x))),
map(ps_identifier, |x| DelayValue::PsIdentifier(Box::new(x))),
map(keyword("1step"), |x| DelayValue::Step1(Box::new(x))),
))(s)
}

View File

@ -144,15 +144,15 @@ pub(crate) fn constant_mintypmax_expression_ternary(
#[packrat_parser]
pub(crate) fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamExpression> {
alt((
map(symbol("$"), |x| {
ConstantParamExpression::Dollar(Box::new(x))
}),
map(constant_mintypmax_expression, |x| {
ConstantParamExpression::ConstantMintypmaxExpression(Box::new(x))
}),
map(data_type, |x| {
ConstantParamExpression::DataType(Box::new(x))
}),
map(symbol("$"), |x| {
ConstantParamExpression::Dollar(Box::new(x))
}),
))(s)
}
@ -160,11 +160,11 @@ pub(crate) fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamE
#[packrat_parser]
pub(crate) fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
alt((
map(symbol("$"), |x| ParamExpression::Dollar(Box::new(x))),
map(mintypmax_expression, |x| {
ParamExpression::MintypmaxExpression(Box::new(x))
}),
map(data_type, |x| ParamExpression::DataType(Box::new(x))),
map(symbol("$"), |x| ParamExpression::Dollar(Box::new(x))),
))(s)
}

View File

@ -13,6 +13,9 @@ pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
map(primary_literal, |x| {
ConstantPrimary::PrimaryLiteral(Box::new(x))
}),
map(constant_function_call, |x| {
ConstantPrimary::ConstantFunctionCall(Box::new(x))
}),
constant_primary_ps_parameter,
constant_primary_specparam,
map(genvar_identifier, |x| {
@ -22,9 +25,6 @@ pub(crate) fn constant_primary(s: Span) -> IResult<Span, ConstantPrimary> {
constant_primary_enum,
constant_primary_concatenation,
constant_primary_multiple_concatenation,
map(constant_function_call, |x| {
ConstantPrimary::ConstantFunctionCall(Box::new(x))
}),
map(constant_let_expression, |x| {
ConstantPrimary::ConstantLetExpression(Box::new(x))
}),

View File

@ -22,9 +22,9 @@ pub(crate) fn tf_call(s: Span) -> IResult<Span, TfCall> {
#[packrat_parser]
pub(crate) fn system_tf_call(s: Span) -> IResult<Span, SystemTfCall> {
alt((
system_tf_call_arg_optional,
system_tf_call_arg_data_type,
system_tf_call_arg_expression,
system_tf_call_arg_data_type,
system_tf_call_arg_optional,
))(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> {
let (s, a) = system_tf_identifier(s)?;
let (s, b) = paren(pair(
list(symbol(","), opt(expression)),
list(
terminated(symbol(","), peek(not(clocking_event))),
opt(expression),
),
opt(pair(symbol(","), opt(clocking_event))),
))(s)?;
Ok((
@ -104,7 +107,10 @@ pub(crate) fn list_of_arguments(s: Span) -> IResult<Span, ListOfArguments> {
#[tracable_parser]
#[packrat_parser]
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((
symbol(","),
symbol("."),

View File

@ -316,12 +316,12 @@ pub(crate) fn net_port_header_or_interface_port_header(
s: Span,
) -> IResult<Span, NetPortHeaderOrInterfacePortHeader> {
alt((
map(net_port_header, |x| {
NetPortHeaderOrInterfacePortHeader::NetPortHeader(Box::new(x))
}),
map(interface_port_header, |x| {
NetPortHeaderOrInterfacePortHeader::InterfacePortHeader(Box::new(x))
}),
map(net_port_header, |x| {
NetPortHeaderOrInterfacePortHeader::NetPortHeader(Box::new(x))
}),
))(s)
}

File diff suppressed because it is too large Load Diff

View File

@ -128,7 +128,7 @@ pub struct PropertyPortList {
pub struct PropertyPortItem {
pub nodes: (
Vec<AttributeInstance>,
Option<(Local, Option<PropertyLvarPortDirection>)>,
Option<(Keyword, Option<PropertyLvarPortDirection>)>,
PropertyFormalType,
FormalPortIdentifier,
Vec<VariableDimension>,
@ -399,7 +399,7 @@ pub struct SequencePortList {
pub struct SequencePortItem {
pub nodes: (
Vec<AttributeInstance>,
Option<(Local, Option<SequenceLvarPortDirection>)>,
Option<(Keyword, Option<SequenceLvarPortDirection>)>,
SequenceFormalType,
FormalPortIdentifier,
Vec<VariableDimension>,