[][src]Macro yarte_lexer::pipes

macro_rules! pipes {
    ($i:expr, $fun:path) => { ... };
    ($i:expr, $fun:path [ $($args:tt)* ]) => { ... };
    ($i:expr, $fun:path [ $($args:tt)* ] : $($rest:tt)+) => { ... };
    ($i:expr, $fun:path : $($rest:tt)+) => { ... };
    (impl $i:expr, $r:expr, :$pipe:path) => { ... };
    (impl $i:expr, $r:expr, :$pipe:path[$($args:tt)*]) => { ... };
    (impl $i:expr, $r:expr, :$pipe:path : $($rest:tt)+) => { ... };
    (impl $i:expr, $r:expr, :$pipe:path[$($args:tt)*] : $($rest:tt)+) => { ... };
}

Make a in tail function call

Syntax

use yarte_lexer::{pipes, ws, is_empty, map, do_parse, tac, ascii, Ascii, Cursor, get_cursor};
use yarte_lexer::error::{Empty, Result};
use std::path::PathBuf;
let path = PathBuf::from("FooFile");
const B: Ascii = ascii!('b');

let stmt = |i| pipes!(i, ws:is_empty:map[|x| !x]);
let parser = |i| do_parse!(i, ws= stmt => tac[B] => (ws));
let result: Result<bool, Empty> = parser(get_cursor(&path, " b"));
let (c, result) = result.unwrap();

assert!(result);
assert!(c.is_empty());