remove interner from tt_reader

This commit is contained in:
John Clements 2013-05-21 11:21:02 -07:00
parent be22fddba0
commit 19cbd0d284
5 changed files with 3 additions and 11 deletions

View file

@ -68,7 +68,6 @@ pub fn expand_proto(cx: @ExtCtxt, _sp: span, id: ast::ident,
let sess = cx.parse_sess(); let sess = cx.parse_sess();
let cfg = cx.cfg(); let cfg = cx.cfg();
let tt_rdr = new_tt_reader(copy cx.parse_sess().span_diagnostic, let tt_rdr = new_tt_reader(copy cx.parse_sess().span_diagnostic,
get_ident_interner(),
None, None,
copy tt); copy tt);
let rdr = tt_rdr as @reader; let rdr = tt_rdr as @reader;

View file

@ -29,7 +29,6 @@ pub fn expand_trace_macros(cx: @ExtCtxt,
let cfg = cx.cfg(); let cfg = cx.cfg();
let tt_rdr = new_tt_reader( let tt_rdr = new_tt_reader(
copy cx.parse_sess().span_diagnostic, copy cx.parse_sess().span_diagnostic,
get_ident_interner(),
None, None,
vec::to_owned(tt) vec::to_owned(tt)
); );

View file

@ -57,7 +57,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
// Parse the macro_rules! invocation (`none` is for no interpolations): // Parse the macro_rules! invocation (`none` is for no interpolations):
let arg_reader = new_tt_reader(copy cx.parse_sess().span_diagnostic, let arg_reader = new_tt_reader(copy cx.parse_sess().span_diagnostic,
get_ident_interner(), None, copy arg); None, copy arg);
let argument_map = parse_or_else(cx.parse_sess(), let argument_map = parse_or_else(cx.parse_sess(),
cx.cfg(), cx.cfg(),
arg_reader as @reader, arg_reader as @reader,
@ -101,7 +101,6 @@ pub fn add_new_extension(cx: @ExtCtxt,
// `none` is because we're not interpolating // `none` is because we're not interpolating
let arg_rdr = new_tt_reader( let arg_rdr = new_tt_reader(
s_d, s_d,
itr,
None, None,
vec::to_owned(arg) vec::to_owned(arg)
) as @reader; ) as @reader;
@ -122,7 +121,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
_ => cx.span_bug(sp, "bad thing in rhs") _ => cx.span_bug(sp, "bad thing in rhs")
}; };
// rhs has holes ( `$id` and `$(...)` that need filled) // rhs has holes ( `$id` and `$(...)` that need filled)
let trncbr = new_tt_reader(s_d, itr, Some(named_matches), let trncbr = new_tt_reader(s_d, Some(named_matches),
rhs); rhs);
let p = @Parser(cx.parse_sess(), let p = @Parser(cx.parse_sess(),
cx.cfg(), cx.cfg(),

View file

@ -34,7 +34,6 @@ struct TtFrame {
pub struct TtReader { pub struct TtReader {
sp_diag: @span_handler, sp_diag: @span_handler,
interner: @ident_interner,
// the unzipped tree: // the unzipped tree:
stack: @mut TtFrame, stack: @mut TtFrame,
/* for MBE-style macro transcription */ /* for MBE-style macro transcription */
@ -50,13 +49,11 @@ pub struct TtReader {
* `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and * `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and
* should) be none. */ * should) be none. */
pub fn new_tt_reader(sp_diag: @span_handler, pub fn new_tt_reader(sp_diag: @span_handler,
itr: @ident_interner,
interp: Option<HashMap<ident,@named_match>>, interp: Option<HashMap<ident,@named_match>>,
src: ~[ast::token_tree]) src: ~[ast::token_tree])
-> @mut TtReader { -> @mut TtReader {
let r = @mut TtReader { let r = @mut TtReader {
sp_diag: sp_diag, sp_diag: sp_diag,
interner: itr,
stack: @mut TtFrame { stack: @mut TtFrame {
forest: @mut src, forest: @mut src,
idx: 0u, idx: 0u,
@ -94,7 +91,6 @@ fn dup_tt_frame(f: @mut TtFrame) -> @mut TtFrame {
pub fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader { pub fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader {
@mut TtReader { @mut TtReader {
sp_diag: r.sp_diag, sp_diag: r.sp_diag,
interner: get_ident_interner(),
stack: dup_tt_frame(r.stack), stack: dup_tt_frame(r.stack),
repeat_idx: copy r.repeat_idx, repeat_idx: copy r.repeat_idx,
repeat_len: copy r.repeat_len, repeat_len: copy r.repeat_len,
@ -127,7 +123,7 @@ fn lookup_cur_matched(r: &mut TtReader, name: ident) -> @named_match {
Some(s) => lookup_cur_matched_by_matched(r, s), Some(s) => lookup_cur_matched_by_matched(r, s),
None => { None => {
r.sp_diag.span_fatal(r.cur_span, fmt!("unknown macro variable `%s`", r.sp_diag.span_fatal(r.cur_span, fmt!("unknown macro variable `%s`",
*r.interner.get(name.name))); *ident_to_str(&name)));
} }
} }
} }

View file

@ -319,7 +319,6 @@ pub fn tts_to_parser(sess: @mut ParseSess,
cfg: ast::crate_cfg) -> Parser { cfg: ast::crate_cfg) -> Parser {
let trdr = lexer::new_tt_reader( let trdr = lexer::new_tt_reader(
copy sess.span_diagnostic, copy sess.span_diagnostic,
get_ident_interner(),
None, None,
tts tts
); );