Fix attributes on final expressions in blocks
diff --git a/src/expr.rs b/src/expr.rs
index f0e456b..1356fa8 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -1814,11 +1814,18 @@
named!(pub parse_within -> Vec<Stmt>, do_parse!(
many0!(syn!(Semi)) >>
mut standalone: many0!(terminated!(syn!(Stmt), many0!(syn!(Semi)))) >>
- last: option!(syn!(Expr)) >>
+ last: option!(do_parse!(
+ attrs: many0!(call!(Attribute::parse_outer)) >>
+ mut e: syn!(Expr) >>
+ ({
+ e.attrs = attrs;
+ Stmt::Expr(Box::new(e))
+ })
+ )) >>
(match last {
None => standalone,
Some(last) => {
- standalone.push(Stmt::Expr(Box::new(last)));
+ standalone.push(last);
standalone
}
})
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..b3ca662
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,11 @@
+extern crate syn;
+
+use std::io::{self, Read};
+
+fn main() {
+ // let mut input = String::new();
+ // io::stdin().read_to_string(&mut input).unwrap();
+ //
+ // syn::parse_str::<syn::File>(&input).unwrap();
+
+}