diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2015-10-23 18:37:21 -0700 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2015-10-27 20:09:10 -0700 |
| commit | c141f47c2449a2f70e6d199104eb318b083def2a (patch) | |
| tree | d99b724dd466b80e5134f10ef4c1d527d62747c8 /src/libsyntax/parse | |
| parent | 1dd87dcfeaec795f67ddfeca58e13d9eed909684 (diff) | |
| download | rust-c141f47c2449a2f70e6d199104eb318b083def2a.tar.gz rust-c141f47c2449a2f70e6d199104eb318b083def2a.zip | |
Delete unnecessary ParserAttr trait.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 25 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 1 |
3 files changed, 4 insertions, 23 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 219360093d1..570c232ff4e 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -16,19 +16,9 @@ use parse::token; use parse::parser::{Parser, TokenType}; use ptr::P; -/// A parser that can parse attributes. -pub trait ParserAttr { - fn parse_outer_attributes(&mut self) -> Vec<ast::Attribute>; - fn parse_inner_attributes(&mut self) -> Vec<ast::Attribute>; - fn parse_attribute(&mut self, permit_inner: bool) -> ast::Attribute; - fn parse_meta_item(&mut self) -> P<ast::MetaItem>; - fn parse_meta_seq(&mut self) -> Vec<P<ast::MetaItem>>; - fn parse_optional_meta(&mut self) -> Vec<P<ast::MetaItem>>; -} - -impl<'a> ParserAttr for Parser<'a> { +impl<'a> Parser<'a> { /// Parse attributes that appear before an item - fn parse_outer_attributes(&mut self) -> Vec<ast::Attribute> { + pub fn parse_outer_attributes(&mut self) -> Vec<ast::Attribute> { let mut attrs: Vec<ast::Attribute> = Vec::new(); loop { debug!("parse_outer_attributes: self.token={:?}", @@ -120,7 +110,7 @@ impl<'a> ParserAttr for Parser<'a> { /// terminated by a semicolon. /// matches inner_attrs* - fn parse_inner_attributes(&mut self) -> Vec<ast::Attribute> { + pub fn parse_inner_attributes(&mut self) -> Vec<ast::Attribute> { let mut attrs: Vec<ast::Attribute> = vec![]; loop { match self.token { @@ -155,7 +145,7 @@ impl<'a> ParserAttr for Parser<'a> { /// matches meta_item = IDENT /// | IDENT = lit /// | IDENT meta_seq - fn parse_meta_item(&mut self) -> P<ast::MetaItem> { + pub fn parse_meta_item(&mut self) -> P<ast::MetaItem> { let nt_meta = match self.token { token::Interpolated(token::NtMeta(ref e)) => { Some(e.clone()) @@ -210,11 +200,4 @@ impl<'a> ParserAttr for Parser<'a> { seq_sep_trailing_allowed(token::Comma), |p| Ok(p.parse_meta_item()))).node } - - fn parse_optional_meta(&mut self) -> Vec<P<ast::MetaItem>> { - match self.token { - token::OpenDelim(token::Paren) => self.parse_meta_seq(), - _ => Vec::new() - } - } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 2275d95c7c2..017a910b08a 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -13,7 +13,6 @@ use ast; use codemap::{self, Span, CodeMap, FileMap}; use diagnostic::{SpanHandler, Handler, Auto, FatalError}; -use parse::attr::ParserAttr; use parse::parser::Parser; use parse::token::InternedString; use ptr::P; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6afcd61aa3d..0b2369c00ac 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -64,7 +64,6 @@ use codemap::{self, Span, BytePos, Spanned, spanned, mk_sp, CodeMap}; use diagnostic; use ext::tt::macro_parser; use parse; -use parse::attr::ParserAttr; use parse::classify; use parse::common::{SeqSep, seq_sep_none, seq_sep_trailing_allowed}; use parse::lexer::{Reader, TokenAndSpan}; |
