sv_parser_parser/general/
attributes.rs1use crate::*;
2
3#[tracable_parser]
6#[packrat_parser]
7pub(crate) fn attribute_instance(s: Span) -> IResult<Span, AttributeInstance> {
8 let (s, a) = symbol("(*")(s)?;
9 let (s, b) = list(symbol(","), attr_spec)(s)?;
10 let (s, c) = symbol("*)")(s)?;
11 Ok((s, AttributeInstance { nodes: (a, b, c) }))
12}
13
14#[tracable_parser]
15#[packrat_parser]
16pub(crate) fn attr_spec(s: Span) -> IResult<Span, AttrSpec> {
17 let (s, a) = identifier(s)?;
18 let (s, b) = opt(pair(symbol("="), constant_expression))(s)?;
19 Ok((s, AttrSpec { nodes: (a, b) }))
20}