Add multiline, whitespace-eating strings.

This commit is contained in:
Josh Matthews 2011-06-07 04:53:47 -04:00 committed by Marijn Haverbeke
parent 319156c8d1
commit df9cf0be9b
2 changed files with 18 additions and 0 deletions

View File

@ -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,

View 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"));
}