From 9f5e21da4ef95e5d2914a76b09848ebc2504c53d Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Thu, 3 Jul 2014 00:47:30 -0700 Subject: 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] --- src/test/run-pass/string-escapes.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/run-pass/string-escapes.rs (limited to 'src/test') 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 or the MIT license +// , 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 +} -- cgit 1.4.1-3-g733a5