sv_parser_parser/instantiations/
checker_instantiation.rs1use crate::*;
2
3#[tracable_parser]
6#[packrat_parser]
7pub(crate) fn checker_instantiation(s: Span) -> IResult<Span, CheckerInstantiation> {
8 let (s, a) = ps_checker_identifier(s)?;
9 let (s, b) = name_of_instance(s)?;
10 let (s, c) = paren(opt(list_of_checker_port_connections))(s)?;
11 let (s, d) = symbol(";")(s)?;
12 Ok((
13 s,
14 CheckerInstantiation {
15 nodes: (a, b, c, d),
16 },
17 ))
18}
19
20#[tracable_parser]
21#[packrat_parser]
22pub(crate) fn list_of_checker_port_connections(
23 s: Span,
24) -> IResult<Span, ListOfCheckerPortConnections> {
25 alt((
26 list_of_checker_port_connections_named,
27 list_of_checker_port_connections_ordered,
28 ))(s)
29}
30
31#[recursive_parser]
32#[tracable_parser]
33#[packrat_parser]
34pub(crate) fn list_of_checker_port_connections_ordered(
35 s: Span,
36) -> IResult<Span, ListOfCheckerPortConnections> {
37 let (s, a) = list(symbol(","), ordered_checker_port_connection)(s)?;
38 Ok((
39 s,
40 ListOfCheckerPortConnections::Ordered(Box::new(ListOfCheckerPortConnectionsOrdered {
41 nodes: (a,),
42 })),
43 ))
44}
45
46#[tracable_parser]
47#[packrat_parser]
48pub(crate) fn list_of_checker_port_connections_named(
49 s: Span,
50) -> IResult<Span, ListOfCheckerPortConnections> {
51 let (s, a) = list(symbol(","), named_checker_port_connection)(s)?;
52 Ok((
53 s,
54 ListOfCheckerPortConnections::Named(Box::new(ListOfCheckerPortConnectionsNamed {
55 nodes: (a,),
56 })),
57 ))
58}
59
60#[recursive_parser]
61#[tracable_parser]
62#[packrat_parser]
63pub(crate) fn ordered_checker_port_connection(
64 s: Span,
65) -> IResult<Span, OrderedCheckerPortConnection> {
66 let (s, x) = many0(attribute_instance)(s)?;
67 let (s, y) = opt(property_actual_arg)(s)?;
68 Ok((s, OrderedCheckerPortConnection { nodes: (x, y) }))
69}
70
71#[tracable_parser]
72#[packrat_parser]
73pub(crate) fn named_checker_port_connection(s: Span) -> IResult<Span, NamedCheckerPortConnection> {
74 alt((
75 named_checker_port_connection_identifier,
76 named_checker_port_connection_asterisk,
77 ))(s)
78}
79
80#[tracable_parser]
81#[packrat_parser]
82pub(crate) fn named_checker_port_connection_identifier(
83 s: Span,
84) -> IResult<Span, NamedCheckerPortConnection> {
85 let (s, (a, b)) = many_till(attribute_instance, symbol("."))(s)?;
86 let (s, c) = formal_port_identifier(s)?;
87 let (s, d) = opt(paren(opt(property_actual_arg)))(s)?;
88 Ok((
89 s,
90 NamedCheckerPortConnection::Identifier(Box::new(NamedCheckerPortConnectionIdentifier {
91 nodes: (a, b, c, d),
92 })),
93 ))
94}
95
96#[tracable_parser]
97#[packrat_parser]
98pub(crate) fn named_checker_port_connection_asterisk(
99 s: Span,
100) -> IResult<Span, NamedCheckerPortConnection> {
101 let (s, (a, b)) = many_till(attribute_instance, symbol(".*"))(s)?;
102 Ok((
103 s,
104 NamedCheckerPortConnection::Asterisk(Box::new(NamedCheckerPortConnectionAsterisk {
105 nodes: (a, b),
106 })),
107 ))
108}