Add multiline, whitespace-eating strings. · rust-lang/rust@df9cf0b (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -632,6 +632,9 @@ fn next_token(&reader rdr) -> token::token {
632 632 case ('"') {
633 633 str::push_byte(accum_str, '"' as u8);
634 634 }
635 +case ('\n') {
636 +consume_whitespace(rdr);
637 +}
635 638
636 639 case ('x') {
637 640 str::push_char(accum_str,
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1 +// -*- rust -*-
2 +
3 +use std;
4 +import std::str;
5 +
6 +fn main() {
7 +let str a = "this \
8 +is a test";
9 +let str b = "this \
10 + is \
11 + another \
12 + test";
13 +assert (str::eq(a, "this is a test"));
14 +assert (str::eq(b, "this is another test"));
15 +}