Skip to content

Commit

Permalink
Use SmallVector for eof and bb eis.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Nov 12, 2016
1 parent b8d6686 commit 6046595
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/libsyntax/ext/tt/macro_parser.rs
Expand Up @@ -279,8 +279,8 @@ fn create_matches(len: usize) -> Vec<Vec<Rc<NamedMatch>>> {

fn inner_parse_loop(cur_eis: &mut SmallVector<Box<MatcherPos>>,
next_eis: &mut Vec<Box<MatcherPos>>,
eof_eis: &mut Vec<Box<MatcherPos>>,
bb_eis: &mut Vec<Box<MatcherPos>>,
eof_eis: &mut SmallVector<Box<MatcherPos>>,
bb_eis: &mut SmallVector<Box<MatcherPos>>,
token: &Token, span: &syntax_pos::Span) -> ParseResult<()> {
while let Some(mut ei) = cur_eis.pop() {
// When unzipped trees end, remove them
Expand Down Expand Up @@ -412,12 +412,10 @@ pub fn parse(sess: &ParseSess, rdr: TtReader, ms: &[TokenTree]) -> NamedParseRes
let mut cur_eis = SmallVector::one(initial_matcher_pos(ms.to_owned(), parser.span.lo));

loop {
let mut bb_eis = Vec::new(); // black-box parsed by parser.rs
let mut bb_eis = SmallVector::new(); // black-box parsed by parser.rs
let mut eof_eis = SmallVector::new();
let mut next_eis = Vec::new(); // or proceed normally

// FIXME: Use SmallVector since in the successful case we will only have one
let mut eof_eis = Vec::new();

match inner_parse_loop(&mut cur_eis, &mut next_eis, &mut eof_eis, &mut bb_eis,
&parser.token, &parser.span) {
Success(_) => {},
Expand Down

0 comments on commit 6046595

Please sign in to comment.