parser: fix printing slice of multiline raw string (#13856)
parent
c71770d9c5
commit
42a67831bf
|
@ -372,7 +372,9 @@ pub fn (mut p Parser) expr_with_left(left ast.Expr, precedence int, is_stmt_iden
|
|||
return node
|
||||
}
|
||||
p.is_stmt_ident = is_stmt_ident
|
||||
} else if p.tok.kind in [.lsbr, .nilsbr] && p.tok.line_nr == p.prev_tok.line_nr {
|
||||
} else if p.tok.kind in [.lsbr, .nilsbr] && (p.tok.line_nr == p.prev_tok.line_nr
|
||||
|| (p.prev_tok.kind == .string
|
||||
&& p.tok.line_nr == p.prev_tok.line_nr + p.prev_tok.lit.count('\n'))) {
|
||||
if p.tok.kind == .nilsbr {
|
||||
node = p.index_expr(node, true)
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
foo
|
||||
bar
|
||||
hi
|
|
@ -0,0 +1,5 @@
|
|||
fn main() {
|
||||
println(r'foo
|
||||
bar
|
||||
hi'[..])
|
||||
}
|
Loading…
Reference in New Issue