about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEd Page <eopage@gmail.com>2025-08-28 14:18:42 -0500
committerEd Page <eopage@gmail.com>2025-09-01 20:51:39 -0500
commit428e413414e0719a7758676ac49e07b85eb86dec (patch)
treef570611ab71481e7b3bbdf570fcdb6617d16b5a7
parent9304aa19366a51aea23a516ea44e45bc4a3e84e7 (diff)
downloadrust-428e413414e0719a7758676ac49e07b85eb86dec.tar.gz
rust-428e413414e0719a7758676ac49e07b85eb86dec.zip
docs(lexer): Organize and document whitespace by Pattern_White_Space
-rw-r--r--compiler/rustc_lexer/src/lib.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs
index d10b1920343..e347a76f6a2 100644
--- a/compiler/rustc_lexer/src/lib.rs
+++ b/compiler/rustc_lexer/src/lib.rs
@@ -331,24 +331,22 @@ pub fn is_whitespace(c: char) -> bool {
 
     matches!(
         c,
-        // Usual ASCII suspects
-        '\u{0009}'   // \t
-        | '\u{000A}' // \n
+        // End-of-line characters
+        | '\u{000A}' // line feed (\n)
         | '\u{000B}' // vertical tab
         | '\u{000C}' // form feed
-        | '\u{000D}' // \r
-        | '\u{0020}' // space
-
-        // NEXT LINE from latin1
-        | '\u{0085}'
+        | '\u{000D}' // carriage return (\r)
+        | '\u{0085}' // next line (from latin1)
+        | '\u{2028}' // LINE SEPARATOR
+        | '\u{2029}' // PARAGRAPH SEPARATOR
 
-        // Bidi markers
+        // `Default_Ignorable_Code_Point` characters
         | '\u{200E}' // LEFT-TO-RIGHT MARK
         | '\u{200F}' // RIGHT-TO-LEFT MARK
 
-        // Dedicated whitespace characters from Unicode
-        | '\u{2028}' // LINE SEPARATOR
-        | '\u{2029}' // PARAGRAPH SEPARATOR
+        // Horizontal space characters
+        | '\u{0009}'   // tab (\t)
+        | '\u{0020}' // space
     )
 }