diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-07-16 14:54:29 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-07-17 14:57:56 -0700 |
| commit | 66a9b7d5bd725960b67deb3e3793e19a0ad3cea5 (patch) | |
| tree | 04469ea1f2345b7cb9d2e0399bd7cf68c48cf4e7 /src/libsyntax | |
| parent | dc4bf173f824da0fc8c6813191e3b61e871117ba (diff) | |
| download | rust-66a9b7d5bd725960b67deb3e3793e19a0ad3cea5.tar.gz rust-66a9b7d5bd725960b67deb3e3793e19a0ad3cea5.zip | |
libsyntax: Remove some multi-gigabyte clones that were preventing bootstrapping on Windows.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/log_syntax.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 31 |
7 files changed, 25 insertions, 26 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 7dafa5c7dad..7fa2c2700c9 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -505,13 +505,13 @@ pub enum token_tree { tt_tok(span, ::parse::token::Token), // a delimited sequence (the delimiters appear as the first // and last elements of the vector) - tt_delim(~[token_tree]), + tt_delim(@mut ~[token_tree]), // These only make sense for right-hand-sides of MBE macros: // a kleene-style repetition sequence with a span, a tt_forest, // an optional separator (?), and a boolean where true indicates // zero or more (*), and false indicates one or more (+). - tt_seq(span, ~[token_tree], Option<::parse::token::Token>, bool), + tt_seq(span, @mut ~[token_tree], Option<::parse::token::Token>, bool), // a syntactic variable that will be filled in by macro expansion. tt_nonterminal(span, ident) diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs index 409873d347b..f489583dc6f 100644 --- a/src/libsyntax/ext/log_syntax.rs +++ b/src/libsyntax/ext/log_syntax.rs @@ -25,7 +25,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, cx.print_backtrace(); io::stdout().write_line( print::pprust::tt_to_str( - &ast::tt_delim(tt.to_owned()), + &ast::tt_delim(@mut tt.to_owned()), get_ident_interner())); //trivial expression diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 80e3953da86..d8ac2ede29e 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -605,7 +605,7 @@ fn mk_tt(cx: @ExtCtxt, sp: span, tt: &ast::token_tree) ~[cx.stmt_expr(e_push)] } - ast::tt_delim(ref tts) => mk_tts(cx, sp, *tts), + ast::tt_delim(ref tts) => mk_tts(cx, sp, **tts), ast::tt_seq(*) => fail!("tt_seq in quote!"), ast::tt_nonterminal(sp, ident) => { diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 399a1827c68..c20e35c299a 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -85,7 +85,7 @@ pub fn add_new_extension(cx: @ExtCtxt, io::println(fmt!("%s! { %s }", cx.str_of(name), print::pprust::tt_to_str( - &ast::tt_delim(arg.to_owned()), + &ast::tt_delim(@mut arg.to_owned()), get_ident_interner()))); } diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 67318c60db9..16019b21448 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -219,7 +219,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { match r.stack.forest[r.stack.idx].clone() { tt_delim(tts) => { r.stack = @mut TtFrame { - forest: @mut tts, + forest: tts, idx: 0u, dotdotdoted: false, sep: None, @@ -235,7 +235,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { } tt_seq(sp, tts, sep, zerok) => { // XXX(pcwalton): Bad copy. - let t = tt_seq(sp, tts.clone(), sep.clone(), zerok); + let t = tt_seq(sp, tts, sep.clone(), zerok); match lockstep_iter_size(&t, r) { lis_unconstrained => { r.sp_diag.span_fatal( @@ -263,7 +263,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { r.repeat_len.push(len); r.repeat_idx.push(0u); r.stack = @mut TtFrame { - forest: @mut tts, + forest: tts, idx: 0u, dotdotdoted: true, sep: sep, diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index a9e8fa10c64..cfd858eed47 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -131,10 +131,10 @@ fn fold_tts(tts : &[token_tree], fld: @ast_fold) -> ~[token_tree] { tt_tok(span, ref tok) => tt_tok(span,maybe_fold_ident(tok,fld)), tt_delim(ref tts) => - tt_delim(fold_tts(*tts,fld)), + tt_delim(@mut fold_tts(**tts, fld)), tt_seq(span, ref pattern, ref sep, is_optional) => tt_seq(span, - fold_tts(*pattern,fld), + @mut fold_tts(**pattern, fld), sep.map(|tok|maybe_fold_ident(tok,fld)), is_optional), tt_nonterminal(sp,ref ident) => diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 324be2f978d..42951543cd2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1925,7 +1925,7 @@ impl Parser { }; tt_seq( mk_sp(sp.lo, p.span.hi), - seq, + @mut seq, s, z ) @@ -1950,21 +1950,20 @@ impl Parser { } token::LPAREN | token::LBRACE | token::LBRACKET => { let close_delim = token::flip_delimiter(&*self.token); - tt_delim( - vec::append( - // the open delimiter: - ~[parse_any_tt_tok(self)], - vec::append( - self.parse_seq_to_before_end( - &close_delim, - seq_sep_none(), - |p| p.parse_token_tree() - ), - // the close delimiter: - [parse_any_tt_tok(self)] - ) - ) - ) + + // Parse the open delimiter. + let mut result = ~[parse_any_tt_tok(self)]; + + let trees = + self.parse_seq_to_before_end(&close_delim, + seq_sep_none(), + |p| p.parse_token_tree()); + result.push_all_move(trees); + + // Parse the close delimiter. + result.push(parse_any_tt_tok(self)); + + tt_delim(@mut result) } _ => parse_non_delim_tt_tok(self) } |
