diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-10-22 23:35:32 +1100 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-10-26 09:53:29 +1100 |
| commit | ec3f0201e76b5cf689f3e8e6418435c3e6d9271c (patch) | |
| tree | a86e67e155e7f801fe9a76e95a8f970c251cc966 /src/libsyntax/parse | |
| parent | 971d776aa5a678672eb3d37f2f507664aacd2440 (diff) | |
| download | rust-ec3f0201e76b5cf689f3e8e6418435c3e6d9271c.tar.gz rust-ec3f0201e76b5cf689f3e8e6418435c3e6d9271c.zip | |
Rename TokenTree variants for clarity
This should be clearer, and fits in better with the `TTNonterminal` variant. Renames: - `TTTok` -> `TTToken` - `TTDelim` -> `TTDelimited` - `TTSeq` -> `TTSequence`
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 50 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 10 |
2 files changed, 30 insertions, 30 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 1c99b608f7a..a2e40282321 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::TTTok(_, _), - ast::TTTok(_, token::NOT), - ast::TTTok(_, _), - ast::TTDelim(_, ast::TTTok(_, token::LPAREN), + [ast::TTToken(_, _), + ast::TTToken(_, token::NOT), + ast::TTToken(_, _), + ast::TTDelimited(_, ast::TTToken(_, token::LPAREN), ref delim_elts, - ast::TTTok(_, token::RPAREN))] => { + ast::TTToken(_, token::RPAREN))] => { let delim_elts: &[ast::TokenTree] = delim_elts.as_slice(); match delim_elts { - [ast::TTDelim(_, ast::TTTok(_, token::LPAREN), + [ast::TTDelimited(_, ast::TTToken(_, token::LPAREN), ref first_set, - ast::TTTok(_, token::RPAREN)), - ast::TTTok(_, token::FAT_ARROW), - ast::TTDelim(_, ast::TTTok(_, token::LPAREN), + ast::TTToken(_, token::RPAREN)), + ast::TTToken(_, token::FAT_ARROW), + ast::TTDelimited(_, ast::TTToken(_, token::LPAREN), ref second_set, - ast::TTTok(_, token::RPAREN))] => { + ast::TTToken(_, token::RPAREN))] => { let first_set: &[ast::TokenTree] = first_set.as_slice(); match first_set { - [ast::TTTok(_, token::DOLLAR), ast::TTTok(_, _)] => { + [ast::TTToken(_, token::DOLLAR), ast::TTToken(_, _)] => { let second_set: &[ast::TokenTree] = second_set.as_slice(); match second_set { - [ast::TTTok(_, token::DOLLAR), ast::TTTok(_, _)] => { + [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\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ {\ @@ -858,7 +858,7 @@ mod test { ]\ },\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ {\ @@ -871,18 +871,18 @@ mod test { ]\ },\ {\ - \"variant\":\"TTDelim\",\ + \"variant\":\"TTDelimited\",\ \"fields\":[\ [\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ \"LPAREN\"\ ]\ },\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ {\ @@ -895,14 +895,14 @@ mod test { ]\ },\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ \"COLON\"\ ]\ },\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ {\ @@ -915,7 +915,7 @@ mod test { ]\ },\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ \"RPAREN\"\ @@ -925,18 +925,18 @@ mod test { ]\ },\ {\ - \"variant\":\"TTDelim\",\ + \"variant\":\"TTDelimited\",\ \"fields\":[\ [\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ \"LBRACE\"\ ]\ },\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ {\ @@ -949,14 +949,14 @@ mod test { ]\ },\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ \"SEMI\"\ ]\ },\ {\ - \"variant\":\"TTTok\",\ + \"variant\":\"TTToken\",\ \"fields\":[\ null,\ \"RBRACE\"\ diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 005ed2e7ed3..1ed7baa13b4 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -48,7 +48,7 @@ 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, TTDelim, TTSeq, TTTok}; +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}; @@ -2526,7 +2526,7 @@ 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 TTSeq's + // 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. @@ -2568,13 +2568,13 @@ impl<'a> Parser<'a> { let seq = match seq { Spanned { node, .. } => node, }; - TTSeq(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()) } } _ => { - TTTok(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 }; - TTDelim(span, open, Rc::new(tts), close) + TTDelimited(span, open, Rc::new(tts), close) } _ => parse_non_delim_tt_tok(self) } |
