diff options
| author | ubsan <npmazzuca@gmail.com> | 2017-05-03 10:54:03 -0700 |
|---|---|---|
| committer | ubsan <npmazzuca@gmail.com> | 2017-05-07 01:20:15 -0700 |
| commit | 0be875827fe64412f6c0eedc8f775f57137e7c55 (patch) | |
| tree | 7f38ced0fca141a5bbb9283c57ce5398250115a6 /src/libsyntax/parse/mod.rs | |
| parent | 8305394b4c32c2576bb02a026c05f01c96f46d92 (diff) | |
| download | rust-0be875827fe64412f6c0eedc8f775f57137e7c55.tar.gz rust-0be875827fe64412f6c0eedc8f775f57137e7c55.zip | |
fix the easy features in libsyntax
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 9d8f3b3d039..fe3ca1cf230 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -261,10 +261,14 @@ pub fn char_lit(lit: &str) -> (char, isize) { } } +pub fn escape_default(s: &str) -> String { + s.chars().map(char::escape_default).flat_map(|x| x).collect() +} + /// Parse a string representing a string literal into its final form. Does /// unescaping. pub fn str_lit(lit: &str) -> String { - debug!("parse_str_lit: given {}", lit.escape_default()); + debug!("parse_str_lit: given {}", escape_default(lit)); let mut res = String::with_capacity(lit.len()); // FIXME #8372: This could be a for-loop if it didn't borrow the iterator @@ -339,7 +343,7 @@ pub fn str_lit(lit: &str) -> String { /// Parse a string representing a raw string literal into its final form. The /// only operation this does is convert embedded CRLF into a single LF. pub fn raw_str_lit(lit: &str) -> String { - debug!("raw_str_lit: given {}", lit.escape_default()); + debug!("raw_str_lit: given {}", escape_default(lit)); let mut res = String::with_capacity(lit.len()); // FIXME #8372: This could be a for-loop if it didn't borrow the iterator |
