diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2014-02-07 00:38:33 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2014-02-07 00:38:33 +0200 |
| commit | b2d30b72bfaa1f36808151e5825073cdff2e7ea7 (patch) | |
| tree | 14ff6b505eeee456236727940e5804e3e812b1b5 /src/libsyntax/ext/tt | |
| parent | c13a929d58c3f866687ccf12cc33b2b59a2e10b8 (diff) | |
| download | rust-b2d30b72bfaa1f36808151e5825073cdff2e7ea7.tar.gz rust-b2d30b72bfaa1f36808151e5825073cdff2e7ea7.zip | |
Removed @self and @Trait.
Diffstat (limited to 'src/libsyntax/ext/tt')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 10 |
3 files changed, 22 insertions, 22 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 6d1b8dd2358..a18f80ad4c9 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -202,11 +202,11 @@ pub enum ParseResult { Error(codemap::Span, ~str) } -pub fn parse_or_else(sess: @ParseSess, - cfg: ast::CrateConfig, - rdr: @Reader, - ms: ~[Matcher]) - -> HashMap<Ident, @NamedMatch> { +pub fn parse_or_else<R: Reader>(sess: @ParseSess, + cfg: ast::CrateConfig, + rdr: R, + ms: ~[Matcher]) + -> HashMap<Ident, @NamedMatch> { match parse(sess, cfg, rdr, ms) { Success(m) => m, Failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str), @@ -223,11 +223,11 @@ pub fn token_name_eq(t1 : &Token, t2 : &Token) -> bool { } } -pub fn parse(sess: @ParseSess, - cfg: ast::CrateConfig, - rdr: @Reader, - ms: &[Matcher]) - -> ParseResult { +pub fn parse<R: Reader>(sess: @ParseSess, + cfg: ast::CrateConfig, + rdr: R, + ms: &[Matcher]) + -> ParseResult { let mut cur_eis = ~[]; cur_eis.push(initial_matcher_pos(ms.to_owned(), None, rdr.peek().sp.lo)); diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index c179e9959e0..e196bdccfe3 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -18,7 +18,7 @@ use ext::base; use ext::tt::macro_parser::{Success, Error, Failure}; use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal}; use ext::tt::macro_parser::{parse, parse_or_else}; -use parse::lexer::{new_tt_reader, Reader}; +use parse::lexer::new_tt_reader; use parse::parser::Parser; use parse::attr::ParserAttr; use parse::token::{get_ident_interner, special_idents, gensym_ident}; @@ -129,8 +129,8 @@ fn generic_extension(cx: &ExtCtxt, for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers match **lhs { MatchedNonterminal(NtMatchers(ref mtcs)) => { - // `none` is because we're not interpolating - let arg_rdr = new_tt_reader(s_d, None, arg.to_owned()) as @Reader; + // `None` is because we're not interpolating + let arg_rdr = new_tt_reader(s_d, None, arg.to_owned()); match parse(cx.parse_sess(), cx.cfg(), arg_rdr, *mtcs) { Success(named_matches) => { let rhs = match *rhses[i] { @@ -150,12 +150,12 @@ fn generic_extension(cx: &ExtCtxt, // rhs has holes ( `$id` and `$(...)` that need filled) let trncbr = new_tt_reader(s_d, Some(named_matches), rhs); - let p = Parser(cx.parse_sess(), cx.cfg(), trncbr as @Reader); + let p = Parser(cx.parse_sess(), cx.cfg(), ~trncbr); // Let the context choose how to interpret the result. // Weird, but useful for X-macros. - return MRAny(@ParserAnyMacro { + return MRAny(~ParserAnyMacro { parser: RefCell::new(p), - } as @AnyMacro) + }) } Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo { best_fail_spot = sp; @@ -210,7 +210,7 @@ pub fn add_new_extension(cx: &mut ExtCtxt, arg.clone()); let argument_map = parse_or_else(cx.parse_sess(), cx.cfg(), - arg_reader as @Reader, + arg_reader, argument_gram); // Extract the arguments: diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index d2fa24b1cfe..430bd02119a 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -49,8 +49,8 @@ pub struct TtReader { pub fn new_tt_reader(sp_diag: @SpanHandler, interp: Option<HashMap<Ident, @NamedMatch>>, src: ~[ast::TokenTree]) - -> @TtReader { - let r = @TtReader { + -> TtReader { + let r = TtReader { sp_diag: sp_diag, stack: RefCell::new(@TtFrame { forest: @src, @@ -69,7 +69,7 @@ pub fn new_tt_reader(sp_diag: @SpanHandler, cur_tok: RefCell::new(EOF), cur_span: RefCell::new(DUMMY_SP), }; - tt_next_token(r); /* get cur_tok and cur_span set up */ + tt_next_token(&r); /* get cur_tok and cur_span set up */ return r; } @@ -86,8 +86,8 @@ fn dup_tt_frame(f: @TtFrame) -> @TtFrame { } } -pub fn dup_tt_reader(r: @TtReader) -> @TtReader { - @TtReader { +pub fn dup_tt_reader(r: &TtReader) -> TtReader { + TtReader { sp_diag: r.sp_diag, stack: RefCell::new(dup_tt_frame(r.stack.get())), repeat_idx: r.repeat_idx.clone(), |
