summaryrefslogtreecommitdiff
path: root/dhall_proc_macros/src/parser.rs
diff options
context:
space:
mode:
authorNadrieril2019-09-01 22:46:03 +0200
committerNadrieril2019-09-01 22:46:03 +0200
commit3e9aa3e46bd5906469751c908a0daedfe26dac22 (patch)
tree68b3bf8e798e36029b5044a166d8570db93fbe2d /dhall_proc_macros/src/parser.rs
parent1baef509afe52ab285e73469fc597de8f4e166b6 (diff)
Make make_parser into a proc_macro_attribute
That way rustfmt will format the contents of the parser.
Diffstat (limited to '')
-rw-r--r--dhall_proc_macros/src/parser.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/dhall_proc_macros/src/parser.rs b/dhall_proc_macros/src/parser.rs
index 2618bec..1c75279 100644
--- a/dhall_proc_macros/src/parser.rs
+++ b/dhall_proc_macros/src/parser.rs
@@ -4,8 +4,8 @@ use syn::parse::{Parse, ParseStream, Result};
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::{
- bracketed, parenthesized, parse_quote, token, Error, Expr, Ident, ItemFn,
- Pat, ReturnType, Token, Type,
+ braced, bracketed, parenthesized, parse_quote, token, Error, Expr, Ident,
+ ItemFn, Pat, ReturnType, Token, Type,
};
mod rule_kw {
@@ -58,9 +58,13 @@ struct ParseChildrenInput {
impl Parse for Rules {
fn parse(input: ParseStream) -> Result<Self> {
+ let _: Token![impl ] = input.parse()?;
+ let _: Token![_] = input.parse()?;
+ let contents;
+ braced!(contents in input);
let mut rules = Vec::new();
- while !input.is_empty() {
- rules.push(input.parse()?)
+ while !contents.is_empty() {
+ rules.push(contents.parse()?)
}
Ok(Rules(rules))
}