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