diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-10-23 04:39:58 +1100 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-10-26 09:53:30 +1100 |
| commit | dfb4163f8380e9a1aaf64a7474de30634bca4034 (patch) | |
| tree | 4ba675a96bc22eb7c3e64f796f1753ff681b9fdd /src/libsyntax/ext | |
| parent | 6a50b4d018b0e44b9e12560030ca7fb240107a68 (diff) | |
| download | rust-dfb4163f8380e9a1aaf64a7474de30634bca4034.tar.gz rust-dfb4163f8380e9a1aaf64a7474de30634bca4034.zip | |
Use standard capitalisation for TokenTree variants
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat_idents.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/ext/trace_macros.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 24 |
6 files changed, 27 insertions, 27 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index b5cc2d95890..64c8068607a 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -684,8 +684,8 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt, cx.span_err(sp, format!("{} takes 1 argument.", name).as_slice()); } else { match tts[0] { - ast::TTToken(_, token::LIT_STR(ident)) => return Some(parse::str_lit(ident.as_str())), - ast::TTToken(_, token::LIT_STR_RAW(ident, _)) => { + ast::TtToken(_, token::LIT_STR(ident)) => return Some(parse::str_lit(ident.as_str())), + ast::TtToken(_, token::LIT_STR_RAW(ident, _)) => { return Some(parse::raw_str_lit(ident.as_str())) } _ => { diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index e6befdd2aac..e12f9ee133a 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -23,7 +23,7 @@ pub fn expand_syntax_ext<'cx>(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree] for (i, e) in tts.iter().enumerate() { if i & 1 == 1 { match *e { - ast::TTToken(_, token::COMMA) => (), + ast::TtToken(_, token::COMMA) => (), _ => { cx.span_err(sp, "concat_idents! expecting comma."); return DummyResult::expr(sp); @@ -31,7 +31,7 @@ pub fn expand_syntax_ext<'cx>(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree] } } else { match *e { - ast::TTToken(_, token::IDENT(ident,_)) => { + ast::TtToken(_, token::IDENT(ident,_)) => { res_str.push_str(token::get_ident(ident).get()) } _ => { diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index baba38d8cbb..5c4290d217b 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -23,7 +23,7 @@ use ptr::P; * * This is registered as a set of expression syntax extension called quote! * that lifts its argument token-tree to an AST representing the -* construction of the same token tree, with ast::TTNonterminal nodes +* construction of the same token tree, with ast::TtNonterminal nodes * interpreted as antiquotes (splices). * */ @@ -639,10 +639,10 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> { fn mk_tt(cx: &ExtCtxt, _: Span, tt: &ast::TokenTree) -> Vec<P<ast::Stmt>> { match *tt { - ast::TTToken(sp, ref tok) => { + ast::TtToken(sp, ref tok) => { let e_sp = cx.expr_ident(sp, id_ext("_sp")); let e_tok = cx.expr_call(sp, - mk_ast_path(cx, sp, "TTToken"), + mk_ast_path(cx, sp, "TtToken"), vec!(e_sp, mk_token(cx, sp, tok))); let e_push = cx.expr_method_call(sp, @@ -651,14 +651,14 @@ fn mk_tt(cx: &ExtCtxt, _: Span, tt: &ast::TokenTree) -> Vec<P<ast::Stmt>> { vec!(e_tok)); vec!(cx.stmt_expr(e_push)) }, - ast::TTDelimited(sp, ref open, ref tts, ref close) => { + ast::TtDelimited(sp, ref open, ref tts, ref close) => { mk_tt(cx, sp, &open.to_tt()).into_iter() .chain(tts.iter().flat_map(|tt| mk_tt(cx, sp, tt).into_iter())) .chain(mk_tt(cx, sp, &close.to_tt()).into_iter()) .collect() }, - ast::TTSequence(..) => fail!("TTSequence in quote!"), - ast::TTNonterminal(sp, ident) => { + ast::TtSequence(..) => fail!("TtSequence in quote!"), + ast::TtNonterminal(sp, ident) => { // tt.extend($ident.to_tokens(ext_cx).into_iter()) let e_to_toks = @@ -692,7 +692,7 @@ fn mk_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::TokenTree]) fn expand_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> (P<ast::Expr>, P<ast::Expr>) { // NB: It appears that the main parser loses its mind if we consider - // $foo as a TTNonterminal during the main parse, so we have to re-parse + // $foo as a TtNonterminal during the main parse, so we have to re-parse // under quote_depth > 0. This is silly and should go away; the _guess_ is // it has to do with transition away from supporting old-style macros, so // try removing it when enough of them are gone. diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs index 4c3846731f4..abf798ddacb 100644 --- a/src/libsyntax/ext/trace_macros.rs +++ b/src/libsyntax/ext/trace_macros.rs @@ -20,10 +20,10 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt, tt: &[ast::TokenTree]) -> Box<base::MacResult+'static> { match tt { - [ast::TTToken(_, ref tok)] if is_keyword(keywords::True, tok) => { + [ast::TtToken(_, ref tok)] if is_keyword(keywords::True, tok) => { cx.set_trace_macros(true); } - [ast::TTToken(_, ref tok)] if is_keyword(keywords::False, tok) => { + [ast::TtToken(_, ref tok)] if is_keyword(keywords::False, tok) => { cx.set_trace_macros(false); } _ => cx.span_err(sp, "trace_macros! accepts only `true` or `false`"), diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 4a3828a8043..75ad2e0fde8 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{Ident, Matcher_, Matcher, MatchTok, MatchNonterminal, MatchSeq, TTDelimited}; +use ast::{Ident, Matcher_, Matcher, MatchTok, MatchNonterminal, MatchSeq, TtDelimited}; use ast; use codemap::{Span, Spanned, DUMMY_SP}; use ext::base::{ExtCtxt, MacResult, MacroDef}; @@ -172,7 +172,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt, MatchedNonterminal(NtTT(ref tt)) => { match **tt { // ignore delimiters - TTDelimited(_, _, ref tts, _) => (**tts).clone(), + TtDelimited(_, _, ref tts, _) => (**tts).clone(), _ => cx.span_fatal(sp, "macro rhs must be delimited"), } }, diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index c0b66851dfe..59b87afe0ee 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use ast::{TokenTree, TTDelimited, TTToken, TTSequence, TTNonterminal, Ident}; +use ast::{TokenTree, TtDelimited, TtToken, TtSequence, TtNonterminal, Ident}; use codemap::{Span, DUMMY_SP}; use diagnostic::SpanHandler; use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal}; @@ -45,7 +45,7 @@ pub struct TtReader<'a> { } /// This can do Macro-By-Example transcription. On the other hand, if -/// `src` contains no `TTSequence`s and `TTNonterminal`s, `interp` can (and +/// `src` contains no `TtSequence`s and `TtNonterminal`s, `interp` can (and /// should) be none. pub fn new_tt_reader<'a>(sp_diag: &'a SpanHandler, interp: Option<HashMap<Ident, Rc<NamedMatch>>>, @@ -130,13 +130,13 @@ fn lockstep_iter_size(t: &TokenTree, r: &TtReader) -> LockstepIterSize { match *t { // The opening and closing delimiters are both tokens, so they are // treated as `LisUnconstrained`. - TTDelimited(_, _, ref tts, _) | TTSequence(_, ref tts, _, _) => { + TtDelimited(_, _, ref tts, _) | TtSequence(_, ref tts, _, _) => { tts.iter().fold(LisUnconstrained, |size, tt| { size + lockstep_iter_size(tt, r) }) }, - TTToken(..) => LisUnconstrained, - TTNonterminal(_, name) => match *lookup_cur_matched(r, name) { + TtToken(..) => LisUnconstrained, + TtNonterminal(_, name) => match *lookup_cur_matched(r, name) { MatchedNonterminal(_) => LisUnconstrained, MatchedSeq(ref ads, _) => LisConstraint(ads.len(), name) }, @@ -194,15 +194,15 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { } } } - loop { /* because it's easiest, this handles `TTDelimited` not starting - with a `TTToken`, even though it won't happen */ + loop { /* because it's easiest, this handles `TtDelimited` not starting + with a `TtToken`, even though it won't happen */ let t = { let frame = r.stack.last().unwrap(); // FIXME(pcwalton): Bad copy. (*frame.forest)[frame.idx].clone() }; match t { - TTDelimited(_, open, tts, close) => { + TtDelimited(_, open, tts, close) => { let mut forest = Vec::with_capacity(1 + tts.len() + 1); forest.push(open.to_tt()); forest.extend(tts.iter().map(|x| (*x).clone())); @@ -216,15 +216,15 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { }); // if this could be 0-length, we'd need to potentially recur here } - TTToken(sp, tok) => { + TtToken(sp, tok) => { r.cur_span = sp; r.cur_tok = tok; r.stack.last_mut().unwrap().idx += 1; return ret_val; } - TTSequence(sp, tts, sep, zerok) => { + TtSequence(sp, tts, sep, zerok) => { // FIXME(pcwalton): Bad copy. - match lockstep_iter_size(&TTSequence(sp, tts.clone(), sep.clone(), zerok), r) { + match lockstep_iter_size(&TtSequence(sp, tts.clone(), sep.clone(), zerok), r) { LisUnconstrained => { r.sp_diag.span_fatal( sp.clone(), /* blame macro writer */ @@ -259,7 +259,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { } } // FIXME #2887: think about span stuff here - TTNonterminal(sp, ident) => { + TtNonterminal(sp, ident) => { r.stack.last_mut().unwrap().idx += 1; match *lookup_cur_matched(r, ident) { /* sidestep the interpolation tricks for ident because |
