Parse types
diff --git a/src/parse.rs b/src/parse.rs
index c87ad9f..64f972d 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -115,7 +115,9 @@
return false;
}
let ahead = self.fork();
- ahead.step_cursor(|cursor| Ok(cursor.token_tree().unwrap())).unwrap();
+ ahead
+ .step_cursor(|cursor| Ok(cursor.token_tree().unwrap()))
+ .unwrap();
ahead.peek(token)
}
@@ -124,8 +126,12 @@
return false;
}
let ahead = self.fork();
- ahead.step_cursor(|cursor| Ok(cursor.token_tree().unwrap())).unwrap();
- ahead.step_cursor(|cursor| Ok(cursor.token_tree().unwrap())).unwrap();
+ ahead
+ .step_cursor(|cursor| Ok(cursor.token_tree().unwrap()))
+ .unwrap();
+ ahead
+ .step_cursor(|cursor| Ok(cursor.token_tree().unwrap()))
+ .unwrap();
ahead.peek(token)
}
@@ -216,6 +222,12 @@
}
}
+impl<T: Parse> Parse for Box<T> {
+ fn parse(input: ParseStream) -> Result<Self> {
+ input.parse().map(Box::new)
+ }
+}
+
impl<T: Parse + Token> Parse for Option<T> {
fn parse(input: ParseStream) -> Result<Self> {
if T::peek(&input.lookahead1()) {