Add multiline, whitespace-eating strings.
This commit is contained in:
parent
319156c8d1
commit
df9cf0be9b
@ -632,6 +632,9 @@ fn binop(&reader rdr, token::binop op) -> token::token {
|
||||
case ('"') {
|
||||
str::push_byte(accum_str, '"' as u8);
|
||||
}
|
||||
case ('\n') {
|
||||
consume_whitespace(rdr);
|
||||
}
|
||||
|
||||
case ('x') {
|
||||
str::push_char(accum_str,
|
||||
|
15
src/test/run-pass/str-multiline.rs
Normal file
15
src/test/run-pass/str-multiline.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// -*- rust -*-
|
||||
|
||||
use std;
|
||||
import std::str;
|
||||
|
||||
fn main() {
|
||||
let str a = "this \
|
||||
is a test";
|
||||
let str b = "this \
|
||||
is \
|
||||
another \
|
||||
test";
|
||||
assert (str::eq(a, "this is a test"));
|
||||
assert (str::eq(b, "this is another test"));
|
||||
}
|
Loading…
Reference in New Issue
Block a user