|
1 | 1 | r[lex.whitespace]
|
2 | 2 | # Whitespace
|
3 | 3 |
|
| 4 | +r[whitespace.syntax] |
| 5 | +```grammar,lexer |
| 6 | +@root WHITESPACE -> |
| 7 | + U+0009 // Horizontal tab, `'\t'` |
| 8 | + | U+000A // Line feed, `'\n'` |
| 9 | + | U+000B // Vertical tab |
| 10 | + | U+000C // Form feed |
| 11 | + | U+000D // Carriage return, `'\r'` |
| 12 | + | U+0020 // Space, `' '` |
| 13 | + | U+0085 // Next line |
| 14 | + | U+200E // Left-to-right mark |
| 15 | + | U+200F // Right-to-left mark |
| 16 | + | U+2028 // Line separator |
| 17 | + | U+2029 // Paragraph separator |
| 18 | +
|
| 19 | +TAB -> U+0009 // Horizontal tab, `'\t'` |
| 20 | +
|
| 21 | +LF -> U+000A // Line feed, `'\n'` |
| 22 | +
|
| 23 | +CR -> U+000D // Carriage return, `'\r'` |
| 24 | +``` |
| 25 | + |
4 | 26 | r[lex.whitespace.intro]
|
5 | 27 | Whitespace is any non-empty string containing only characters that have the
|
6 |
| -[`Pattern_White_Space`] Unicode property, namely: |
7 |
| - |
8 |
| -- `U+0009` (horizontal tab, `'\t'`) |
9 |
| -- `U+000A` (line feed, `'\n'`) |
10 |
| -- `U+000B` (vertical tab) |
11 |
| -- `U+000C` (form feed) |
12 |
| -- `U+000D` (carriage return, `'\r'`) |
13 |
| -- `U+0020` (space, `' '`) |
14 |
| -- `U+0085` (next line) |
15 |
| -- `U+200E` (left-to-right mark) |
16 |
| -- `U+200F` (right-to-left mark) |
17 |
| -- `U+2028` (line separator) |
18 |
| -- `U+2029` (paragraph separator) |
| 28 | +[`Pattern_White_Space`] Unicode property. |
19 | 29 |
|
20 | 30 | r[lex.whitespace.token-sep]
|
21 | 31 | Rust is a "free-form" language, meaning that all forms of whitespace serve only
|
|
0 commit comments