use crate::ast::{ItemDef, Node};
use crate::parser::attribute::attribute_body;
use crate::parser::definition_prefix::{parse_definition_prefix, DefinitionPrefixOptions};
use crate::parser::node_from_to;
use crate::parser::Input;
use nom::IResult;
pub(crate) fn item_def(input: Input<'_>) -> IResult<Input<'_>, Node<ItemDef>> {
let start = input;
let (input, prefix) =
parse_definition_prefix(input, DefinitionPrefixOptions::new(b"item"))?;
let (input, body) = attribute_body(input)?;
Ok((
input,
node_from_to(
start,
input,
ItemDef {
identification: prefix.identification,
specializes: prefix.specializes,
specializes_span: prefix.specializes_span,
body,
},
),
))
}