diff options
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 112 | 
1 files changed, 4 insertions, 108 deletions
| diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ead0de78f6e..625ff289607 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -54,8 +54,8 @@ use ast::{_mod, add, arg, arm, attribute, item_foreign_mod, item_impl, item_mac, item_mod, item_trait, item_ty, lit, lit_, lit_bool, lit_float, lit_float_unsuffixed, lit_int, lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, - m_const, m_imm, m_mutbl, mac_, mac_aq, mac_ellipsis, mac_invoc, - mac_invoc_tt, mac_var, matcher, match_nonterminal, match_seq, + m_const, m_imm, m_mutbl, mac_, + mac_invoc_tt, matcher, match_nonterminal, match_seq, match_tok, method, mode, module_ns, mt, mul, mutability, named_field, neg, noreturn, not, pat, pat_box, pat_enum, pat_ident, pat_lit, pat_range, pat_rec, pat_region, pat_struct, @@ -510,15 +510,6 @@ impl Parser { let lo = self.span.lo; - match self.maybe_parse_dollar_mac() { - Some(ref e) => { - return @{id: self.get_id(), - node: ty_mac(spanned(lo, self.span.hi, (*e))), - span: mk_sp(lo, self.span.hi)}; - } - None => () - } - let t = if self.token == token::LPAREN { self.bump(); if self.token == token::RPAREN { @@ -730,32 +721,6 @@ impl Parser { } } - fn maybe_parse_dollar_mac() -> Option<mac_> { - match copy self.token { - token::DOLLAR => { - let lo = self.span.lo; - self.bump(); - match copy self.token { - token::LIT_INT_UNSUFFIXED(num) => { - self.bump(); - Some(mac_var(num as uint)) - } - token::LPAREN => { - self.bump(); - let e = self.parse_expr(); - self.expect(token::RPAREN); - let hi = self.last_span.hi; - Some(mac_aq(mk_sp(lo,hi), e)) - } - _ => { - self.fatal(~"expected `(` or unsuffixed integer literal"); - } - } - } - _ => None - } - } - fn maybe_parse_fixed_vstore_with_star() -> Option<uint> { if self.eat(token::BINOP(token::STAR)) { match copy self.token { @@ -928,11 +893,6 @@ impl Parser { let mut ex: expr_; - match self.maybe_parse_dollar_mac() { - Some(ref x) => return self.mk_mac_expr(lo, self.span.hi, (*x)), - _ => () - } - if self.token == token::LPAREN { self.bump(); if self.token == token::RPAREN { @@ -1022,13 +982,6 @@ impl Parser { } } hi = self.span.hi; - } else if self.token == token::ELLIPSIS { - self.bump(); - return self.mk_mac_expr(lo, self.span.hi, mac_ellipsis); - } else if self.token == token::POUND { - let ex_ext = self.parse_syntax_ext(); - hi = ex_ext.span.hi; - ex = ex_ext.node; } else if self.eat_keyword(~"fail") { if can_begin_expr(self.token) { let e = self.parse_expr(); @@ -1141,54 +1094,6 @@ impl Parser { return self.mk_expr(blk.span.lo, blk.span.hi, expr_block(blk)); } - fn parse_syntax_ext() -> @expr { - let lo = self.span.lo; - self.expect(token::POUND); - return self.parse_syntax_ext_naked(lo); - } - - fn parse_syntax_ext_naked(lo: BytePos) -> @expr { - match self.token { - token::IDENT(_, _) => (), - _ => self.fatal(~"expected a syntax expander name") - } - let pth = self.parse_path_without_tps(); - //temporary for a backwards-compatible cycle: - let sep = seq_sep_trailing_disallowed(token::COMMA); - let mut e = None; - if (self.token == token::LPAREN || self.token == token::LBRACKET) { - let lo = self.span.lo; - let es = - if self.token == token::LPAREN { - self.parse_unspanned_seq(token::LPAREN, token::RPAREN, - sep, |p| p.parse_expr()) - } else { - self.parse_unspanned_seq(token::LBRACKET, token::RBRACKET, - sep, |p| p.parse_expr()) - }; - let hi = self.span.hi; - e = Some(self.mk_expr(lo, hi, expr_vec(es, m_imm))); - } - let mut b = None; - if self.token == token::LBRACE { - self.bump(); - let lo = self.span.lo; - let mut depth = 1u; - while (depth > 0u) { - match (self.token) { - token::LBRACE => depth += 1u, - token::RBRACE => depth -= 1u, - token::EOF => self.fatal(~"unexpected EOF in macro body"), - _ => () - } - self.bump(); - } - let hi = self.last_span.lo; - b = Some({span: mk_sp(lo,hi)}); - } - return self.mk_mac_expr(lo, self.span.hi, mac_invoc(pth, e, b)); - } - fn parse_dot_or_call_expr() -> @expr { let b = self.parse_bottom_expr(); self.parse_dot_or_call_expr_with(b) @@ -2253,17 +2158,8 @@ impl Parser { } } else { - let mut item_attrs; - match self.parse_outer_attrs_or_ext(first_item_attrs) { - None => item_attrs = ~[], - Some(Left(ref attrs)) => item_attrs = (*attrs), - Some(Right(ext)) => { - return @spanned(lo, ext.span.hi, - stmt_expr(ext, self.get_id())); - } - } - - let item_attrs = vec::append(first_item_attrs, item_attrs); + let item_attrs = vec::append(first_item_attrs, + self.parse_outer_attributes()); match self.parse_item_or_view_item(item_attrs, true, false, false) { | 
