提交 7b129248 编写于 作者: B Brian Anderson

Fix pretty-printing of istr literals. Issue #855

上级 c274d16b
......@@ -886,10 +886,11 @@ fn parse_bottom_expr(p: &parser) -> @ast::expr {
p.bump();
alt p.peek() {
token::LIT_STR(s) {
let sp = p.get_span();
p.bump();
let lit =
@{node: ast::lit_str(p.get_str(s), ast::sk_unique),
span: p.get_span()};
span: sp};
ex = ast::expr_lit(lit);
}
_ { ex = ast::expr_uniq(parse_expr(p)); }
......
......@@ -1468,7 +1468,17 @@ fn print_literal(s: &ps, lit: &@ast::lit) {
maybe_print_comment(s, lit.span.lo);
alt next_lit(s) {
some(lt) {
if lt.pos == lit.span.lo { word(s.s, lt.lit); s.cur_lit += 1u; ret; }
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;
}
}
_ { }
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册