1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
use crate::*;

// -----------------------------------------------------------------------------

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_defparam_assignments(s: Span) -> IResult<Span, ListOfDefparamAssignments> {
    let (s, a) = list(symbol(","), defparam_assignment)(s)?;
    Ok((s, ListOfDefparamAssignments { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_genvar_identifiers(s: Span) -> IResult<Span, ListOfGenvarIdentifiers> {
    let (s, a) = list(symbol(","), genvar_identifier)(s)?;
    Ok((s, ListOfGenvarIdentifiers { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_interface_identifiers(s: Span) -> IResult<Span, ListOfInterfaceIdentifiers> {
    let (s, a) = list(
        symbol(","),
        pair(interface_identifier, many0(unpacked_dimension)),
    )(s)?;
    Ok((s, ListOfInterfaceIdentifiers { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_net_decl_assignments(s: Span) -> IResult<Span, ListOfNetDeclAssignments> {
    let (s, a) = list(symbol(","), net_decl_assignment)(s)?;
    Ok((s, ListOfNetDeclAssignments { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_param_assignments(s: Span) -> IResult<Span, ListOfParamAssignments> {
    let (s, a) = list(symbol(","), param_assignment)(s)?;
    Ok((s, ListOfParamAssignments { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_port_identifiers(s: Span) -> IResult<Span, ListOfPortIdentifiers> {
    let (s, a) = list(
        symbol(","),
        pair(port_identifier, many0(unpacked_dimension)),
    )(s)?;
    Ok((s, ListOfPortIdentifiers { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_udp_port_identifiers(s: Span) -> IResult<Span, ListOfUdpPortIdentifiers> {
    let (s, a) = list(symbol(","), port_identifier)(s)?;
    Ok((s, ListOfUdpPortIdentifiers { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_specparam_assignments(s: Span) -> IResult<Span, ListOfSpecparamAssignments> {
    let (s, a) = list(symbol(","), specparam_assignment)(s)?;
    Ok((s, ListOfSpecparamAssignments { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_tf_variable_identifiers(
    s: Span,
) -> IResult<Span, ListOfTfVariableIdentifiers> {
    let (s, a) = list(
        symbol(","),
        triple(
            port_identifier,
            many0(variable_dimension),
            opt(pair(symbol("="), expression)),
        ),
    )(s)?;
    Ok((s, ListOfTfVariableIdentifiers { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_type_assignments(s: Span) -> IResult<Span, ListOfTypeAssignments> {
    let (s, a) = list(
        symbol(","),
        terminated(
            type_assignment,
            peek(alt((symbol(","), symbol(")"), symbol(";")))),
        ),
    )(s)?;
    Ok((s, ListOfTypeAssignments { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_variable_decl_assignments(
    s: Span,
) -> IResult<Span, ListOfVariableDeclAssignments> {
    let (s, a) = list(symbol(","), variable_decl_assignment)(s)?;
    Ok((s, ListOfVariableDeclAssignments { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_variable_identifiers(s: Span) -> IResult<Span, ListOfVariableIdentifiers> {
    let (s, a) = list(
        symbol(","),
        pair(variable_identifier, many0(variable_dimension)),
    )(s)?;
    Ok((s, ListOfVariableIdentifiers { nodes: (a,) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn list_of_variable_port_identifiers(
    s: Span,
) -> IResult<Span, ListOfVariablePortIdentifiers> {
    let (s, a) = list(
        symbol(","),
        triple(
            port_identifier,
            many0(variable_dimension),
            opt(pair(symbol("="), constant_expression)),
        ),
    )(s)?;
    Ok((s, ListOfVariablePortIdentifiers { nodes: (a,) }))
}