Skip to content

Commit

Permalink
Delete unnecessary ParserAttr trait.
Browse files Browse the repository at this point in the history
  • Loading branch information
eefriedman committed Oct 28, 2015
1 parent 1dd87dc commit c141f47
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 25 deletions.
1 change: 0 additions & 1 deletion src/libsyntax/ext/cfg.rs
Expand Up @@ -19,7 +19,6 @@ use ext::base;
use ext::build::AstBuilder;
use attr;
use attr::*;
use parse::attr::ParserAttr;
use parse::token;

pub fn expand_cfg<'cx>(cx: &mut ExtCtxt,
Expand Down
1 change: 0 additions & 1 deletion src/libsyntax/ext/tt/macro_parser.rs
Expand Up @@ -85,7 +85,6 @@ use codemap::{BytePos, mk_sp, Span};
use codemap;
use parse::lexer::*; //resolve bug?
use parse::ParseSess;
use parse::attr::ParserAttr;
use parse::parser::{LifetimeAndTypesWithoutColons, Parser};
use parse::token::{Eof, DocComment, MatchNt, SubstNt};
use parse::token::{Token, Nonterminal};
Expand Down
25 changes: 4 additions & 21 deletions src/libsyntax/parse/attr.rs
Expand Up @@ -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={:?}",
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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()
}
}
}
1 change: 0 additions & 1 deletion src/libsyntax/parse/mod.rs
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/libsyntax/parse/parser.rs
Expand Up @@ -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};
Expand Down

0 comments on commit c141f47

Please sign in to comment.