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
use crate::annotation;
use crate::parser::{Parse, Parser, Result};
use crate::token::Span;
#[derive(Debug)]
pub struct Custom<'a> {
pub span: Span,
pub name: &'a str,
pub data: Vec<&'a [u8]>,
}
impl<'a> Parse<'a> for Custom<'a> {
fn parse(parser: Parser<'a>) -> Result<Self> {
let span = parser.parse::<annotation::custom>()?.0;
let name = parser.parse()?;
let mut data = Vec::new();
while !parser.is_empty() {
data.push(parser.parse()?);
}
Ok(Self { span, name, data })
}
}