Skip to main content

parse_r_macro_input

Function parse_r_macro_input 

Source
fn parse_r_macro_input(
    input: TokenStream,
) -> Result<(Option<TokenStream>, TokenStream), Error>
Expand description

Parse the r!(...) input into an optional env expression and the tail token stream.

Grammar: [env: <Expr> ;] <tail_tokens...>

The env: head is identified by the leading env ident followed by :. The <Expr> is parsed greedily up to the first top-level ; token (matching the macro_rules! contract: env: $env:expr; $($code:tt)+ where $env:expr consumes greedily until the ;).

After the ;, the remaining tokens form the tail.