diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-01-13 04:49:20 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-01-17 08:17:26 +0000 |
| commit | debcbf0b8e8fcf6f1d44e8f79cc06c0866d8d1dd (patch) | |
| tree | f61d8ca01c5e888b1f18e25dcb516d80a54b875d /src/libsyntax/ext/tt/macro_parser.rs | |
| parent | de46b247585999ae70674f1fa0543d62f2889c7f (diff) | |
| download | rust-debcbf0b8e8fcf6f1d44e8f79cc06c0866d8d1dd.tar.gz rust-debcbf0b8e8fcf6f1d44e8f79cc06c0866d8d1dd.zip | |
Refactor the parser to consume token trees.
Diffstat (limited to 'src/libsyntax/ext/tt/macro_parser.rs')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 2de31166070..46ffc93d2ee 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -82,7 +82,6 @@ use ast::Ident; use syntax_pos::{self, BytePos, mk_sp, Span}; use codemap::Spanned; use errors::FatalError; -use parse::lexer::*; //resolve bug? use parse::{Directory, ParseSess}; use parse::parser::{PathStyle, Parser}; use parse::token::{DocComment, MatchNt, SubstNt}; @@ -407,9 +406,9 @@ fn inner_parse_loop(cur_eis: &mut SmallVector<Box<MatcherPos>>, Success(()) } -pub fn parse(sess: &ParseSess, rdr: TtReader, ms: &[TokenTree], directory: Option<Directory>) +pub fn parse(sess: &ParseSess, tts: Vec<TokenTree>, ms: &[TokenTree], directory: Option<Directory>) -> NamedParseResult { - let mut parser = Parser::new(sess, Box::new(rdr), directory, true); + let mut parser = Parser::new(sess, tts, directory, true); let mut cur_eis = SmallVector::one(initial_matcher_pos(ms.to_owned(), parser.span.lo)); let mut next_eis = Vec::new(); // or proceed normally @@ -527,7 +526,7 @@ fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal { "ident" => match p.token { token::Ident(sn) => { p.bump(); - token::NtIdent(Spanned::<Ident>{node: sn, span: p.span}) + token::NtIdent(Spanned::<Ident>{node: sn, span: p.prev_span}) } _ => { let token_str = pprust::token_to_string(&p.token); |
