sv_parser_parser/specify_section/
specify_block_declaration.rs

1use crate::*;
2
3// -----------------------------------------------------------------------------
4
5#[tracable_parser]
6#[packrat_parser]
7pub(crate) fn specify_block(s: Span) -> IResult<Span, SpecifyBlock> {
8    let (s, a) = keyword("specify")(s)?;
9    let (s, (b, c)) = many_till(specify_item, keyword("endspecify"))(s)?;
10    Ok((s, SpecifyBlock { nodes: (a, b, c) }))
11}
12
13#[tracable_parser]
14#[packrat_parser]
15pub(crate) fn specify_item(s: Span) -> IResult<Span, SpecifyItem> {
16    alt((
17        map(specparam_declaration, |x| {
18            SpecifyItem::SpecparamDeclaration(Box::new(x))
19        }),
20        map(pulsestyle_declaration, |x| {
21            SpecifyItem::PulsestyleDeclaration(Box::new(x))
22        }),
23        map(showcancelled_declaration, |x| {
24            SpecifyItem::ShowcancelledDeclaration(Box::new(x))
25        }),
26        map(path_declaration, |x| {
27            SpecifyItem::PathDeclaration(Box::new(x))
28        }),
29        map(system_timing_check, |x| {
30            SpecifyItem::SystemTimingCheck(Box::new(x))
31        }),
32    ))(s)
33}
34
35#[tracable_parser]
36#[packrat_parser]
37pub(crate) fn pulsestyle_declaration(s: Span) -> IResult<Span, PulsestyleDeclaration> {
38    let (s, a) = alt((
39        keyword("pulsestyle_onevent"),
40        keyword("pulsestyle_ondetect"),
41    ))(s)?;
42    let (s, b) = list_of_path_outputs(s)?;
43    let (s, c) = symbol(";")(s)?;
44    Ok((s, PulsestyleDeclaration { nodes: (a, b, c) }))
45}
46
47#[tracable_parser]
48#[packrat_parser]
49pub(crate) fn showcancelled_declaration(s: Span) -> IResult<Span, ShowcancelledDeclaration> {
50    let (s, a) = alt((keyword("showcancelled"), keyword("noshowcancelled")))(s)?;
51    let (s, b) = list_of_path_outputs(s)?;
52    let (s, c) = symbol(";")(s)?;
53    Ok((s, ShowcancelledDeclaration { nodes: (a, b, c) }))
54}