Skip to content

Commit bbe2d87

Browse files
committed
Rename Unterminated_ nonterminals to Reserved_
The writeup now has an explicit notion of a reserved-form nonterminal, so it seems better if they all have names beginning "Reserved_".
1 parent c1e4fe6 commit bbe2d87

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

src/reimplementation/tokenisation/processing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pub fn process(match_data: &TokenisationMatch) -> Result<FineToken, Error> {
3939
Nonterminal::Raw_ident => process_raw_ident(match_data)?,
4040
Nonterminal::Ident => process_ident(match_data)?,
4141
Nonterminal::Punctuation => process_punctuation(match_data)?,
42-
Nonterminal::Unterminated_block_comment
43-
| Nonterminal::Unterminated_literal_2015
42+
Nonterminal::Reserved_block_comment_start
43+
| Nonterminal::Reserved_literal_2015
4444
| Nonterminal::Reserved_literal_2021
4545
| Nonterminal::Reserved_single_quoted_literal_2015
4646
| Nonterminal::Reserved_single_quoted_literal_2021

src/reimplementation/tokenisation/tokenise.pest

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ TOKEN_2015 = {
77
Whitespace |
88
Line_comment |
99
Block_comment |
10-
Unterminated_block_comment |
10+
Reserved_block_comment_start |
1111
Character_literal |
1212
Byte_literal |
1313
String_literal |
1414
Byte_string_literal |
1515
Raw_string_literal |
1616
Raw_byte_string_literal |
17-
Unterminated_literal_2015 |
17+
Reserved_literal_2015 |
1818
Reserved_single_quoted_literal_2015 |
1919
Float_literal |
2020
Reserved_float |
@@ -30,7 +30,7 @@ TOKEN_2021 = {
3030
Whitespace |
3131
Line_comment |
3232
Block_comment |
33-
Unterminated_block_comment |
33+
Reserved_block_comment_start |
3434
Character_literal |
3535
Byte_literal |
3636
String_literal |
@@ -57,7 +57,7 @@ TOKEN_2024 = {
5757
Whitespace |
5858
Line_comment |
5959
Block_comment |
60-
Unterminated_block_comment |
60+
Reserved_block_comment_start |
6161
Character_literal |
6262
Byte_literal |
6363
String_literal |
@@ -98,9 +98,9 @@ BLOCK_COMMENT = { "/*" ~ BLOCK_COMMENT_CONTENT ~ "*/" }
9898
BLOCK_COMMENT_CONTENT = { ( BLOCK_COMMENT | !"*/" ~ !"/*" ~ ANY ) * }
9999
// ANCHOR_END: block_comment
100100

101-
// ANCHOR: unterminated_block_comment
102-
Unterminated_block_comment = { "/*" }
103-
// ANCHOR_END: unterminated_block_comment
101+
// ANCHOR: reserved_block_comment_start
102+
Reserved_block_comment_start = { "/*" }
103+
// ANCHOR_END: reserved_block_comment_start
104104

105105

106106
// ANCHOR: single_quoted_literals_common
@@ -177,10 +177,10 @@ Raw_c_string_literal = { "cr" ~ RAW_DOUBLE_QUOTED_FORM }
177177
// ANCHOR_END: raw_c_string_literal
178178

179179

180-
// ANCHOR: unterminated_literal
181-
Unterminated_literal_2015 = { "r" ~ DOUBLEQUOTE | "br" ~ DOUBLEQUOTE | "b'" }
180+
// ANCHOR: reserved_literal
181+
Reserved_literal_2015 = { "r" ~ DOUBLEQUOTE | "br" ~ DOUBLEQUOTE | "b'" }
182182
Reserved_literal_2021 = { IDENT ~ ( DOUBLEQUOTE | "'" ) }
183-
// ANCHOR_END: unterminated_literal
183+
// ANCHOR_END: reserved_literal
184184

185185
// ANCHOR: reserved_single_quoted_literal
186186
Reserved_single_quoted_literal_2015 = { "'" ~ IDENT ~ "'" }

writeup/quoted_literal_tokens.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,21 @@ The match is rejected if:
273273

274274
### Reserved forms
275275

276-
#### Reserved or unterminated literal { .processing }
276+
#### Reserved literal { .processing }
277277

278278
##### Grammar
279279
```
280-
{{#include tokenise_anchored.pest:unterminated_literal}}
280+
{{#include tokenise_anchored.pest:reserved_literal}}
281281
```
282282

283283
##### Rejection
284284

285285
All matches are rejected.
286286

287-
> Note: I believe in the `Unterminated_literal_2015` definition only the `b'` form is strictly needed:
287+
> Note: I believe in the `Reserved_literal_2015` definition only the `b'` form is strictly needed:
288288
> if that definition matches using one of the other subexpressions
289289
> then the input will be rejected eventually anyway
290-
> (given that the corresponding string literal nonterminal didn't match).
290+
> (given that the corresponding quoted literal nonterminal didn't match).
291291
292292
> Note: `Reserved_literal_2021` catches both reserved forms and unterminated `b'` literals.
293293

writeup/tokenising.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ A nonterminal whose name appears in the following table is a <dfn>reserved-form
2727

2828
| Reserved form |
2929
|---------------------------------------|
30+
| `Reserved_block_comment_start` |
3031
| `Reserved_float` |
3132
| `Reserved_guard` |
3233
| `Reserved_lifetime_or_label_prefix` |
34+
| `Reserved_literal_2015` |
3335
| `Reserved_literal_2021` |
3436
| `Reserved_prefix_2015` |
3537
| `Reserved_prefix_2021` |
3638
| `Reserved_single_quoted_literal_2015` |
3739
| `Reserved_single_quoted_literal_2021` |
38-
| `Unterminated_block_comment` |
39-
| `Unterminated_literal_2015` |
4040

4141
A token nonterminal or reserved-form nonterminal is a <dfn>tokenisation nonterminal</dfn>.
4242

writeup/whitespace_and_comment_tokens.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ The token's <var>style</var> and <var>body</var> are determined from the block c
9999
The match is rejected if the token's <var>body</var> would include a <kbd>CR</kbd> character.
100100

101101

102-
#### Unterminated block comment { .processing }
102+
#### Reserved block comment start { .processing }
103103

104104
##### Grammar
105105
```
106-
{{#include tokenise_anchored.pest:unterminated_block_comment}}
106+
{{#include tokenise_anchored.pest:reserved_block_comment_start}}
107107
```
108108

109109
##### Rejection

0 commit comments

Comments
 (0)