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
use crate::*;

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

#[tracable_parser]
#[packrat_parser]
pub(crate) fn udp_instantiation(s: Span) -> IResult<Span, UdpInstantiation> {
    let (s, a) = udp_identifier(s)?;
    let (s, b) = opt(drive_strength)(s)?;
    let (s, c) = opt(delay2)(s)?;
    let (s, d) = list(symbol(","), udp_instance)(s)?;
    let (s, e) = symbol(";")(s)?;
    Ok((
        s,
        UdpInstantiation {
            nodes: (a, b, c, d, e),
        },
    ))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn udp_instance(s: Span) -> IResult<Span, UdpInstance> {
    let (s, a) = opt(name_of_instance)(s)?;
    let (s, b) = paren(tuple((
        output_terminal,
        symbol(","),
        input_terminal,
        many0(pair(symbol(","), input_terminal)),
    )))(s)?;
    Ok((s, UdpInstance { nodes: (a, b) }))
}