Add multiline, whitespace-eating strings.
This commit is contained in:
parent
319156c8d1
commit
df9cf0be9b
2 changed files with 18 additions and 0 deletions
|
@ -632,6 +632,9 @@ fn next_token(&reader rdr) -> token::token {
|
||||||
case ('"') {
|
case ('"') {
|
||||||
str::push_byte(accum_str, '"' as u8);
|
str::push_byte(accum_str, '"' as u8);
|
||||||
}
|
}
|
||||||
|
case ('\n') {
|
||||||
|
consume_whitespace(rdr);
|
||||||
|
}
|
||||||
|
|
||||||
case ('x') {
|
case ('x') {
|
||||||
str::push_char(accum_str,
|
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…
Add table
Add a link
Reference in a new issue