macro_rules! braces {
($i:expr, $submac:ident!( $($args:tt)* )) => { ... };
($i:expr, $f:expr) => { ... };
}Expand description
Parse inside of { } curly braces.
This macro parses a set of balanced braces and invokes a sub-parser on the content inside. The sub-parser is required to consume all tokens within the braces in order for this parser to return successfully.
- Syntax:
braces!(CONTENT) - Output:
(token::Brace, CONTENT)
#[macro_use]
extern crate syn;
use syn::Expr;
use syn::token::Brace;
/// Parses an expression inside of braces.
///
/// Example: `{1 + 1}`
named!(expr_paren -> (Brace, Expr), braces!(syn!(Expr)));This macro is available if Syn is built with the "parsing" feature.