Remove old paren/brace/bracket

This commit is contained in:
dalance 2019-07-12 16:16:28 +09:00
parent 8dda1ab3de
commit e1a5c5aa8a
20 changed files with 104 additions and 152 deletions

View File

@ -159,21 +159,21 @@ pub fn simple_immediate_assertion_statement(
pub fn simple_immediate_assert_statement(s: Span) -> IResult<Span, SimpleImmediateAssertStatement> {
let (s, a) = symbol("assert")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = action_block(s)?;
Ok((s, SimpleImmediateAssertStatement { nodes: (a, b, c) }))
}
pub fn simple_immediate_assume_statement(s: Span) -> IResult<Span, SimpleImmediateAssumeStatement> {
let (s, a) = symbol("assume")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = action_block(s)?;
Ok((s, SimpleImmediateAssumeStatement { nodes: (a, b, c) }))
}
pub fn simple_immediate_cover_statement(s: Span) -> IResult<Span, SimpleImmediateCoverStatement> {
let (s, a) = symbol("cover")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = statement_or_null(s)?;
Ok((s, SimpleImmediateCoverStatement { nodes: (a, b, c) }))
}
@ -199,7 +199,7 @@ pub fn deferred_immediate_assert_statement(
) -> IResult<Span, DeferredImmediateAssertStatement> {
let (s, a) = symbol("assert")(s)?;
let (s, b) = assert_timing(s)?;
let (s, c) = paren2(expression)(s)?;
let (s, c) = paren(expression)(s)?;
let (s, d) = action_block(s)?;
Ok((
s,
@ -214,7 +214,7 @@ pub fn deferred_immediate_assume_statement(
) -> IResult<Span, DeferredImmediateAssumeStatement> {
let (s, a) = symbol("assume")(s)?;
let (s, b) = assert_timing(s)?;
let (s, c) = paren2(expression)(s)?;
let (s, c) = paren(expression)(s)?;
let (s, d) = action_block(s)?;
Ok((
s,
@ -229,7 +229,7 @@ pub fn deferred_immediate_cover_statement(
) -> IResult<Span, DeferredImmediateCoverStatement> {
let (s, a) = symbol("cover")(s)?;
let (s, b) = assert_timing(s)?;
let (s, c) = paren2(expression)(s)?;
let (s, c) = paren(expression)(s)?;
let (s, d) = statement_or_null(s)?;
Ok((
s,

View File

@ -155,7 +155,7 @@ pub fn case_statement(s: Span) -> IResult<Span, CaseStatement> {
pub fn case_statement_normal(s: Span) -> IResult<Span, CaseStatement> {
let (s, a) = opt(unique_priority)(s)?;
let (s, b) = case_keyword(s)?;
let (s, c) = paren2(case_expression)(s)?;
let (s, c) = paren(case_expression)(s)?;
let (s, d) = case_item(s)?;
let (s, e) = many0(case_item)(s)?;
let (s, f) = symbol("endcase")(s)?;
@ -170,7 +170,7 @@ pub fn case_statement_normal(s: Span) -> IResult<Span, CaseStatement> {
pub fn case_statement_matches(s: Span) -> IResult<Span, CaseStatement> {
let (s, a) = opt(unique_priority)(s)?;
let (s, b) = case_keyword(s)?;
let (s, c) = paren2(case_expression)(s)?;
let (s, c) = paren(case_expression)(s)?;
let (s, d) = symbol("matches")(s)?;
let (s, e) = case_pattern_item(s)?;
let (s, f) = many0(case_pattern_item)(s)?;
@ -186,7 +186,7 @@ pub fn case_statement_matches(s: Span) -> IResult<Span, CaseStatement> {
pub fn case_statement_inside(s: Span) -> IResult<Span, CaseStatement> {
let (s, a) = opt(unique_priority)(s)?;
let (s, b) = symbol("case")(s)?;
let (s, c) = paren2(case_expression)(s)?;
let (s, c) = paren(case_expression)(s)?;
let (s, d) = symbol("inside")(s)?;
let (s, e) = case_inside_item(s)?;
let (s, f) = many0(case_inside_item)(s)?;

View File

@ -259,7 +259,7 @@ pub fn clocking_event_identifier(s: Span) -> IResult<Span, ClockingEvent> {
pub fn clocking_event_expression(s: Span) -> IResult<Span, ClockingEvent> {
let (s, a) = symbol("@")(s)?;
let (s, b) = paren2(event_expression)(s)?;
let (s, b) = paren(event_expression)(s)?;
Ok((
s,
ClockingEvent::Expression(ClockingEventExpression { nodes: (a, b) }),
@ -446,7 +446,7 @@ pub fn cycle_delay_identifier(s: Span) -> IResult<Span, CycleDelay> {
pub fn cycle_delay_expression(s: Span) -> IResult<Span, CycleDelay> {
let (s, a) = symbol("##")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
Ok((
s,
CycleDelay::Expression(CycleDelayExpression { nodes: (a, b) }),

View File

@ -53,12 +53,12 @@ pub struct CondPattern<'a> {
pub fn conditional_statement(s: Span) -> IResult<Span, ConditionalStatement> {
let (s, a) = opt(unique_priority)(s)?;
let (s, b) = symbol("if")(s)?;
let (s, c) = paren2(cond_predicate)(s)?;
let (s, c) = paren(cond_predicate)(s)?;
let (s, d) = statement_or_null(s)?;
let (s, e) = many0(tuple((
symbol("else"),
symbol("if"),
paren2(cond_predicate),
paren(cond_predicate),
statement_or_null,
)))(s)?;
let (s, f) = opt(pair(symbol("else"), statement_or_null))(s)?;

View File

@ -142,7 +142,7 @@ pub fn loop_statement_forever(s: Span) -> IResult<Span, LoopStatement> {
pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("repeat")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = statement_or_null(s)?;
Ok((
s,
@ -152,7 +152,7 @@ pub fn loop_statement_repeat(s: Span) -> IResult<Span, LoopStatement> {
pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("while")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = statement_or_null(s)?;
Ok((
s,
@ -162,7 +162,7 @@ pub fn loop_statement_while(s: Span) -> IResult<Span, LoopStatement> {
pub fn loop_statement_for(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("for")(s)?;
let (s, b) = paren2(tuple((
let (s, b) = paren(tuple((
opt(for_initialization),
symbol(":"),
opt(expression),
@ -177,7 +177,7 @@ pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("do")(s)?;
let (s, b) = statement_or_null(s)?;
let (s, c) = symbol("while")(s)?;
let (s, d) = paren2(expression)(s)?;
let (s, d) = paren(expression)(s)?;
let (s, e) = symbol(";")(s)?;
Ok((
s,
@ -189,9 +189,9 @@ pub fn loop_statement_do_while(s: Span) -> IResult<Span, LoopStatement> {
pub fn loop_statement_foreach(s: Span) -> IResult<Span, LoopStatement> {
let (s, a) = symbol("foreach")(s)?;
let (s, b) = paren2(pair(
let (s, b) = paren(pair(
ps_or_hierarchical_array_identifier,
bracket2(loop_variables),
bracket(loop_variables),
))(s)?;
let (s, c) = statement(s)?;
Ok((

View File

@ -165,12 +165,12 @@ pub fn pattern_tagged(s: Span) -> IResult<Span, Pattern> {
}
pub fn pattern_list(s: Span) -> IResult<Span, Pattern> {
let (s, a) = apostrophe_brace2(list(symbol(","), pattern))(s)?;
let (s, a) = apostrophe_brace(list(symbol(","), pattern))(s)?;
Ok((s, Pattern::List(Box::new(PatternList { nodes: (a,) }))))
}
pub fn pattern_identifier_list(s: Span) -> IResult<Span, Pattern> {
let (s, a) = apostrophe_brace2(list(
let (s, a) = apostrophe_brace(list(
symbol(","),
triple(member_identifier, symbol(":"), pattern),
))(s)?;
@ -190,7 +190,7 @@ pub fn assignment_pattern(s: Span) -> IResult<Span, AssignmentPattern> {
}
pub fn assignment_pattern_list(s: Span) -> IResult<Span, AssignmentPattern> {
let (s, a) = apostrophe_brace2(list(symbol(","), expression))(s)?;
let (s, a) = apostrophe_brace(list(symbol(","), expression))(s)?;
Ok((
s,
AssignmentPattern::List(AssignmentPatternList { nodes: (a,) }),
@ -198,7 +198,7 @@ pub fn assignment_pattern_list(s: Span) -> IResult<Span, AssignmentPattern> {
}
pub fn assignment_pattern_structure(s: Span) -> IResult<Span, AssignmentPattern> {
let (s, a) = apostrophe_brace2(list(
let (s, a) = apostrophe_brace(list(
symbol(","),
triple(structure_pattern_key, symbol(":"), expression),
))(s)?;
@ -209,7 +209,7 @@ pub fn assignment_pattern_structure(s: Span) -> IResult<Span, AssignmentPattern>
}
pub fn assignment_pattern_array(s: Span) -> IResult<Span, AssignmentPattern> {
let (s, a) = apostrophe_brace2(list(
let (s, a) = apostrophe_brace(list(
symbol(","),
triple(array_pattern_key, symbol(":"), expression),
))(s)?;
@ -220,9 +220,9 @@ pub fn assignment_pattern_array(s: Span) -> IResult<Span, AssignmentPattern> {
}
pub fn assignment_pattern_repeat(s: Span) -> IResult<Span, AssignmentPattern> {
let (s, a) = apostrophe_brace2(pair(
let (s, a) = apostrophe_brace(pair(
constant_expression,
brace2(list(symbol(","), expression)),
brace(list(symbol(","), expression)),
))(s)?;
Ok((
s,
@ -292,14 +292,14 @@ pub fn constant_assignment_pattern_expression(
}
pub fn assignment_pattern_net_lvalue(s: Span) -> IResult<Span, AssignmentPatternNetLvalue> {
let (s, a) = apostrophe_brace2(list(symbol(","), net_lvalue))(s)?;
let (s, a) = apostrophe_brace(list(symbol(","), net_lvalue))(s)?;
Ok((s, AssignmentPatternNetLvalue { nodes: (a,) }))
}
pub fn assignment_pattern_variable_lvalue(
s: Span,
) -> IResult<Span, AssignmentPatternVariableLvalue> {
let (s, a) = apostrophe_brace2(list(symbol(","), variable_lvalue))(s)?;
let (s, a) = apostrophe_brace(list(symbol(","), variable_lvalue))(s)?;
Ok((s, AssignmentPatternVariableLvalue { nodes: (a,) }))
}

View File

@ -151,7 +151,7 @@ pub struct RsCaseItemDefault<'a> {
pub fn randsequence_statement(s: Span) -> IResult<Span, RandsequenceStatement> {
let (s, a) = symbol("randsequence")(s)?;
let (s, b) = paren2(opt(production_identifier))(s)?;
let (s, b) = paren(opt(production_identifier))(s)?;
let (s, c) = production(s)?;
let (s, d) = many0(production)(s)?;
let (s, e) = symbol("endsequence")(s)?;
@ -166,7 +166,7 @@ pub fn randsequence_statement(s: Span) -> IResult<Span, RandsequenceStatement> {
pub fn production(s: Span) -> IResult<Span, Production> {
let (s, a) = opt(data_type_or_void)(s)?;
let (s, b) = production_identifier(s)?;
let (s, c) = opt(paren2(tf_port_list))(s)?;
let (s, c) = opt(paren(tf_port_list))(s)?;
let (s, d) = symbol(":")(s)?;
let (s, e) = list(symbol("|"), rs_rule)(s)?;
let (s, f) = symbol(";")(s)?;
@ -204,7 +204,7 @@ pub fn rs_production_list_prod(s: Span) -> IResult<Span, RsProductionList> {
pub fn rs_production_list_join(s: Span) -> IResult<Span, RsProductionList> {
let (s, a) = symbol("rand")(s)?;
let (s, b) = symbol("join")(s)?;
let (s, c) = opt(paren2(expression))(s)?;
let (s, c) = opt(paren(expression))(s)?;
let (s, d) = production_item(s)?;
let (s, e) = production_item(s)?;
let (s, f) = many0(production_item)(s)?;
@ -225,7 +225,7 @@ pub fn weight_specification(s: Span) -> IResult<Span, WeightSpecification> {
}
pub fn weight_specification_expression(s: Span) -> IResult<Span, WeightSpecification> {
let (s, a) = paren2(expression)(s)?;
let (s, a) = paren(expression)(s)?;
Ok((
s,
WeightSpecification::Expression(WeightSpecificationExpression { nodes: (a,) }),
@ -233,7 +233,7 @@ pub fn weight_specification_expression(s: Span) -> IResult<Span, WeightSpecifica
}
pub fn rs_code_block(s: Span) -> IResult<Span, RsCodeBlock> {
let (s, a) = brace2(pair(many0(data_declaration), many0(statement_or_null)))(s)?;
let (s, a) = brace(pair(many0(data_declaration), many0(statement_or_null)))(s)?;
Ok((s, RsCodeBlock { nodes: (a,) }))
}
@ -249,13 +249,13 @@ pub fn rs_prod(s: Span) -> IResult<Span, RsProd> {
pub fn production_item(s: Span) -> IResult<Span, ProductionItem> {
let (s, a) = production_identifier(s)?;
let (s, b) = opt(paren2(list_of_arguments))(s)?;
let (s, b) = opt(paren(list_of_arguments))(s)?;
Ok((s, ProductionItem { nodes: (a, b) }))
}
pub fn rs_if_else(s: Span) -> IResult<Span, RsIfElse> {
let (s, a) = symbol("if")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = production_item(s)?;
let (s, d) = opt(pair(symbol("else"), production_item))(s)?;
Ok((
@ -268,14 +268,14 @@ pub fn rs_if_else(s: Span) -> IResult<Span, RsIfElse> {
pub fn rs_repeat(s: Span) -> IResult<Span, RsRepeat> {
let (s, a) = symbol("repeat")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = production_item(s)?;
Ok((s, RsRepeat { nodes: (a, b, c) }))
}
pub fn rs_case(s: Span) -> IResult<Span, RsCase> {
let (s, a) = symbol("case")(s)?;
let (s, b) = paren2(case_expression)(s)?;
let (s, b) = paren(case_expression)(s)?;
let (s, c) = rs_case_item(s)?;
let (s, d) = many0(rs_case_item)(s)?;
let (s, e) = symbol("endcase")(s)?;

View File

@ -36,7 +36,7 @@ pub fn subroutine_call_statement(s: Span) -> IResult<Span, SubroutineCallStateme
pub fn subroutine_call_statement_function(s: Span) -> IResult<Span, SubroutineCallStatement> {
let (s, a) = symbol("void")(s)?;
let (s, b) = symbol("'")(s)?;
let (s, c) = paren2(function_subroutine_call)(s)?;
let (s, c) = paren(function_subroutine_call)(s)?;
let (s, d) = symbol(";")(s)?;
Ok((
s,

View File

@ -230,7 +230,7 @@ pub fn delay_or_event_control(s: Span) -> IResult<Span, DelayOrEventControl> {
pub fn delay_or_event_control_repeat(s: Span) -> IResult<Span, DelayOrEventControl> {
let (s, a) = symbol("repeat")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = event_control(s)?;
Ok((
s,
@ -250,7 +250,7 @@ pub fn delay_control_delay(s: Span) -> IResult<Span, DelayControl> {
pub fn delay_control_mintypmax(s: Span) -> IResult<Span, DelayControl> {
let (s, a) = symbol("#")(s)?;
let (s, b) = paren2(mintypmax_expression)(s)?;
let (s, b) = paren(mintypmax_expression)(s)?;
Ok((
s,
DelayControl::Mintypmax(DelayControlMintypmax { nodes: (a, b) }),
@ -278,7 +278,7 @@ pub fn event_control_event_identifier(s: Span) -> IResult<Span, EventControl> {
pub fn event_control_event_expression(s: Span) -> IResult<Span, EventControl> {
let (s, a) = symbol("@")(s)?;
let (s, b) = paren2(event_expression)(s)?;
let (s, b) = paren(event_expression)(s)?;
Ok((
s,
EventControl::EventExpression(EventControlEventExpression { nodes: (a, b) }),
@ -295,7 +295,7 @@ pub fn event_control_asterisk(s: Span) -> IResult<Span, EventControl> {
pub fn event_control_paren_asterisk(s: Span) -> IResult<Span, EventControl> {
let (s, a) = symbol("@")(s)?;
let (s, b) = paren2(symbol("*"))(s)?;
let (s, b) = paren(symbol("*"))(s)?;
Ok((
s,
EventControl::ParenAsterisk(EventControlParenAsterisk { nodes: (a, b) }),
@ -361,7 +361,7 @@ pub fn event_expression_comma(s: Span) -> IResult<Span, EventExpression> {
}
pub fn event_expression_paren(s: Span) -> IResult<Span, EventExpression> {
let (s, a) = paren2(event_expression)(s)?;
let (s, a) = paren(event_expression)(s)?;
Ok((
s,
EventExpression::Paren(Box::new(EventExpressionParen { nodes: (a,) })),
@ -422,7 +422,7 @@ pub fn wait_statement(s: Span) -> IResult<Span, WaitStatement> {
pub fn wait_statement_wait(s: Span) -> IResult<Span, WaitStatement> {
let (s, a) = symbol("wait")(s)?;
let (s, b) = paren2(expression)(s)?;
let (s, b) = paren(expression)(s)?;
let (s, c) = statement_or_null(s)?;
Ok((
s,
@ -442,7 +442,7 @@ pub fn wait_statement_fork(s: Span) -> IResult<Span, WaitStatement> {
pub fn wait_statement_order(s: Span) -> IResult<Span, WaitStatement> {
let (s, a) = symbol("wait_order")(s)?;
let (s, b) = paren2(list(symbol(","), hierarchical_identifier))(s)?;
let (s, b) = paren(list(symbol(","), hierarchical_identifier))(s)?;
let (s, c) = action_block(s)?;
Ok((
s,

View File

@ -105,39 +105,39 @@ pub struct EmptyUnpackedArrayConcatenation<'a> {
// -----------------------------------------------------------------------------
pub fn concatenation(s: Span) -> IResult<Span, Concatenation> {
let (s, a) = brace2(list(symbol(","), expression))(s)?;
let (s, a) = brace(list(symbol(","), expression))(s)?;
Ok((s, Concatenation { nodes: (a,) }))
}
pub fn constant_concatenation(s: Span) -> IResult<Span, ConstantConcatenation> {
let (s, a) = brace2(list(symbol(","), constant_expression))(s)?;
let (s, a) = brace(list(symbol(","), constant_expression))(s)?;
Ok((s, ConstantConcatenation { nodes: (a,) }))
}
pub fn constant_multiple_concatenation(s: Span) -> IResult<Span, ConstantMultipleConcatenation> {
let (s, a) = brace2(pair(constant_expression, constant_concatenation))(s)?;
let (s, a) = brace(pair(constant_expression, constant_concatenation))(s)?;
Ok((s, ConstantMultipleConcatenation { nodes: (a,) }))
}
pub fn module_path_concatenation(s: Span) -> IResult<Span, ModulePathConcatenation> {
let (s, a) = brace2(list(symbol(","), module_path_expression))(s)?;
let (s, a) = brace(list(symbol(","), module_path_expression))(s)?;
Ok((s, ModulePathConcatenation { nodes: (a,) }))
}
pub fn module_path_multiple_concatenation(
s: Span,
) -> IResult<Span, ModulePathMultipleConcatenation> {
let (s, a) = brace2(pair(constant_expression, module_path_concatenation))(s)?;
let (s, a) = brace(pair(constant_expression, module_path_concatenation))(s)?;
Ok((s, ModulePathMultipleConcatenation { nodes: (a,) }))
}
pub fn multiple_concatenation(s: Span) -> IResult<Span, MultipleConcatenation> {
let (s, a) = brace2(pair(expression, concatenation))(s)?;
let (s, a) = brace(pair(expression, concatenation))(s)?;
Ok((s, MultipleConcatenation { nodes: (a,) }))
}
pub fn streaming_concatenation(s: Span) -> IResult<Span, StreamingConcatenation> {
let (s, a) = brace2(triple(
let (s, a) = brace(triple(
stream_operator,
opt(slice_size),
stream_concatenation,
@ -160,13 +160,13 @@ pub fn slice_size(s: Span) -> IResult<Span, SliceSize> {
}
pub fn stream_concatenation(s: Span) -> IResult<Span, StreamConcatenation> {
let (s, a) = brace2(list(symbol(","), stream_expression))(s)?;
let (s, a) = brace(list(symbol(","), stream_expression))(s)?;
Ok((s, StreamConcatenation { nodes: (a,) }))
}
pub fn stream_expression(s: Span) -> IResult<Span, StreamExpression> {
let (s, a) = expression(s)?;
let (s, b) = opt(pair(symbol("with"), bracket2(array_range_expression)))(s)?;
let (s, b) = opt(pair(symbol("with"), bracket(array_range_expression)))(s)?;
Ok((s, StreamExpression { nodes: (a, b) }))
}

View File

@ -94,7 +94,7 @@ pub fn net_lvalue_pattern(s: Span) -> IResult<Span, NetLvalue> {
}
pub fn net_lvalue_lvalue(s: Span) -> IResult<Span, NetLvalue> {
let (s, a) = brace2(list(symbol(","), net_lvalue))(s)?;
let (s, a) = brace(list(symbol(","), net_lvalue))(s)?;
Ok((
s,
NetLvalue::Lvalue(Box::new(NetLvalueLvalue { nodes: (a,) })),
@ -132,7 +132,7 @@ pub fn variable_lvalue_pattern(s: Span) -> IResult<Span, VariableLvalue> {
}
pub fn variable_lvalue_lvalue(s: Span) -> IResult<Span, VariableLvalue> {
let (s, a) = brace2(list(symbol(","), variable_lvalue))(s)?;
let (s, a) = brace(list(symbol(","), variable_lvalue))(s)?;
Ok((
s,
VariableLvalue::Lvalue(Box::new(VariableLvalueLvalue { nodes: (a,) })),

View File

@ -479,7 +479,7 @@ pub fn expression_unary(s: Span) -> IResult<Span, Expression> {
}
pub fn expression_operator_assignment(s: Span) -> IResult<Span, Expression> {
let (s, a) = paren2(operator_assignment)(s)?;
let (s, a) = paren(operator_assignment)(s)?;
Ok((
s,
Expression::OperatorAssignment(Box::new(ExpressionOperatorAssignment { nodes: (a,) })),
@ -509,7 +509,7 @@ pub fn tagged_union_expression(s: Span) -> IResult<Span, TaggedUnionExpression>
pub fn inside_expression(s: Span) -> IResult<Span, InsideExpression> {
let (s, a) = expression(s)?;
let (s, b) = symbol("inside")(s)?;
let (s, c) = brace2(open_range_list)(s)?;
let (s, c) = brace(open_range_list)(s)?;
Ok((s, InsideExpression { nodes: (a, b, c) }))
}
@ -521,7 +521,7 @@ pub fn value_range(s: Span) -> IResult<Span, ValueRange> {
}
pub fn value_range_binary(s: Span) -> IResult<Span, ValueRange> {
let (s, a) = bracket2(triple(expression, symbol(":"), expression))(s)?;
let (s, a) = bracket(triple(expression, symbol(":"), expression))(s)?;
Ok((s, ValueRange::Binary(ValueRangeBinary { nodes: (a,) })))
}

View File

@ -298,7 +298,7 @@ pub fn constant_primary_ps_parameter(s: Span) -> IResult<Span, ConstantPrimary>
pub fn constant_primary_specparam(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = specparam_identifier(s)?;
let (s, b) = opt(bracket2(constant_range_expression))(s)?;
let (s, b) = opt(bracket(constant_range_expression))(s)?;
Ok((
s,
ConstantPrimary::Specparam(ConstantPrimarySpecparam { nodes: (a, b) }),
@ -325,7 +325,7 @@ pub fn constant_primary_enum(s: Span) -> IResult<Span, ConstantPrimary> {
pub fn constant_primary_concatenation(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = constant_concatenation(s)?;
let (s, b) = opt(bracket2(constant_range_expression))(s)?;
let (s, b) = opt(bracket(constant_range_expression))(s)?;
Ok((
s,
ConstantPrimary::Concatenation(ConstantPrimaryConcatenation { nodes: (a, b) }),
@ -334,7 +334,7 @@ pub fn constant_primary_concatenation(s: Span) -> IResult<Span, ConstantPrimary>
pub fn constant_primary_multiple_concatenation(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = constant_multiple_concatenation(s)?;
let (s, b) = opt(bracket2(constant_range_expression))(s)?;
let (s, b) = opt(bracket(constant_range_expression))(s)?;
Ok((
s,
ConstantPrimary::MultipleConcatenation(ConstantPrimaryMultipleConcatenation {
@ -344,7 +344,7 @@ pub fn constant_primary_multiple_concatenation(s: Span) -> IResult<Span, Constan
}
pub fn constant_primary_mintypmax_expression(s: Span) -> IResult<Span, ConstantPrimary> {
let (s, a) = paren2(constant_mintypmax_expression)(s)?;
let (s, a) = paren(constant_mintypmax_expression)(s)?;
Ok((
s,
ConstantPrimary::MintypmaxExpression(ConstantPrimaryMintypmaxExpression { nodes: (a,) }),
@ -369,7 +369,7 @@ pub fn module_path_primary(s: Span) -> IResult<Span, ModulePathPrimary> {
}
pub fn module_path_primary_mintypmax_expression(s: Span) -> IResult<Span, ModulePathPrimary> {
let (s, a) = paren2(module_path_mintypmax_expression)(s)?;
let (s, a) = paren(module_path_mintypmax_expression)(s)?;
Ok((
s,
ModulePathPrimary::Mintypmax(ModulePathPrimaryMintypmax { nodes: (a,) }),
@ -415,7 +415,7 @@ pub fn primary_hierarchical(s: Span) -> IResult<Span, Primary> {
pub fn primary_concatenation(s: Span) -> IResult<Span, Primary> {
let (s, a) = concatenation(s)?;
let (s, b) = opt(bracket2(range_expression))(s)?;
let (s, b) = opt(bracket(range_expression))(s)?;
Ok((
s,
Primary::Concatenation(PrimaryConcatenation { nodes: (a, b) }),
@ -424,7 +424,7 @@ pub fn primary_concatenation(s: Span) -> IResult<Span, Primary> {
pub fn primary_multiple_concatenation(s: Span) -> IResult<Span, Primary> {
let (s, a) = multiple_concatenation(s)?;
let (s, b) = opt(bracket2(range_expression))(s)?;
let (s, b) = opt(bracket(range_expression))(s)?;
Ok((
s,
Primary::MultipleConcatenation(PrimaryMultipleConcatenation { nodes: (a, b) }),
@ -432,7 +432,7 @@ pub fn primary_multiple_concatenation(s: Span) -> IResult<Span, Primary> {
}
pub fn primary_mintypmax_expression(s: Span) -> IResult<Span, Primary> {
let (s, a) = paren2(mintypmax_expression)(s)?;
let (s, a) = paren(mintypmax_expression)(s)?;
Ok((
s,
Primary::MintypmaxExpression(PrimaryMintypmaxExpression { nodes: (a,) }),
@ -519,7 +519,7 @@ pub fn implicit_class_handle(s: Span) -> IResult<Span, ImplicitClassHandle> {
}
pub fn bit_select(s: Span) -> IResult<Span, BitSelect> {
let (s, a) = many0(bracket2(expression))(s)?;
let (s, a) = many0(bracket(expression))(s)?;
Ok((s, BitSelect { nodes: (a,) }))
}
@ -530,7 +530,7 @@ pub fn select(s: Span) -> IResult<Span, Select> {
member_identifier,
))(s)?;
let (s, b) = bit_select(s)?;
let (s, c) = opt(bracket2(part_select_range))(s)?;
let (s, c) = opt(bracket(part_select_range))(s)?;
Ok((s, Select { nodes: (a, b, c) }))
}
@ -545,7 +545,7 @@ pub fn nonrange_select(s: Span) -> IResult<Span, NonrangeSelect> {
}
pub fn constant_bit_select(s: Span) -> IResult<Span, ConstantBitSelect> {
let (s, a) = many0(bracket2(constant_expression))(s)?;
let (s, a) = many0(bracket(constant_expression))(s)?;
Ok((s, ConstantBitSelect { nodes: (a,) }))
}
@ -556,14 +556,14 @@ pub fn constant_select(s: Span) -> IResult<Span, ConstantSelect> {
member_identifier,
))(s)?;
let (s, b) = constant_bit_select(s)?;
let (s, c) = opt(bracket2(constant_part_select_range))(s)?;
let (s, c) = opt(bracket(constant_part_select_range))(s)?;
Ok((s, ConstantSelect { nodes: (a, b, c) }))
}
pub fn constant_cast(s: Span) -> IResult<Span, ConstantCast> {
let (s, a) = casting_type(s)?;
let (s, b) = symbol("'")(s)?;
let (s, c) = paren2(constant_expression)(s)?;
let (s, c) = paren(constant_expression)(s)?;
Ok((s, ConstantCast { nodes: (a, b, c) }))
}
@ -575,7 +575,7 @@ pub fn constant_let_expression(s: Span) -> IResult<Span, ConstantLetExpression>
pub fn cast(s: Span) -> IResult<Span, Cast> {
let (s, a) = casting_type(s)?;
let (s, b) = symbol("'")(s)?;
let (s, c) = paren2(expression)(s)?;
let (s, c) = paren(expression)(s)?;
Ok((s, Cast { nodes: (a, b, c) }))
}

View File

@ -191,7 +191,7 @@ pub fn constant_function_call(s: Span) -> IResult<Span, ConstantFunctionCall> {
pub fn tf_call(s: Span) -> IResult<Span, TfCall> {
let (s, a) = ps_or_hierarchical_tf_identifier(s)?;
let (s, b) = many0(attribute_instance)(s)?;
let (s, c) = opt(paren2(list_of_arguments))(s)?;
let (s, c) = opt(paren(list_of_arguments))(s)?;
Ok((s, TfCall { nodes: (a, b, c) }))
}
@ -205,7 +205,7 @@ pub fn system_tf_call(s: Span) -> IResult<Span, SystemTfCall> {
pub fn system_tf_call_arg_optional(s: Span) -> IResult<Span, SystemTfCall> {
let (s, a) = system_tf_identifier(s)?;
let (s, b) = opt(paren2(list_of_arguments))(s)?;
let (s, b) = opt(paren(list_of_arguments))(s)?;
Ok((
s,
SystemTfCall::ArgOptionl(SystemTfCallArgOptional { nodes: (a, b) }),
@ -214,7 +214,7 @@ pub fn system_tf_call_arg_optional(s: Span) -> IResult<Span, SystemTfCall> {
pub fn system_tf_call_arg_data_type(s: Span) -> IResult<Span, SystemTfCall> {
let (s, a) = system_tf_identifier(s)?;
let (s, b) = paren2(pair(data_type, opt(pair(symbol(","), expression))))(s)?;
let (s, b) = paren(pair(data_type, opt(pair(symbol(","), expression))))(s)?;
Ok((
s,
SystemTfCall::ArgDataType(SystemTfCallArgDataType { nodes: (a, b) }),
@ -223,7 +223,7 @@ pub fn system_tf_call_arg_data_type(s: Span) -> IResult<Span, SystemTfCall> {
pub fn system_tf_call_arg_expression(s: Span) -> IResult<Span, SystemTfCall> {
let (s, a) = system_tf_identifier(s)?;
let (s, b) = paren2(pair(
let (s, b) = paren(pair(
list(symbol(","), opt(expression)),
opt(pair(symbol(","), opt(clocking_event))),
))(s)?;
@ -267,7 +267,7 @@ pub fn list_of_arguments_ordered(s: Span) -> IResult<Span, ListOfArguments> {
symbol(","),
symbol("."),
identifier,
paren2(opt(expression)),
paren(opt(expression)),
)))(s)?;
Ok((
s,
@ -278,12 +278,12 @@ pub fn list_of_arguments_ordered(s: Span) -> IResult<Span, ListOfArguments> {
pub fn list_of_arguments_named(s: Span) -> IResult<Span, ListOfArguments> {
let (s, a) = symbol(".")(s)?;
let (s, b) = identifier(s)?;
let (s, c) = paren2(opt(expression))(s)?;
let (s, c) = paren(opt(expression))(s)?;
let (s, d) = many0(tuple((
symbol(","),
symbol("."),
identifier,
paren2(opt(expression)),
paren(opt(expression)),
)))(s)?;
Ok((
s,
@ -313,7 +313,7 @@ pub fn method_call_body(s: Span) -> IResult<Span, MethodCallBody> {
pub fn method_call_body_user(s: Span) -> IResult<Span, MethodCallBody> {
let (s, a) = method_identifier(s)?;
let (s, b) = many0(attribute_instance)(s)?;
let (s, c) = opt(paren2(list_of_arguments))(s)?;
let (s, c) = opt(paren(list_of_arguments))(s)?;
Ok((
s,
MethodCallBody::User(MethodCallBodyUser { nodes: (a, b, c) }),
@ -332,8 +332,8 @@ pub fn built_in_method_call(s: Span) -> IResult<Span, BuiltInMethodCall> {
pub fn array_manipulation_call(s: Span) -> IResult<Span, ArrayManipulationCall> {
let (s, a) = array_method_name(s)?;
let (s, b) = many0(attribute_instance)(s)?;
let (s, c) = opt(paren2(list_of_arguments))(s)?;
let (s, d) = opt(pair(symbol("with"), paren2(expression)))(s)?;
let (s, c) = opt(paren(list_of_arguments))(s)?;
let (s, d) = opt(pair(symbol("with"), paren(expression)))(s)?;
Ok((
s,
ArrayManipulationCall {
@ -345,10 +345,10 @@ pub fn array_manipulation_call(s: Span) -> IResult<Span, ArrayManipulationCall>
pub fn randomize_call(s: Span) -> IResult<Span, RandomizeCall> {
let (s, a) = symbol("randomize")(s)?;
let (s, b) = many0(attribute_instance)(s)?;
let (s, c) = opt(paren2(opt(variable_identifier_list_or_null)))(s)?;
let (s, c) = opt(paren(opt(variable_identifier_list_or_null)))(s)?;
let (s, d) = opt(triple(
symbol("with"),
opt(paren2(opt(identifier_list))),
opt(paren(opt(identifier_list))),
constraint_block,
))(s)?;
Ok((

View File

@ -1016,7 +1016,7 @@ pub fn ps_parameter_identifier_scope(s: Span) -> IResult<Span, PsParameterIdenti
pub fn ps_parameter_identifier_generate(s: Span) -> IResult<Span, PsParameterIdentifier> {
let (s, a) = many0(triple(
generate_block_identifier,
opt(bracket2(constant_expression)),
opt(bracket(constant_expression)),
symbol("."),
))(s)?;
let (s, b) = parameter_identifier(s)?;

View File

@ -63,7 +63,7 @@ pub struct NamedCheckerPortConnectionAsterisk<'a> {
pub fn checker_instantiation(s: Span) -> IResult<Span, CheckerInstantiation> {
let (s, a) = ps_checker_identifier(s)?;
let (s, b) = name_of_instance(s)?;
let (s, c) = paren2(opt(list_of_checker_port_connections))(s)?;
let (s, c) = paren(opt(list_of_checker_port_connections))(s)?;
let (s, d) = symbol(";")(s)?;
Ok((
s,
@ -119,7 +119,7 @@ pub fn named_checker_port_connection_identifier(
let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol(".")(s)?;
let (s, c) = formal_port_identifier(s)?;
let (s, d) = opt(paren2(opt(property_actual_arg)))(s)?;
let (s, d) = opt(paren(opt(property_actual_arg)))(s)?;
Ok((
s,
NamedCheckerPortConnection::Identifier(NamedCheckerPortConnectionIdentifier {

View File

@ -153,7 +153,7 @@ pub fn generate_region(s: Span) -> IResult<Span, GenerateRegion> {
pub fn loop_generate_construct(s: Span) -> IResult<Span, LoopGenerateConstruct> {
let (s, a) = symbol("for")(s)?;
let (s, b) = paren2(tuple((
let (s, b) = paren(tuple((
generate_initialization,
symbol(";"),
genvar_expression,
@ -226,7 +226,7 @@ pub fn conditional_generate_construct(s: Span) -> IResult<Span, ConditionalGener
pub fn if_generate_construct(s: Span) -> IResult<Span, IfGenerateConstruct> {
let (s, a) = symbol("if")(s)?;
let (s, b) = paren2(constant_expression)(s)?;
let (s, b) = paren(constant_expression)(s)?;
let (s, c) = generate_block(s)?;
let (s, d) = opt(pair(symbol("else"), generate_block))(s)?;
Ok((
@ -239,7 +239,7 @@ pub fn if_generate_construct(s: Span) -> IResult<Span, IfGenerateConstruct> {
pub fn case_generate_construct(s: Span) -> IResult<Span, CaseGenerateConstruct> {
let (s, a) = symbol("case")(s)?;
let (s, b) = paren2(constant_expression)(s)?;
let (s, b) = paren(constant_expression)(s)?;
let (s, c) = many1(case_generate_item)(s)?;
let (s, d) = symbol("endcase")(s)?;
Ok((

View File

@ -126,7 +126,7 @@ pub fn module_instantiation(s: Span) -> IResult<Span, ModuleInstantiation> {
pub fn parameter_value_assignment(s: Span) -> IResult<Span, ParameterValueAssignment> {
let (s, a) = symbol("#")(s)?;
let (s, b) = paren2(opt(list_of_parameter_assignments))(s)?;
let (s, b) = paren(opt(list_of_parameter_assignments))(s)?;
Ok((s, ParameterValueAssignment { nodes: (a, b) }))
}
@ -161,13 +161,13 @@ pub fn ordered_parameter_assignment(s: Span) -> IResult<Span, OrderedParameterAs
pub fn named_parameter_assignment(s: Span) -> IResult<Span, NamedParameterAssignment> {
let (s, a) = symbol(".")(s)?;
let (s, b) = parameter_identifier(s)?;
let (s, c) = paren2(opt(param_expression))(s)?;
let (s, c) = paren(opt(param_expression))(s)?;
Ok((s, NamedParameterAssignment { nodes: (a, b, c) }))
}
pub fn hierarchical_instance(s: Span) -> IResult<Span, HierarchicalInstance> {
let (s, a) = name_of_instance(s)?;
let (s, b) = paren2(opt(list_of_port_connections))(s)?;
let (s, b) = paren(opt(list_of_port_connections))(s)?;
Ok((s, HierarchicalInstance { nodes: (a, b) }))
}
@ -217,7 +217,7 @@ pub fn named_port_connection_identifier(s: Span) -> IResult<Span, NamedPortConne
let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol(".")(s)?;
let (s, c) = port_identifier(s)?;
let (s, d) = opt(paren2(opt(expression)))(s)?;
let (s, d) = opt(paren(opt(expression)))(s)?;
Ok((
s,
NamedPortConnection::Identifier(NamedPortConnectionIdentifier {

View File

@ -552,7 +552,7 @@ pub fn module_declaration_wildcard(s: Span) -> IResult<Span, ModuleDeclaration>
let (s, b) = module_keyword(s)?;
let (s, c) = opt(lifetime)(s)?;
let (s, d) = module_identifier(s)?;
let (s, e) = paren2(symbol(".*"))(s)?;
let (s, e) = paren(symbol(".*"))(s)?;
let (s, f) = symbol(";")(s)?;
let (s, g) = opt(timeunits_declaration)(s)?;
let (s, h) = many0(module_item)(s)?;
@ -634,7 +634,7 @@ pub fn interface_declaration_wildcard(s: Span) -> IResult<Span, InterfaceDeclara
let (s, b) = symbol("interface")(s)?;
let (s, c) = opt(lifetime)(s)?;
let (s, d) = interface_identifier(s)?;
let (s, e) = paren2(symbol(".*"))(s)?;
let (s, e) = paren(symbol(".*"))(s)?;
let (s, f) = symbol(";")(s)?;
let (s, g) = opt(timeunits_declaration)(s)?;
let (s, h) = many0(interface_item)(s)?;
@ -742,7 +742,7 @@ pub fn program_declaration_wildcard(s: Span) -> IResult<Span, ProgramDeclaration
let (s, a) = many0(attribute_instance)(s)?;
let (s, b) = symbol("program")(s)?;
let (s, c) = program_identifier(s)?;
let (s, d) = paren2(symbol(".*"))(s)?;
let (s, d) = paren(symbol(".*"))(s)?;
let (s, e) = symbol(";")(s)?;
let (s, f) = opt(timeunits_declaration)(s)?;
let (s, g) = many0(program_item)(s)?;
@ -811,7 +811,7 @@ pub fn program_ansi_header(s: Span) -> IResult<Span, ProgramAnsiHeader> {
pub fn checker_declaration(s: Span) -> IResult<Span, CheckerDeclaration> {
let (s, a) = symbol("checker")(s)?;
let (s, b) = checker_identifier(s)?;
let (s, c) = opt(paren2(opt(checker_port_list)))(s)?;
let (s, c) = opt(paren(opt(checker_port_list)))(s)?;
let (s, d) = symbol(";")(s)?;
let (s, e) = many0(pair(many0(attribute_instance), checker_or_generate_item))(s)?;
let (s, f) = symbol("endchecker")(s)?;
@ -833,7 +833,7 @@ pub fn class_declaration(s: Span) -> IResult<Span, ClassDeclaration> {
let (s, f) = opt(triple(
symbol("extends"),
class_type,
opt(paren2(list_of_arguments)),
opt(paren(list_of_arguments)),
))(s)?;
let (s, g) = opt(pair(
symbol("implements"),

View File

@ -63,7 +63,7 @@ pub fn symbol<'a>(t: &'a str) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Symbol<'
move |s: Span<'a>| map(ws(tag(t.clone())), |x| Symbol { nodes: x })(s)
}
pub fn paren2<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Paren<O>>
pub fn paren<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Paren<O>>
where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{
@ -75,7 +75,7 @@ where
}
}
pub fn bracket2<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Bracket<O>>
pub fn bracket<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Bracket<O>>
where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{
@ -87,7 +87,7 @@ where
}
}
pub fn brace2<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Brace<O>>
pub fn brace<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, Brace<O>>
where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{
@ -99,7 +99,7 @@ where
}
}
pub fn apostrophe_brace2<'a, O, F>(
pub fn apostrophe_brace<'a, O, F>(
f: F,
) -> impl Fn(Span<'a>) -> IResult<Span<'a>, ApostropheBrace<O>>
where
@ -135,54 +135,6 @@ where
}
}
pub fn paren<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O>
where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{
move |s: Span<'a>| {
let (s, _) = symbol("(")(s)?;
let (s, b) = f(s)?;
let (s, _) = symbol(")")(s)?;
Ok((s, b))
}
}
pub fn bracket<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O>
where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{
move |s: Span<'a>| {
let (s, _) = symbol("[")(s)?;
let (s, b) = f(s)?;
let (s, _) = symbol("]")(s)?;
Ok((s, b))
}
}
pub fn brace<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O>
where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{
move |s: Span<'a>| {
let (s, _) = symbol("{")(s)?;
let (s, x) = f(s)?;
let (s, _) = symbol("}")(s)?;
Ok((s, x))
}
}
pub fn apostrophe_brace<'a, O, F>(f: F) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O>
where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,
{
move |s: Span<'a>| {
let (s, _) = symbol("'{")(s)?;
let (s, x) = f(s)?;
let (s, _) = symbol("}")(s)?;
Ok((s, x))
}
}
pub fn rec<'a, O, F>(f: F, id: u32) -> impl Fn(Span<'a>) -> IResult<Span<'a>, O>
where
F: Fn(Span<'a>) -> IResult<Span<'a>, O>,