From dfb4163f8380e9a1aaf64a7474de30634bca4034 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Thu, 23 Oct 2014 04:39:58 +1100 Subject: [PATCH] Use standard capitalisation for TokenTree variants --- src/doc/guide-plugin.md | 4 +-- src/libsyntax/ast.rs | 26 +++++++-------- src/libsyntax/diagnostics/plugin.rs | 12 +++---- src/libsyntax/ext/base.rs | 4 +-- src/libsyntax/ext/concat_idents.rs | 4 +-- src/libsyntax/ext/quote.rs | 14 ++++---- src/libsyntax/ext/trace_macros.rs | 4 +-- src/libsyntax/ext/tt/macro_rules.rs | 4 +-- src/libsyntax/ext/tt/transcribe.rs | 24 ++++++------- src/libsyntax/fold.rs | 16 ++++----- src/libsyntax/parse/mod.rs | 50 ++++++++++++++-------------- src/libsyntax/parse/parser.rs | 16 ++++----- src/libsyntax/print/pprust.rs | 8 ++--- src/test/auxiliary/roman_numerals.rs | 4 +-- 14 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/doc/guide-plugin.md b/src/doc/guide-plugin.md index 9bf1d29569ca4..83a5697f75a69 100644 --- a/src/doc/guide-plugin.md +++ b/src/doc/guide-plugin.md @@ -56,7 +56,7 @@ extern crate rustc; use syntax::codemap::Span; use syntax::parse::token::{IDENT, get_ident}; -use syntax::ast::{TokenTree, TTToken}; +use syntax::ast::{TokenTree, TtToken}; use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacExpr}; use syntax::ext::build::AstBuilder; // trait for expr_uint use rustc::plugin::Registry; @@ -71,7 +71,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) ("I", 1)]; let text = match args { - [TTToken(_, IDENT(s, _))] => get_ident(s).to_string(), + [TtToken(_, IDENT(s, _))] => get_ident(s).to_string(), _ => { cx.span_err(sp, "argument should be a single identifier"); return DummyResult::any(sp); diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 36373638099d2..f87c7cf021547 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -25,7 +25,7 @@ use std::rc::Rc; use serialize::{Encodable, Decodable, Encoder, Decoder}; #[cfg(stage0)] -pub use self::TTToken as TTTok; +pub use self::TtToken as TTTok; // FIXME #6993: in librustc, uses of "ident" should be replaced // by just "Name". @@ -603,9 +603,9 @@ pub struct Delimiter { } impl Delimiter { - /// Convert the delimiter to a `TTToken` + /// Convert the delimiter to a `TtToken` pub fn to_tt(&self) -> TokenTree { - TTToken(self.span, self.token.clone()) + TtToken(self.span, self.token.clone()) } } @@ -617,9 +617,9 @@ impl Delimiter { /// If the syntax extension is an MBE macro, it will attempt to match its /// LHS "matchers" against the provided token tree, and if it finds a /// match, will transcribe the RHS token tree, splicing in any captured -/// `macro_parser::matched_nonterminals` into the `TTNonterminal`s it finds. +/// `macro_parser::matched_nonterminals` into the `TtNonterminal`s it finds. /// -/// The RHS of an MBE macro is the only place a `TTNonterminal` or `TTSequence` +/// The RHS of an MBE macro is the only place a `TtNonterminal` or `TtSequence` /// makes any real sense. You could write them elsewhere but nothing /// else knows what to do with them, so you'll probably get a syntax /// error. @@ -627,10 +627,10 @@ impl Delimiter { #[doc="For macro invocations; parsing is delegated to the macro"] pub enum TokenTree { /// A single token - TTToken(Span, ::parse::token::Token), + TtToken(Span, ::parse::token::Token), /// A delimited sequence of token trees // FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST. - TTDelimited(Span, Delimiter, Rc>, Delimiter), + TtDelimited(Span, Delimiter, Rc>, Delimiter), // These only make sense for right-hand-sides of MBE macros: @@ -638,20 +638,20 @@ pub enum TokenTree { /// an optional separator, and a boolean where true indicates /// zero or more (..), and false indicates one or more (+). // FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST. - TTSequence(Span, Rc>, Option<::parse::token::Token>, bool), + TtSequence(Span, Rc>, Option<::parse::token::Token>, bool), /// A syntactic variable that will be filled in by macro expansion. - TTNonterminal(Span, Ident) + TtNonterminal(Span, Ident) } impl TokenTree { /// Returns the `Span` corresponding to this token tree. pub fn get_span(&self) -> Span { match *self { - TTToken(span, _) => span, - TTDelimited(span, _, _, _) => span, - TTSequence(span, _, _, _) => span, - TTNonterminal(span, _) => span, + TtToken(span, _) => span, + TtDelimited(span, _, _, _) => span, + TtSequence(span, _, _, _) => span, + TtNonterminal(span, _) => span, } } } diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 8ea08c58d065c..b8795ad5be80f 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -50,7 +50,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt, token_tree: &[TokenTree]) -> Box { let code = match token_tree { - [ast::TTToken(_, token::IDENT(code, _))] => code, + [ast::TtToken(_, token::IDENT(code, _))] => code, _ => unreachable!() }; with_registered_diagnostics(|diagnostics| { @@ -82,12 +82,12 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, token_tree: &[TokenTree]) -> Box { let (code, description) = match token_tree { - [ast::TTToken(_, token::IDENT(ref code, _))] => { + [ast::TtToken(_, token::IDENT(ref code, _))] => { (code, None) }, - [ast::TTToken(_, token::IDENT(ref code, _)), - ast::TTToken(_, token::COMMA), - ast::TTToken(_, token::LIT_STR_RAW(description, _))] => { + [ast::TtToken(_, token::IDENT(ref code, _)), + ast::TtToken(_, token::COMMA), + ast::TtToken(_, token::LIT_STR_RAW(description, _))] => { (code, Some(description)) } _ => unreachable!() @@ -110,7 +110,7 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, token_tree: &[TokenTree]) -> Box { let name = match token_tree { - [ast::TTToken(_, token::IDENT(ref name, _))] => name, + [ast::TtToken(_, token::IDENT(ref name, _))] => name, _ => unreachable!() }; diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index b5cc2d95890bb..64c8068607aa0 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 e6befdd2aac92..e12f9ee133a32 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 baba38d8cbb32..5c4290d217bfd 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 { fn mk_tt(cx: &ExtCtxt, _: Span, tt: &ast::TokenTree) -> Vec> { 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> { 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, P) { // 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 4c3846731f432..abf798ddacb3a 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 { 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 4a3828a8043fb..75ad2e0fde884 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 c0b66851dfe3f..59b87afe0ee08 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>>, @@ -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 diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 9cffce74a095a..2dfa69b1f3820 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -569,10 +569,10 @@ pub fn noop_fold_arg(Arg {id, pat, ty}: Arg, fld: &mut T) -> Arg { pub fn noop_fold_tt(tt: &TokenTree, fld: &mut T) -> TokenTree { match *tt { - TTToken(span, ref tok) => - TTToken(span, fld.fold_token(tok.clone())), - TTDelimited(span, ref open, ref tts, ref close) => - TTDelimited(span, + TtToken(span, ref tok) => + TtToken(span, fld.fold_token(tok.clone())), + TtDelimited(span, ref open, ref tts, ref close) => + TtDelimited(span, Delimiter { span: open.span, token: fld.fold_token(open.token.clone()) @@ -582,13 +582,13 @@ pub fn noop_fold_tt(tt: &TokenTree, fld: &mut T) -> TokenTree { span: close.span, token: fld.fold_token(close.token.clone()) }), - TTSequence(span, ref pattern, ref sep, is_optional) => - TTSequence(span, + TtSequence(span, ref pattern, ref sep, is_optional) => + TtSequence(span, Rc::new(fld.fold_tts(pattern.as_slice())), sep.clone().map(|tok| fld.fold_token(tok)), is_optional), - TTNonterminal(sp,ref ident) => - TTNonterminal(sp,fld.fold_ident(*ident)) + TtNonterminal(sp,ref ident) => + TtNonterminal(sp,fld.fold_ident(*ident)) } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index a2e4028232100..d7438f11a9468 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -793,29 +793,29 @@ mod test { let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_string()); let tts: &[ast::TokenTree] = tts.as_slice(); match tts { - [ast::TTToken(_, _), - ast::TTToken(_, token::NOT), - ast::TTToken(_, _), - ast::TTDelimited(_, ast::TTToken(_, token::LPAREN), + [ast::TtToken(_, _), + ast::TtToken(_, token::NOT), + ast::TtToken(_, _), + ast::TtDelimited(_, ast::TtToken(_, token::LPAREN), ref delim_elts, - ast::TTToken(_, token::RPAREN))] => { + ast::TtToken(_, token::RPAREN))] => { let delim_elts: &[ast::TokenTree] = delim_elts.as_slice(); match delim_elts { - [ast::TTDelimited(_, ast::TTToken(_, token::LPAREN), + [ast::TtDelimited(_, ast::TtToken(_, token::LPAREN), ref first_set, - ast::TTToken(_, token::RPAREN)), - ast::TTToken(_, token::FAT_ARROW), - ast::TTDelimited(_, ast::TTToken(_, token::LPAREN), + ast::TtToken(_, token::RPAREN)), + ast::TtToken(_, token::FAT_ARROW), + ast::TtDelimited(_, ast::TtToken(_, token::LPAREN), ref second_set, - ast::TTToken(_, token::RPAREN))] => { + ast::TtToken(_, token::RPAREN))] => { let first_set: &[ast::TokenTree] = first_set.as_slice(); match first_set { - [ast::TTToken(_, token::DOLLAR), ast::TTToken(_, _)] => { + [ast::TtToken(_, token::DOLLAR), ast::TtToken(_, _)] => { let second_set: &[ast::TokenTree] = second_set.as_slice(); match second_set { - [ast::TTToken(_, token::DOLLAR), ast::TTToken(_, _)] => { + [ast::TtToken(_, token::DOLLAR), ast::TtToken(_, _)] => { assert_eq!("correct","correct") } _ => assert_eq!("wrong 4","correct") @@ -845,7 +845,7 @@ mod test { assert_eq!(json::encode(&tts), "[\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ {\ @@ -858,7 +858,7 @@ mod test { ]\ },\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ {\ @@ -871,18 +871,18 @@ mod test { ]\ },\ {\ - \"variant\":\"TTDelimited\",\ + \"variant\":\"TtDelimited\",\ \"fields\":[\ [\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ \"LPAREN\"\ ]\ },\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ {\ @@ -895,14 +895,14 @@ mod test { ]\ },\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ \"COLON\"\ ]\ },\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ {\ @@ -915,7 +915,7 @@ mod test { ]\ },\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ \"RPAREN\"\ @@ -925,18 +925,18 @@ mod test { ]\ },\ {\ - \"variant\":\"TTDelimited\",\ + \"variant\":\"TtDelimited\",\ \"fields\":[\ [\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ \"LBRACE\"\ ]\ },\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ {\ @@ -949,14 +949,14 @@ mod test { ]\ },\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ \"SEMI\"\ ]\ },\ {\ - \"variant\":\"TTToken\",\ + \"variant\":\"TtToken\",\ \"fields\":[\ null,\ \"RBRACE\"\ diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1ed7baa13b42d..ebca362b9d857 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -48,8 +48,8 @@ use ast::{StmtExpr, StmtSemi, StmtMac, StructDef, StructField}; use ast::{StructVariantKind, BiSub}; use ast::StrStyle; use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue}; -use ast::{Delimiter, TokenTree, TraitItem, TraitRef, TTDelimited, TTSequence, TTToken}; -use ast::{TTNonterminal, TupleVariantKind, Ty, Ty_, TyBot}; +use ast::{Delimiter, TokenTree, TraitItem, TraitRef, TtDelimited, TtSequence, TtToken}; +use ast::{TtNonterminal, TupleVariantKind, Ty, Ty_, TyBot}; use ast::{TypeField, TyFixedLengthVec, TyClosure, TyProc, TyBareFn}; use ast::{TyTypeof, TyInfer, TypeMethod}; use ast::{TyNil, TyParam, TyParamBound, TyParen, TyPath, TyPtr, TyQPath}; @@ -2526,8 +2526,8 @@ impl<'a> Parser<'a> { /// parse a single token tree from the input. pub fn parse_token_tree(&mut self) -> TokenTree { // FIXME #6994: currently, this is too eager. It - // parses token trees but also identifies TTSequence's - // and TTNonterminal's; it's too early to know yet + // parses token trees but also identifies TtSequence's + // and TtNonterminal's; it's too early to know yet // whether something will be a nonterminal or a seq // yet. maybe_whole!(deref self, NtTT); @@ -2568,13 +2568,13 @@ impl<'a> Parser<'a> { let seq = match seq { Spanned { node, .. } => node, }; - TTSequence(mk_sp(sp.lo, p.span.hi), Rc::new(seq), s, z) + TtSequence(mk_sp(sp.lo, p.span.hi), Rc::new(seq), s, z) } else { - TTNonterminal(sp, p.parse_ident()) + TtNonterminal(sp, p.parse_ident()) } } _ => { - TTToken(p.span, p.bump_and_get()) + TtToken(p.span, p.bump_and_get()) } } } @@ -2615,7 +2615,7 @@ impl<'a> Parser<'a> { // Expand to cover the entire delimited token tree let span = Span { hi: self.span.hi, ..pre_span }; - TTDelimited(span, open, Rc::new(tts), close) + TtDelimited(span, open, Rc::new(tts), close) } _ => parse_non_delim_tt_tok(self) } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 9a102d229718f..e3b7a16410886 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1020,14 +1020,14 @@ impl<'a> State<'a> { /// expression arguments as expressions). It can be done! I think. pub fn print_tt(&mut self, tt: &ast::TokenTree) -> IoResult<()> { match *tt { - ast::TTDelimited(_, ref open, ref tts, ref close) => { + ast::TtDelimited(_, ref open, ref tts, ref close) => { try!(word(&mut self.s, parse::token::to_string(&open.token).as_slice())); try!(space(&mut self.s)); try!(self.print_tts(tts.as_slice())); try!(space(&mut self.s)); word(&mut self.s, parse::token::to_string(&close.token).as_slice()) }, - ast::TTToken(_, ref tk) => { + ast::TtToken(_, ref tk) => { try!(word(&mut self.s, parse::token::to_string(tk).as_slice())); match *tk { parse::token::DOC_COMMENT(..) => { @@ -1036,7 +1036,7 @@ impl<'a> State<'a> { _ => Ok(()) } } - ast::TTSequence(_, ref tts, ref sep, zerok) => { + ast::TtSequence(_, ref tts, ref sep, zerok) => { try!(word(&mut self.s, "$(")); for tt_elt in (*tts).iter() { try!(self.print_tt(tt_elt)); @@ -1051,7 +1051,7 @@ impl<'a> State<'a> { } word(&mut self.s, if zerok { "*" } else { "+" }) } - ast::TTNonterminal(_, name) => { + ast::TtNonterminal(_, name) => { try!(word(&mut self.s, "$")); self.print_ident(name) } diff --git a/src/test/auxiliary/roman_numerals.rs b/src/test/auxiliary/roman_numerals.rs index 0d5abb8fb5dd9..40ed3a35ddf13 100644 --- a/src/test/auxiliary/roman_numerals.rs +++ b/src/test/auxiliary/roman_numerals.rs @@ -18,7 +18,7 @@ extern crate rustc; use syntax::codemap::Span; use syntax::parse::token::{IDENT, get_ident}; -use syntax::ast::{TokenTree, TTToken}; +use syntax::ast::{TokenTree, TtToken}; use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacExpr}; use syntax::ext::build::AstBuilder; // trait for expr_uint use rustc::plugin::Registry; @@ -39,7 +39,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) ("I", 1)]; let text = match args { - [TTToken(_, IDENT(s, _))] => get_ident(s).to_string(), + [TtToken(_, IDENT(s, _))] => get_ident(s).to_string(), _ => { cx.span_err(sp, "argument should be a single identifier"); return DummyResult::any(sp);