[][src]Macro lip::chain

macro_rules! chain {
    ($single_parser:expr) => { ... };
    ($first_parser:expr, $($parsers:expr),+) => { ... };
}

Chain several parsers together and parse them in sequence.

Example:

assert_eq!(
  chain!(token("a"), token("b"), token("c")).parse("abc", Location { row: 1, col: 1 }, ()),
  ParseResult::ParseOk {
    input: "",
    location: Location { row: 1, col: 4 },
    output: ("a", ("b", "c")),
    state: (),
  }
);

The above example parses the letters "a", "b", and "c" in sequence and returns a nested tuple ("a", ("b", "c")) containing each of the parser outputs.