Skip to content

Commit b88ca95

Browse files
authored
Merge pull request #1991 from epage/whitespace
Create Whitespace grammar productions
2 parents cc7247d + 60eb145 commit b88ca95

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

src/input-format.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ r[input.syntax]
66
@root CHAR -> <a Unicode scalar value>
77
88
NUL -> U+0000
9-
10-
TAB -> U+0009
11-
12-
LF -> U+000A
13-
14-
CR -> U+000D
159
```
1610

1711
r[input.intro]

src/whitespace.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
r[lex.whitespace]
22
# Whitespace
33

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+
426
r[lex.whitespace.intro]
527
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.
1929

2030
r[lex.whitespace.token-sep]
2131
Rust is a "free-form" language, meaning that all forms of whitespace serve only

0 commit comments

Comments
 (0)