Macro synom::terminated [] [src]

macro_rules! terminated {
    ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => { ... };
    ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => { ... };
    ($i:expr, $f:expr, $submac:ident!( $($args:tt)* )) => { ... };
    ($i:expr, $f:expr, $g:expr) => { ... };
}

Parse two things, returning the value of the first.

extern crate syn;
#[macro_use] extern crate synom;

use syn::Expr;
use syn::parse::expr;

// An expression terminated by ##.
named!(expr_pound_pound -> Expr,
    terminated!(expr, punct!("##"))
);

fn main() {
    let input = "1 + 1 ##";

    let parsed = expr_pound_pound(input).expect("expr pound pound");

    println!("{:?}", parsed);
}