sv_parser_parser/udp_declaration_and_instantiation/
udp_instantiation.rs

1use crate::*;
2
3// -----------------------------------------------------------------------------
4
5#[tracable_parser]
6#[packrat_parser]
7pub(crate) fn udp_instantiation(s: Span) -> IResult<Span, UdpInstantiation> {
8    let (s, a) = udp_identifier(s)?;
9    let (s, b) = opt(drive_strength)(s)?;
10    let (s, c) = opt(delay2)(s)?;
11    let (s, d) = list(symbol(","), udp_instance)(s)?;
12    let (s, e) = symbol(";")(s)?;
13    Ok((
14        s,
15        UdpInstantiation {
16            nodes: (a, b, c, d, e),
17        },
18    ))
19}
20
21#[tracable_parser]
22#[packrat_parser]
23pub(crate) fn udp_instance(s: Span) -> IResult<Span, UdpInstance> {
24    let (s, a) = opt(name_of_instance)(s)?;
25    let (s, b) = paren(tuple((
26        output_terminal,
27        symbol(","),
28        input_terminal,
29        many0(pair(symbol(","), input_terminal)),
30    )))(s)?;
31    Ok((s, UdpInstance { nodes: (a, b) }))
32}