about summary refs log tree commit diff
path: root/compiler/rustc_lexer/src/lib.rs
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2023-07-16 18:59:05 +0000
committerDeadbeef <ent3rm4n@gmail.com>2023-07-23 06:54:07 +0000
commitdf9bd80d74b72aacf336d4f1a4e44ddaff2757ba (patch)
tree797e68a699837e18a1f452f681ba279199ff7d61 /compiler/rustc_lexer/src/lib.rs
parentcec34a43b1b14f4e39363f3b283d7ac4f593ee81 (diff)
downloadrust-df9bd80d74b72aacf336d4f1a4e44ddaff2757ba.tar.gz
rust-df9bd80d74b72aacf336d4f1a4e44ddaff2757ba.zip
reimplement C string literals
Diffstat (limited to 'compiler/rustc_lexer/src/lib.rs')
-rw-r--r--compiler/rustc_lexer/src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs
index 29335a8c0f4..d511d2b1280 100644
--- a/compiler/rustc_lexer/src/lib.rs
+++ b/compiler/rustc_lexer/src/lib.rs
@@ -367,6 +367,13 @@ impl Cursor<'_> {
                 Some(|terminated| Byte { terminated }),
             ),
 
+            // c-string literal, raw c-string literal or identifier.
+            'c' => self.c_or_byte_string(
+                |terminated| CStr { terminated },
+                |n_hashes| RawCStr { n_hashes },
+                None,
+            ),
+
             // Identifier (this should be checked after other variant that can
             // start as identifier).
             c if is_id_start(c) => self.ident_or_unknown_prefix(),