Skip to content

Commit df9cf0b

Browse files
jdmmarijnh
authored andcommitted
Add multiline, whitespace-eating strings.
1 parent 319156c commit df9cf0b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/comp/front/lexer.rs

+3
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,9 @@ fn next_token(&reader rdr) -> token::token {
632632
case ('"') {
633633
str::push_byte(accum_str, '"' as u8);
634634
}
635+
case ('\n') {
636+
consume_whitespace(rdr);
637+
}
635638

636639
case ('x') {
637640
str::push_char(accum_str,

src/test/run-pass/str-multiline.rs

+15
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)