Skip to content

Commit 428e413

Browse files
committed
docs(lexer): Organize and document whitespace by Pattern_White_Space
1 parent 9304aa1 commit 428e413

File tree

1 file changed

+10
-12
lines changed
  • compiler/rustc_lexer/src

1 file changed

+10
-12
lines changed

compiler/rustc_lexer/src/lib.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -331,24 +331,22 @@ pub fn is_whitespace(c: char) -> bool {
331331

332332
matches!(
333333
c,
334-
// Usual ASCII suspects
335-
'\u{0009}' // \t
336-
| '\u{000A}' // \n
334+
// End-of-line characters
335+
| '\u{000A}' // line feed (\n)
337336
| '\u{000B}' // vertical tab
338337
| '\u{000C}' // form feed
339-
| '\u{000D}' // \r
340-
| '\u{0020}' // space
341-
342-
// NEXT LINE from latin1
343-
| '\u{0085}'
338+
| '\u{000D}' // carriage return (\r)
339+
| '\u{0085}' // next line (from latin1)
340+
| '\u{2028}' // LINE SEPARATOR
341+
| '\u{2029}' // PARAGRAPH SEPARATOR
344342

345-
// Bidi markers
343+
// `Default_Ignorable_Code_Point` characters
346344
| '\u{200E}' // LEFT-TO-RIGHT MARK
347345
| '\u{200F}' // RIGHT-TO-LEFT MARK
348346

349-
// Dedicated whitespace characters from Unicode
350-
| '\u{2028}' // LINE SEPARATOR
351-
| '\u{2029}' // PARAGRAPH SEPARATOR
347+
// Horizontal space characters
348+
| '\u{0009}' // tab (\t)
349+
| '\u{0020}' // space
352350
)
353351
}
354352

0 commit comments

Comments
 (0)