[−][src]Function lip::wrap
pub fn wrap<'a, A: 'a, B: 'a, C: 'a, S: Clone + 'a, P1: 'a, P2: 'a, P3: 'a>(
left_delimiter: P1,
wrapped: P2,
right_delimiter: P3
) -> BoxedParser<'a, B, S> where
P1: Parser<'a, A, S>,
P2: Parser<'a, B, S>,
P3: Parser<'a, C, S>,
Wrap a parser with two other delimiter parsers
Example: Parsing a double-quoted string.
succeed(wrap(token("\""), take_chomped(chomp_while0(|c: &char| *c != '"', "string")), token("\"")), "\"I, have 1 string here\"", "I, have 1 string here".to_string()); fail(wrap(token("\""), take_chomped(chomp_while0(|c: &char| *c != '"', "string")), token("\"")), "\"I, have 1 string here", "I'm expecting a `\"` but found nothing.");