about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorCorey Richardson <corey@octayn.net>2014-07-03 00:47:30 -0700
committerCorey Richardson <corey@octayn.net>2014-07-09 00:06:29 -0700
commit9f5e21da4ef95e5d2914a76b09848ebc2504c53d (patch)
tree0bfb591a37cc94423938fd634fc3c8605addfd5c /src/test
parentbf04a7ccb1c1d23478885ea4f67fad374ffe0a72 (diff)
downloadrust-9f5e21da4ef95e5d2914a76b09848ebc2504c53d.tar.gz
rust-9f5e21da4ef95e5d2914a76b09848ebc2504c53d.zip
syntax: don't process string/char/byte/binary lits
This shuffles things around a bit so that LIT_CHAR and co store an Ident
which is the original, unaltered literal in the source. When creating the AST,
unescape and postprocess them.

This changes how syntax extensions can work, slightly, but otherwise poses no
visible changes. To get a useful value out of one of these tokens, call
`parse::{char_lit, byte_lit, bin_lit, str_lit}`

[breaking-change]
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/string-escapes.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/run-pass/string-escapes.rs b/src/test/run-pass/string-escapes.rs
new file mode 100644
index 00000000000..7abe8276a97
--- /dev/null
+++ b/src/test/run-pass/string-escapes.rs
@@ -0,0 +1,15 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let x = "\\\\\
+    ";
+    assert!(x == r"\\"); // extraneous whitespace stripped
+}