Skip to content

Commit

Permalink
Add multiline, whitespace-eating strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Jun 7, 2011
1 parent 319156c commit a078844
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/comp/front/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ fn next_token(&reader rdr) -> token::token {
case ('"') {
str::push_byte(accum_str, '"' as u8);
}
case ('\n') {
consume_whitespace(rdr);
}

case ('x') {
str::push_char(accum_str,
Expand Down
15 changes: 15 additions & 0 deletions src/test/run-pass/str-multiline.rs
Original file line number Diff line number Diff line change
@@ -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"));
}

0 comments on commit a078844

Please sign in to comment.