Parse "",str as istrs. Pretty print istrs as "",str. Issue #855
This commit is contained in:
parent
d8a833dccd
commit
e35c021aa4
@ -196,7 +196,7 @@ fn span<@T>(item: &T) -> ast::spanned<T> {
|
||||
|
||||
fn mk_name_value_item_str(name: ast::ident,
|
||||
value: &istr) -> @ast::meta_item {
|
||||
let value_lit = span(ast::lit_str(value, ast::sk_rc));
|
||||
let value_lit = span(ast::lit_str(value, ast::sk_unique));
|
||||
ret mk_name_value_item(name, value_lit);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,6 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
|
||||
ret make_new_lit(cx, sp,
|
||||
ast::lit_str(expr_to_ident(cx, args[0u],
|
||||
~"expected an ident"),
|
||||
ast::sk_rc));
|
||||
ast::sk_unique));
|
||||
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ fn parse_ty(p: &parser, colons_before_params: bool) -> @ast::ty {
|
||||
} else if eat_word(p, ~"float") {
|
||||
t = ast::ty_float;
|
||||
} else if eat_word(p, ~"str") {
|
||||
t = ast::ty_str;
|
||||
t = ast::ty_istr;
|
||||
} else if eat_word(p, ~"istr") {
|
||||
t = ast::ty_istr;
|
||||
} else if eat_word(p, ~"char") {
|
||||
@ -708,7 +708,7 @@ fn parse_lit(p: &parser) -> ast::lit {
|
||||
token::LIT_CHAR(c) { p.bump(); lit = ast::lit_char(c); }
|
||||
token::LIT_STR(s) {
|
||||
p.bump();
|
||||
lit = ast::lit_str(p.get_str(s), ast::sk_rc);
|
||||
lit = ast::lit_str(p.get_str(s), ast::sk_unique);
|
||||
}
|
||||
token::LPAREN. {
|
||||
p.bump();
|
||||
|
@ -279,7 +279,7 @@ fn print_type(s: &ps, ty: &@ast::ty) {
|
||||
}
|
||||
ast::ty_char. { word(s.s, ~"char"); }
|
||||
ast::ty_str. { word(s.s, ~"str"); }
|
||||
ast::ty_istr. { word(s.s, ~"istr"); }
|
||||
ast::ty_istr. { word(s.s, ~"str"); }
|
||||
ast::ty_box(mt) { word(s.s, ~"@"); print_mt(s, mt); }
|
||||
ast::ty_vec(mt) {
|
||||
word(s.s, ~"[");
|
||||
@ -1497,12 +1497,6 @@ fn print_literal(s: &ps, lit: &@ast::lit) {
|
||||
alt next_lit(s) {
|
||||
some(lt) {
|
||||
if lt.pos == lit.span.lo {
|
||||
// FIXME: This is a hack until istrs replace strings, since
|
||||
// istrs are prefixed with a token that is not part of the literal
|
||||
alt lit.node {
|
||||
ast::lit_str(_, ast::sk_unique.) { word(s.s, ~"~"); }
|
||||
_ { }
|
||||
}
|
||||
word(s.s, lt.lit);
|
||||
s.cur_lit += 1u;
|
||||
ret;
|
||||
@ -1512,7 +1506,6 @@ fn print_literal(s: &ps, lit: &@ast::lit) {
|
||||
}
|
||||
alt lit.node {
|
||||
ast::lit_str(st, kind) {
|
||||
if kind == ast::sk_unique { word(s.s, ~"~"); }
|
||||
print_string(s, st);
|
||||
}
|
||||
ast::lit_char(ch) {
|
||||
|
Loading…
Reference in New Issue
Block a user