Update rust syntax to 1.15.0-nightly (71c06a56a 2016-12-18)
diff --git a/src/expr.rs b/src/expr.rs
index 72922ca..1e642f8 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -116,8 +116,8 @@
/// A referencing operation (`&a` or `&mut a`)
AddrOf(Mutability, Box<Expr>),
- /// A `break`, with an optional label to break
- Break(Option<Ident>),
+ /// A `break`, with an optional label to break, and an optional expression
+ Break(Option<Ident>, Option<Box<Expr>>),
/// A `continue`, with an optional label
Continue(Option<Ident>),
/// A `return`, with an optional value to be returned
@@ -355,7 +355,7 @@
|
expr_mac // must be before expr_path
|
- expr_break // must be before expr_path
+ call!(expr_break, allow_struct) // must be before expr_path
|
expr_continue // must be before expr_path
|
@@ -720,10 +720,11 @@
(ExprKind::Continue(lbl))
));
- named!(expr_break -> ExprKind, do_parse!(
+ named_ambiguous_expr!(expr_break -> ExprKind, allow_struct, do_parse!(
keyword!("break") >>
lbl: option!(label) >>
- (ExprKind::Break(lbl))
+ val: option!(call!(ambiguous_expr, allow_struct, false)) >>
+ (ExprKind::Break(lbl, val.map(Box::new)))
));
named_ambiguous_expr!(expr_ret -> ExprKind, allow_struct, do_parse!(
@@ -865,7 +866,7 @@
named!(stmt_mac -> Stmt, do_parse!(
attrs: many0!(outer_attr) >>
- name: ident >>
+ what: path >>
punct!("!") >>
// Only parse braces here; paren and bracket will get parsed as
// expression statements
@@ -875,7 +876,7 @@
semi: option!(punct!(";")) >>
(Stmt::Mac(Box::new((
Mac {
- path: name.into(),
+ path: what,
tts: vec![TokenTree::Delimited(Delimited {
delim: DelimToken::Brace,
tts: tts,
@@ -1396,9 +1397,10 @@
mutability.to_tokens(tokens);
expr.to_tokens(tokens);
}
- ExprKind::Break(ref opt_label) => {
+ ExprKind::Break(ref opt_label, ref opt_val) => {
tokens.append("break");
opt_label.to_tokens(tokens);
+ opt_val.to_tokens(tokens);
}
ExprKind::Continue(ref opt_label) => {
tokens.append("continue");
diff --git a/src/item.rs b/src/item.rs
index a8eb737..464f9b7 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -280,7 +280,7 @@
named!(item_mac -> Item, do_parse!(
attrs: many0!(outer_attr) >>
- path: ident >>
+ what: path >>
punct!("!") >>
name: option!(ident) >>
body: delimited >>
@@ -293,7 +293,7 @@
vis: Visibility::Inherited,
attrs: attrs,
node: ItemKind::Mac(Mac {
- path: path.into(),
+ path: what,
tts: vec![TokenTree::Delimited(body)],
}),
})
@@ -821,7 +821,7 @@
named!(trait_item_mac -> TraitItem, do_parse!(
attrs: many0!(outer_attr) >>
- id: ident >>
+ what: path >>
punct!("!") >>
body: delimited >>
cond!(match body.delim {
@@ -829,10 +829,10 @@
DelimToken::Brace => false,
}, punct!(";")) >>
(TraitItem {
- ident: id.clone(),
+ ident: Ident::new(""),
attrs: attrs,
node: TraitItemKind::Macro(Mac {
- path: id.into(),
+ path: what,
tts: vec![TokenTree::Delimited(body)],
}),
})
@@ -976,7 +976,7 @@
named!(impl_item_macro -> ImplItem, do_parse!(
attrs: many0!(outer_attr) >>
- id: ident >>
+ what: path >>
punct!("!") >>
body: delimited >>
cond!(match body.delim {
@@ -984,12 +984,12 @@
DelimToken::Brace => false,
}, punct!(";")) >>
(ImplItem {
- ident: id.clone(),
+ ident: Ident::new(""),
vis: Visibility::Inherited,
defaultness: Defaultness::Final,
attrs: attrs,
node: ImplItemKind::Macro(Mac {
- path: id.into(),
+ path: what,
tts: vec![TokenTree::Delimited(body)],
}),
})
diff --git a/src/mac.rs b/src/mac.rs
index e9c942e..5a6d3f7 100644
--- a/src/mac.rs
+++ b/src/mac.rs
@@ -114,16 +114,17 @@
use super::*;
use Lifetime;
use generics::parsing::lifetime;
- use ident::parsing::{ident, word};
+ use ident::parsing::word;
use lit::parsing::lit;
use space::{block_comment, whitespace};
+ use ty::parsing::path;
named!(pub mac -> Mac, do_parse!(
- name: ident >>
+ what: path >>
punct!("!") >>
body: delimited >>
(Mac {
- path: name.into(),
+ path: what,
tts: vec![TokenTree::Delimited(body)],
})
));