Macro syn::parens[][src]

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

Parse inside of ( ) parentheses.

This macro parses a set of balanced parentheses and invokes a sub-parser on the content inside. The sub-parser is required to consume all tokens within the parentheses in order for this parser to return successfully.

  • Syntax: parens!(CONTENT)
  • Output: (token::Paren, CONTENT)
#[macro_use]
extern crate syn;

use syn::Expr;
use syn::token::Paren;

/// Parses an expression inside of parentheses.
///
/// Example: `(1 + 1)`
named!(expr_paren -> (Paren, Expr), parens!(syn!(Expr)));

This macro is available if Syn is built with the "parsing" feature.