diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/attr.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_serialize.rs | 26 | ||||
| -rw-r--r-- | src/libsyntax/ext/fmt.rs | 18 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/parse_proto.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/ext/qquote.rs | 37 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 23 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 4 |
11 files changed, 82 insertions, 70 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 5675ecadf62..cfaa7103a58 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -381,7 +381,7 @@ fn dtor_dec() -> fn_decl { let nil_t = @{id: 0, node: ty_nil, span: dummy_sp()}; // dtor has one argument, of type () {inputs: ~[{mode: ast::expl(ast::by_ref), - ty: nil_t, ident: @"_", id: 0}], + ty: nil_t, ident: @"_"/~, id: 0}], output: nil_t, purity: impure_fn, cf: return_val, constraints: ~[]} } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index aac0b1f4d76..114daa900aa 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -77,7 +77,7 @@ fn mk_sugared_doc_attr(text: str, lo: uint, hi: uint) -> ast::attribute { let lit = spanned(lo, hi, ast::lit_str(@text)); let attr = { style: doc_comment_style(text), - value: spanned(lo, hi, ast::meta_name_value(@"doc", lit)), + value: spanned(lo, hi, ast::meta_name_value(@"doc"/~, lit)), is_sugared_doc: true }; ret spanned(lo, hi, attr); @@ -97,7 +97,7 @@ fn attr_metas(attrs: ~[ast::attribute]) -> ~[@ast::meta_item] { fn desugar_doc_attr(attr: ast::attribute) -> ast::attribute { if attr.node.is_sugared_doc { let comment = get_meta_item_value_str(@attr.node.value).get(); - let meta = mk_name_value_item_str(@"doc", + let meta = mk_name_value_item_str(@"doc"/~, strip_doc_comment_decoration(*comment)); ret mk_attr(meta); } else { @@ -345,13 +345,13 @@ fn foreign_abi(attrs: ~[ast::attribute]) -> either<str, ast::foreign_abi> { option::none { either::right(ast::foreign_abi_cdecl) } - option::some(@"rust-intrinsic") { + option::some(@"rust-intrinsic"/~) { either::right(ast::foreign_abi_rust_intrinsic) } - option::some(@"cdecl") { + option::some(@"cdecl"/~) { either::right(ast::foreign_abi_cdecl) } - option::some(@"stdcall") { + option::some(@"stdcall"/~) { either::right(ast::foreign_abi_stdcall) } option::some(t) { @@ -371,8 +371,8 @@ fn find_inline_attr(attrs: ~[ast::attribute]) -> inline_attr { // FIXME (#2809)---validate the usage of #[inline] and #[inline(always)] do vec::foldl(ia_none, attrs) |ia,attr| { alt attr.node.value.node { - ast::meta_word(@"inline") { ia_hint } - ast::meta_list(@"inline", items) { + ast::meta_word(@"inline"/~) { ia_hint } + ast::meta_list(@"inline"/~, items) { if !vec::is_empty(find_meta_items_by_name(items, "always")) { ia_always } else { diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 4e1d8f824e1..377d0864151 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -250,7 +250,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span, fn print_macro_backtrace(cm: codemap::codemap, sp: span) { do option::iter (sp.expn_info) |ei| { - let ss = option::map_default(ei.callie.span, @"", + let ss = option::map_default(ei.callie.span, @""/~, |span| @codemap::span_to_str(span, cm)); print_diagnostic(*ss, note, #fmt("in expansion of #%s", ei.callie.name)); diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs index 119dbb59109..896ce16f585 100644 --- a/src/libsyntax/ext/auto_serialize.rs +++ b/src/libsyntax/ext/auto_serialize.rs @@ -92,7 +92,7 @@ fn expand(cx: ext_ctxt, _mitem: ast::meta_item, in_items: ~[@ast::item]) -> ~[@ast::item] { fn not_auto_serialize(a: ast::attribute) -> bool { - attr::get_attr_name(a) != @"auto_serialize" + attr::get_attr_name(a) != @"auto_serialize"/~ } fn filter_attrs(item: @ast::item) -> @ast::item { @@ -154,7 +154,7 @@ impl helpers for ext_ctxt { let args = do vec::map(input_tys) |ty| { {mode: ast::expl(ast::by_ref), ty: ty, - ident: @"", + ident: @""/~, id: self.next_id()} }; @@ -350,7 +350,7 @@ fn is_vec_or_str(ty: @ast::ty) -> bool { // This may be wrong if the user has shadowed (!) str ast::ty_path(@{span: _, global: _, idents: ids, rp: none, types: _}, _) - if ids == ~[@"str"] { true } + if ids == ~[@"str"/~] { true } _ { false } } } @@ -529,12 +529,12 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident, let ser_inputs: ~[ast::arg] = vec::append(~[{mode: ast::expl(ast::by_ref), - ty: cx.ty_path(span, ~[@"__S"], ~[]), - ident: @"__s", + ty: cx.ty_path(span, ~[@"__S"/~], ~[]), + ident: @"__s"/~, id: cx.next_id()}, {mode: ast::expl(ast::by_ref), ty: v_ty, - ident: @"__v", + ident: @"__v"/~, id: cx.next_id()}], tp_inputs); @@ -552,12 +552,12 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident, let ser_bnds = @~[ ast::bound_trait(cx.ty_path(span, - ~[@"std", @"serialization", - @"serializer"], + ~[@"std"/~, @"serialization"/~, + @"serializer"/~], ~[]))]; let ser_tps: ~[ast::ty_param] = - vec::append(~[{ident: @"__S", + vec::append(~[{ident: @"__S"/~, id: cx.next_id(), bounds: ser_bnds}], vec::map(tps, |tp| cx.clone_ty_param(tp))); @@ -749,8 +749,8 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, let deser_inputs: ~[ast::arg] = vec::append(~[{mode: ast::expl(ast::by_ref), - ty: cx.ty_path(span, ~[@"__D"], ~[]), - ident: @"__d", + ty: cx.ty_path(span, ~[@"__D"/~], ~[]), + ident: @"__d"/~, id: cx.next_id()}], tp_inputs); @@ -768,11 +768,11 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, let deser_bnds = @~[ ast::bound_trait(cx.ty_path( span, - ~[@"std", @"serialization", @"deserializer"], + ~[@"std"/~, @"serialization"/~, @"deserializer"/~], ~[]))]; let deser_tps: ~[ast::ty_param] = - vec::append(~[{ident: @"__D", + vec::append(~[{ident: @"__D"/~, id: cx.next_id(), bounds: deser_bnds}], vec::map(tps, |tp| { diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index acf055ccabd..bacfe0d6e10 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -38,7 +38,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: ~[piece], args: ~[@ast::expr]) -> @ast::expr { fn make_path_vec(_cx: ext_ctxt, ident: ast::ident) -> ~[ast::ident] { - ret ~[@"extfmt", @"rt", ident]; + ret ~[@"extfmt"/~, @"rt"/~, ident]; } fn make_rt_path_expr(cx: ext_ctxt, sp: span, ident: ast::ident) -> @ast::expr { @@ -50,7 +50,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, fn make_rt_conv_expr(cx: ext_ctxt, sp: span, cnv: conv) -> @ast::expr { fn make_flags(cx: ext_ctxt, sp: span, flags: ~[flag]) -> @ast::expr { - let mut tmp_expr = make_rt_path_expr(cx, sp, @"flag_none"); + let mut tmp_expr = make_rt_path_expr(cx, sp, @"flag_none"/~); for flags.each |f| { let fstr = alt f { flag_left_justify { "flag_left_justify" } @@ -67,11 +67,11 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, fn make_count(cx: ext_ctxt, sp: span, cnt: count) -> @ast::expr { alt cnt { count_implied { - ret make_rt_path_expr(cx, sp, @"count_implied"); + ret make_rt_path_expr(cx, sp, @"count_implied"/~); } count_is(c) { let count_lit = mk_int(cx, sp, c); - let count_is_path = make_path_vec(cx, @"count_is"); + let count_is_path = make_path_vec(cx, @"count_is"/~); let count_is_args = ~[count_lit]; ret mk_call(cx, sp, count_is_path, count_is_args); } @@ -97,10 +97,10 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, width_expr: @ast::expr, precision_expr: @ast::expr, ty_expr: @ast::expr) -> @ast::expr { ret mk_rec_e(cx, sp, - ~[{ident: @"flags", ex: flags_expr}, - {ident: @"width", ex: width_expr}, - {ident: @"precision", ex: precision_expr}, - {ident: @"ty", ex: ty_expr}]); + ~[{ident: @"flags"/~, ex: flags_expr}, + {ident: @"width"/~, ex: width_expr}, + {ident: @"precision"/~, ex: precision_expr}, + {ident: @"ty"/~, ex: ty_expr}]); } let rt_conv_flags = make_flags(cx, sp, cnv.flags); let rt_conv_width = make_count(cx, sp, cnv.width); @@ -275,7 +275,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, } let arg_vec = mk_fixed_vec_e(cx, fmt_sp, piece_exprs); - ret mk_call(cx, fmt_sp, ~[@"str", @"concat"], ~[arg_vec]); + ret mk_call(cx, fmt_sp, ~[@"str"/~, @"concat"/~], ~[arg_vec]); } // // Local Variables: diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index 420de449a5c..4a3c9e4afec 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -28,8 +28,8 @@ impl proto_parser for parser { }; self.bump(); let dir = alt dir { - @"send" { send } - @"recv" { recv } + @"send"/~ { send } + @"recv"/~ { recv } _ { fail } }; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 9f46e6b10ae..e55900968e8 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -75,7 +75,7 @@ impl methods for message { ); let args_ast = vec::append( - ~[cx.arg_mode(@"pipe", + ~[cx.arg_mode(@"pipe"/~, cx.ty_path(path(this.data_name()) .add_tys(cx.ty_vars(this.ty_params))), ast::by_copy)], @@ -92,7 +92,7 @@ impl methods for message { body += #fmt("let message = %s::%s(%s);\n", *this.proto.name, *self.name(), - str::connect(vec::append_one(arg_names, @"s") + str::connect(vec::append_one(arg_names, @"s"/~) .map(|x| *x), ", ")); body += #fmt("pipes::send(pipe, message);\n"); @@ -158,8 +158,8 @@ impl methods for state { let next_name = next.data_name(); let dir = alt this.dir { - send { @"server" } - recv { @"client" } + send { @"server"/~ } + recv { @"client"/~ } }; let v = cx.variant(name, @@ -190,7 +190,7 @@ impl methods for state { cx.item_ty_poly( self.data_name(), cx.ty_path( - (@"pipes" + @(dir.to_str() + "_packet")) + (@"pipes"/~ + @(dir.to_str() + "_packet"/~)) .add_ty(cx.ty_path( (self.proto.name + self.data_name()) .add_tys(cx.ty_vars(self.ty_params))))), @@ -281,10 +281,10 @@ impl methods for protocol { } vec::push(items, - cx.item_mod(@"client", + cx.item_mod(@"client"/~, client_states)); vec::push(items, - cx.item_mod(@"server", + cx.item_mod(@"server"/~, server_states)); cx.item_mod(self.name, items) diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index e82901f2b3f..c6a4ba1d916 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -35,7 +35,8 @@ impl of qq_helper for @ast::crate { fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_crate(*self, cx, v);} fn extract_mac() -> option<ast::mac_> {fail} fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ~[@"syntax", @"ext", @"qquote", @"parse_crate"]) + mk_path(cx, sp, + ~[@"syntax"/~, @"ext"/~, @"qquote"/~, @"parse_crate"/~]) } fn get_fold_fn() -> str {"fold_crate"} } @@ -49,7 +50,8 @@ impl of qq_helper for @ast::expr { } } fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ~[@"syntax", @"ext", @"qquote", @"parse_expr"]) + mk_path(cx, sp, + ~[@"syntax"/~, @"ext"/~, @"qquote"/~, @"parse_expr"/~]) } fn get_fold_fn() -> str {"fold_expr"} } @@ -63,7 +65,8 @@ impl of qq_helper for @ast::ty { } } fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ~[@"syntax", @"ext", @"qquote", @"parse_ty"]) + mk_path(cx, sp, + ~[@"syntax"/~, @"ext"/~, @"qquote"/~, @"parse_ty"/~]) } fn get_fold_fn() -> str {"fold_ty"} } @@ -72,7 +75,8 @@ impl of qq_helper for @ast::item { fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_item(self, cx, v);} fn extract_mac() -> option<ast::mac_> {fail} fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ~[@"syntax", @"ext", @"qquote", @"parse_item"]) + mk_path(cx, sp, + ~[@"syntax"/~, @"ext"/~, @"qquote"/~, @"parse_item"/~]) } fn get_fold_fn() -> str {"fold_item"} } @@ -81,7 +85,8 @@ impl of qq_helper for @ast::stmt { fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_stmt(self, cx, v);} fn extract_mac() -> option<ast::mac_> {fail} fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ~[@"syntax", @"ext", @"qquote", @"parse_stmt"]) + mk_path(cx, sp, + ~[@"syntax"/~, @"ext"/~, @"qquote"/~, @"parse_stmt"/~]) } fn get_fold_fn() -> str {"fold_stmt"} } @@ -90,7 +95,7 @@ impl of qq_helper for @ast::pat { fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_pat(self, cx, v);} fn extract_mac() -> option<ast::mac_> {fail} fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ~[@"syntax", @"ext", @"qquote", @"parse_pat"]) + mk_path(cx, sp, ~[@"syntax"/~, @"ext"/~, @"qquote"/~, @"parse_pat"/~]) } fn get_fold_fn() -> str {"fold_pat"} } @@ -228,19 +233,19 @@ fn finish<T: qq_helper> let cx = ecx; let cfg_call = || mk_call_( - cx, sp, mk_access(cx, sp, ~[@"ext_cx"], @"cfg"), ~[]); + cx, sp, mk_access(cx, sp, ~[@"ext_cx"/~], @"cfg"/~), ~[]); let parse_sess_call = || mk_call_( - cx, sp, mk_access(cx, sp, ~[@"ext_cx"], @"parse_sess"), ~[]); + cx, sp, mk_access(cx, sp, ~[@"ext_cx"/~], @"parse_sess"/~), ~[]); let pcall = mk_call(cx,sp, - ~[@"syntax", @"parse", @"parser", - @"parse_from_source_str"], + ~[@"syntax"/~, @"parse"/~, @"parser"/~, + @"parse_from_source_str"/~], ~[node.mk_parse_fn(cx,sp), mk_str(cx,sp, fname), mk_call(cx,sp, - ~[@"syntax",@"ext", - @"qquote", @"mk_file_substr"], + ~[@"syntax"/~,@"ext"/~, + @"qquote"/~, @"mk_file_substr"/~], ~[mk_str(cx,sp, loc.file.name), mk_uint(cx,sp, loc.line), mk_uint(cx,sp, loc.col)]), @@ -252,15 +257,15 @@ fn finish<T: qq_helper> let mut rcall = pcall; if (g_len > 0u) { rcall = mk_call(cx,sp, - ~[@"syntax", @"ext", @"qquote", @"replace"], + ~[@"syntax"/~, @"ext"/~, @"qquote"/~, @"replace"/~], ~[pcall, mk_uniq_vec_e(cx,sp, qcx.gather.map_to_vec(|g| { mk_call(cx,sp, - ~[@"syntax", @"ext", - @"qquote", @g.constr], + ~[@"syntax"/~, @"ext"/~, + @"qquote"/~, @g.constr], ~[g.e])})), mk_path(cx,sp, - ~[@"syntax", @"ext", @"qquote", + ~[@"syntax"/~, @"ext"/~, @"qquote"/~, @node.get_fold_fn()])]); } ret rcall; diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 822e8e0d697..b454dcfc0be 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -18,9 +18,9 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident, let argument_gram = ~[ ms(mtc_rep(~[ - ms(mtc_bb(@"lhs",@"mtcs", 0u)), + ms(mtc_bb(@"lhs"/~,@"mtcs"/~, 0u)), ms(mtc_tok(FAT_ARROW)), - ms(mtc_bb(@"rhs",@"tt", 1u)), + ms(mtc_bb(@"rhs"/~,@"tt"/~, 1u)), ], some(SEMI), false))]; let arg_reader = new_tt_reader(cx.parse_sess().span_diagnostic, @@ -31,11 +31,11 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident, failure(sp, msg) { cx.span_fatal(sp, msg); } }; - let lhses = alt arguments.get(@"lhs") { + let lhses = alt arguments.get(@"lhs"/~) { @seq(s, sp) { s } _ { cx.span_bug(sp, "wrong-structured lhs") } }; - let rhses = alt arguments.get(@"rhs") { + let rhses = alt arguments.get(@"rhs"/~) { @seq(s, sp) { s } _ { cx.span_bug(sp, "wrong-structured rhs") } }; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5effab94397..2ab796db319 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -259,7 +259,7 @@ class parser { let name = self.parse_value_ident(); p.bump(); name - } else { @"" }; + } else { @""/~ }; {mode: mode, ty: p.parse_ty(false), ident: name, id: p.get_id()} @@ -1337,7 +1337,8 @@ class parser { hi = e.span.hi; // HACK: turn &[...] into a &-evec ex = alt e.node { - expr_vec(*) if m == m_imm { + expr_vec(*) | expr_lit(@{node: lit_str(_), span: _}) + if m == m_imm { expr_vstore(e, vstore_slice(self.region_from_name(none))) } _ { expr_addr_of(m, e) } @@ -1353,7 +1354,8 @@ class parser { hi = e.span.hi; // HACK: turn @[...] into a @-evec ex = alt e.node { - expr_vec(*) if m == m_imm { expr_vstore(e, vstore_box) } + expr_vec(*) | expr_lit(@{node: lit_str(_), span: _}) + if m == m_imm { expr_vstore(e, vstore_box) } _ { expr_unary(box(m), e) } }; } @@ -1364,7 +1366,8 @@ class parser { hi = e.span.hi; // HACK: turn ~[...] into a ~-evec ex = alt e.node { - expr_vec(*) if m == m_imm { expr_vstore(e, vstore_uniq) } + expr_vec(*) | expr_lit(@{node: lit_str(_), span: _}) + if m == m_imm { expr_vstore(e, vstore_uniq) } _ { expr_unary(uniq(m), e) } }; } @@ -2134,12 +2137,16 @@ class parser { fn parse_method_name() -> ident { alt copy self.token { token::BINOP(op) { self.bump(); @token::binop_to_str(op) } - token::NOT { self.bump(); @"!" } - token::LBRACKET { self.bump(); self.expect(token::RBRACKET); @"[]" } + token::NOT { self.bump(); @"!"/~ } + token::LBRACKET { + self.bump(); + self.expect(token::RBRACKET); + @"[]"/~ + } _ { let id = self.parse_value_ident(); - if id == @"unary" && self.eat(token::BINOP(token::MINUS)) { - @"unary-" + if id == @"unary"/~ && self.eat(token::BINOP(token::MINUS)) { + @"unary-"/~ } else { id } } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index be9f76650da..3387b716ec6 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -28,8 +28,8 @@ fn name_of_fn(fk: fn_kind) -> ident { alt fk { fk_item_fn(name, _) | fk_method(name, _, _) | fk_ctor(name, _, _, _) { /* FIXME (#2543) */ copy name } - fk_anon(*) | fk_fn_block(*) { @"anon" } - fk_dtor(*) { @"drop" } + fk_anon(*) | fk_fn_block(*) { @"anon"/~ } + fk_dtor(*) { @"drop"/~ } } } |
