diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2014-08-06 11:59:40 +0200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2014-08-26 16:07:32 +1200 |
| commit | 52ef46251ede1ff51e5d5621d5fe2614e950f963 (patch) | |
| tree | 481371289f467bc89a6d6dc769635dac1d47a6cb /src/libsyntax/parse | |
| parent | 3e626375d8d2226a203bf6ea6e98dab14774c59f (diff) | |
| download | rust-52ef46251ede1ff51e5d5621d5fe2614e950f963.tar.gz rust-52ef46251ede1ff51e5d5621d5fe2614e950f963.zip | |
Rebasing changes
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 00513f7f67c..01de001c043 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -61,7 +61,7 @@ use ast::{UnsafeFn, ViewItem, ViewItem_, ViewItemExternCrate, ViewItemUse}; use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple}; use ast::{Visibility, WhereClause, WherePredicate}; use ast; -use ast_util::{as_prec, ident_to_path, lit_is_str, operator_prec}; +use ast_util::{as_prec, ident_to_path, operator_prec}; use ast_util; use attr; use codemap::{Span, BytePos, Spanned, spanned, mk_sp}; @@ -2577,21 +2577,24 @@ impl<'a> Parser<'a> { ex = self.mk_unary(UnUniq, e); } token::IDENT(_, _) => { - if self.is_keyword(keywords::Box) { - self.bump(); + if !self.is_keyword(keywords::Box) { + return self.parse_dot_or_call_expr(); + } - // Check for a place: `box(PLACE) EXPR`. - if self.eat(&token::LPAREN) { - // Support `box() EXPR` as the default. - if !self.eat(&token::RPAREN) { - let place = self.parse_expr(); - self.expect(&token::RPAREN); - let subexpression = self.parse_prefix_expr(); - hi = subexpression.span.hi; - ex = ExprBox(place, subexpression); - return self.mk_expr(lo, hi, ex); - } + self.bump(); + + // Check for a place: `box(PLACE) EXPR`. + if self.eat(&token::LPAREN) { + // Support `box() EXPR` as the default. + if !self.eat(&token::RPAREN) { + let place = self.parse_expr(); + self.expect(&token::RPAREN); + let subexpression = self.parse_prefix_expr(); + hi = subexpression.span.hi; + ex = ExprBox(place, subexpression); + return self.mk_expr(lo, hi, ex); } + } // Otherwise, we use the unique pointer default. let subexpression = self.parse_prefix_expr(); |
