sv_parser_parser/declarations/
block_item_declarations.rs1use crate::*;
2
3#[tracable_parser]
6#[packrat_parser]
7pub(crate) fn block_item_declaration(s: Span) -> IResult<Span, BlockItemDeclaration> {
8 alt((
9 block_item_declaration_data,
10 block_item_declaration_local_parameter,
11 block_item_declaration_parameter,
12 block_item_declaration_let,
13 ))(s)
14}
15
16#[recursive_parser]
17#[tracable_parser]
18#[packrat_parser]
19pub(crate) fn block_item_declaration_data(s: Span) -> IResult<Span, BlockItemDeclaration> {
20 let (s, a) = many0(attribute_instance)(s)?;
21 let (s, b) = data_declaration(s)?;
22 Ok((
23 s,
24 BlockItemDeclaration::Data(Box::new(BlockItemDeclarationData { nodes: (a, b) })),
25 ))
26}
27
28#[tracable_parser]
29#[packrat_parser]
30pub(crate) fn block_item_declaration_local_parameter(
31 s: Span,
32) -> IResult<Span, BlockItemDeclaration> {
33 let (s, a) = many0(attribute_instance)(s)?;
34 let (s, b) = local_parameter_declaration(s)?;
35 let (s, c) = symbol(";")(s)?;
36 Ok((
37 s,
38 BlockItemDeclaration::LocalParameter(Box::new(BlockItemDeclarationLocalParameter {
39 nodes: (a, b, c),
40 })),
41 ))
42}
43
44#[tracable_parser]
45#[packrat_parser]
46pub(crate) fn block_item_declaration_parameter(s: Span) -> IResult<Span, BlockItemDeclaration> {
47 let (s, a) = many0(attribute_instance)(s)?;
48 let (s, b) = parameter_declaration(s)?;
49 let (s, c) = symbol(";")(s)?;
50 Ok((
51 s,
52 BlockItemDeclaration::Parameter(Box::new(BlockItemDeclarationParameter {
53 nodes: (a, b, c),
54 })),
55 ))
56}
57
58#[tracable_parser]
59#[packrat_parser]
60pub(crate) fn block_item_declaration_let(s: Span) -> IResult<Span, BlockItemDeclaration> {
61 let (s, a) = many0(attribute_instance)(s)?;
62 let (s, b) = let_declaration(s)?;
63 Ok((
64 s,
65 BlockItemDeclaration::Let(Box::new(BlockItemDeclarationLet { nodes: (a, b) })),
66 ))
67}