Skip to content

Commit

Permalink
refactor(parser): Update signature for 'Target::rest'
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 6, 2024
1 parent 6a01c41 commit b017d2c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions rinja_parser/src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ impl<'a> Target<'a> {
}

fn unnamed(i: &mut &'a str, s: &State<'_>) -> ParseResult<'a, Self> {
alt((unpeek(Self::rest), unpeek(|i| Self::parse(i, s)))).parse_next(i)
alt((Self::rest, unpeek(|i| Self::parse(i, s)))).parse_next(i)
}

fn named(i: &mut &'a str, s: &State<'_>) -> ParseResult<'a, (&'a str, Self)> {
let start = *i;
let rest = opt(unpeek(Self::rest).with_recognized()).parse_next(i)?;
let rest = opt(Self::rest.with_recognized()).parse_next(i)?;
if let Some(rest) = rest {
let chr = peek(ws(opt(one_of([',', ':'])))).parse_next(i)?;
if let Some(chr) = chr {
Expand Down Expand Up @@ -186,13 +186,13 @@ impl<'a> Target<'a> {
Ok((src, target))
}

fn rest(i: &'a str) -> InputParseResult<'a, Self> {
let start = i;
let (i, (ident, _)) = (opt((identifier, ws('@'))), "..").parse_peek(i)?;
Ok((
i,
Self::Rest(WithSpan::new(ident.map(|(ident, _)| ident), start)),
))
fn rest(i: &mut &'a str) -> ParseResult<'a, Self> {
let start = *i;
let (ident, _) = (opt((identifier, ws('@'))), "..").parse_next(i)?;
Ok(Self::Rest(WithSpan::new(
ident.map(|(ident, _)| ident),
start,
)))
}
}

Expand Down

0 comments on commit b017d2c

Please sign in to comment.