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

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

#[tracable_parser]
#[packrat_parser]
pub(crate) fn specify_block(s: Span) -> IResult<Span, SpecifyBlock> {
    let (s, a) = keyword("specify")(s)?;
    let (s, b) = many0(specify_item)(s)?;
    let (s, c) = keyword("endspecify")(s)?;
    Ok((s, SpecifyBlock { nodes: (a, b, c) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn specify_item(s: Span) -> IResult<Span, SpecifyItem> {
    alt((
        map(specparam_declaration, |x| {
            SpecifyItem::SpecparamDeclaration(Box::new(x))
        }),
        map(pulsestyle_declaration, |x| {
            SpecifyItem::PulsestyleDeclaration(Box::new(x))
        }),
        map(showcancelled_declaration, |x| {
            SpecifyItem::ShowcancelledDeclaration(Box::new(x))
        }),
        map(path_declaration, |x| {
            SpecifyItem::PathDeclaration(Box::new(x))
        }),
        map(system_timing_check, |x| {
            SpecifyItem::SystemTimingCheck(Box::new(x))
        }),
    ))(s)
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn pulsestyle_declaration(s: Span) -> IResult<Span, PulsestyleDeclaration> {
    let (s, a) = alt((
        keyword("pulsestyle_onevent"),
        keyword("pulsestyle_ondetect"),
    ))(s)?;
    let (s, b) = list_of_path_outputs(s)?;
    let (s, c) = symbol(";")(s)?;
    Ok((s, PulsestyleDeclaration { nodes: (a, b, c) }))
}

#[tracable_parser]
#[packrat_parser]
pub(crate) fn showcancelled_declaration(s: Span) -> IResult<Span, ShowcancelledDeclaration> {
    let (s, a) = alt((keyword("showcancelled"), keyword("noshowcancelled")))(s)?;
    let (s, b) = list_of_path_outputs(s)?;
    let (s, c) = symbol(";")(s)?;
    Ok((s, ShowcancelledDeclaration { nodes: (a, b, c) }))
}