mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2025-09-25 07:51:30 +02:00
start with bare basics
This commit is contained in:
commit
b71b7f309b
10 changed files with 712 additions and 0 deletions
13
src/utils.rs
Normal file
13
src/utils.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
use winnow::ascii::space0;
|
||||
// from https://docs.rs/winnow/latest/winnow/_topic/language/index.html#whitespace
|
||||
use winnow::prelude::*;
|
||||
use winnow::{ascii::multispace0, combinator::delimited, error::ParserError};
|
||||
|
||||
/// A combinator that takes a parser `inner` and produces a parser that also consumes both leading and
|
||||
/// trailing whitespace, returning the output of `inner`.
|
||||
pub fn ws<'a, F, O, E: ParserError<&'a str>>(inner: F) -> impl Parser<&'a str, O, E>
|
||||
where
|
||||
F: Parser<&'a str, O, E>,
|
||||
{
|
||||
delimited(space0, inner, space0)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue