Restrict grammer of 2.0 macros
The arguments must be parenthesized and the body must be braced.
diff --git a/src/mac.rs b/src/mac.rs
index f093a8c..2316506 100644
--- a/src/mac.rs
+++ b/src/mac.rs
@@ -170,16 +170,13 @@
pub mod parsing {
use super::*;
- use proc_macro2::{TokenNode, TokenTree};
use synom::Synom;
- use cursor::Cursor;
- use {parse_error, PResult};
impl Synom for Macro {
named!(parse -> Self, do_parse!(
what: syn!(Path) >>
bang: punct!(!) >>
- body: call!(parse_tt_delimited) >>
+ body: call!(tt::delimited) >>
(Macro {
path: what,
bang_token: bang,
@@ -187,19 +184,6 @@
})
));
}
-
- pub fn parse_tt_delimited(input: Cursor) -> PResult<TokenTree> {
- match input.token_tree() {
- Some((
- rest,
- token @ TokenTree {
- kind: TokenNode::Group(..),
- ..
- },
- )) => Ok((rest, token)),
- _ => parse_error(),
- }
- }
}
#[cfg(feature = "printing")]