Skip to content

Commit b38ea03

Browse files
authored
Merge pull request #1058 from yume-chan/patch-1
fix typo in macro-ambiguity.md
2 parents 8337ad1 + 6ee9fc9 commit b38ea03

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/macro-ambiguity.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ of this text is copied, and expanded upon in subsequent RFCs.
2020
character.
2121
- `simple NT`: a "meta-variable" non-terminal (further discussion below).
2222
- `complex NT`: a repetition matching non-terminal, specified via repetition
23-
operators (`\*`, `+`, `?`).
23+
operators (`*`, `+`, `?`).
2424
- `token`: an atomic element of a matcher; i.e. identifiers, operators,
2525
open/close delimiters, *and* simple NT's.
2626
- `token tree`: a tree structure formed from tokens (the leaves), complex
@@ -46,12 +46,12 @@ macro_rules! i_am_an_mbe {
4646
}
4747
```
4848

49-
`(start $foo:expr $($i:ident),\* end)` is a matcher. The whole matcher is a
49+
`(start $foo:expr $($i:ident),* end)` is a matcher. The whole matcher is a
5050
delimited sequence (with open- and close-delimiters `(` and `)`), and `$foo`
5151
and `$i` are simple NT's with `expr` and `ident` as their respective fragment
5252
specifiers.
5353

54-
`$(i:ident),\*` is *also* an NT; it is a complex NT that matches a
54+
`$(i:ident),*` is *also* an NT; it is a complex NT that matches a
5555
comma-separated repetition of identifiers. The `,` is the separator token for
5656
the complex NT; it occurs in between each pair of elements (if any) of the
5757
matched fragment.
@@ -72,7 +72,7 @@ its additional role as a fragment specifier; but it will be clear from context
7272
which interpretation is meant.)
7373

7474
"SEP" will range over separator tokens, "OP" over the repetition operators
75-
`\*`, `+`, and `?`, "OPEN"/"CLOSE" over matching token pairs surrounding a
75+
`*`, `+`, and `?`, "OPEN"/"CLOSE" over matching token pairs surrounding a
7676
delimited sequence (e.g. `[` and `]`).
7777

7878
Greek letters "α" "β" "γ" "δ" stand for potentially empty token-tree sequences.
@@ -110,7 +110,7 @@ of FIRST and FOLLOW are described later.
110110
1. For any separated complex NT in a matcher, `M = ... $(tt ...) SEP OP ...`,
111111
we must have `SEP` ∈ FOLLOW(`tt ...`).
112112
1. For an unseparated complex NT in a matcher, `M = ... $(tt ...) OP ...`, if
113-
OP = `\*` or `+`, we must have FOLLOW(`tt ...`) ⊇ FIRST(`tt ...`).
113+
OP = `*` or `+`, we must have FOLLOW(`tt ...`) ⊇ FIRST(`tt ...`).
114114

115115
The first invariant says that whatever actual token that comes after a matcher,
116116
if any, must be somewhere in the predetermined follow set. This ensures that a
@@ -202,7 +202,7 @@ first token-tree (if any):
202202
* Let SEP\_SET(M) = { SEP } if SEP is present and ε ∈ FIRST(`tt ...`);
203203
otherwise SEP\_SET(M) = {}.
204204

205-
* Let ALPHA\_SET(M) = FIRST(`α`) if OP = `\*` or `?` and ALPHA\_SET(M) = {} if
205+
* Let ALPHA\_SET(M) = FIRST(`α`) if OP = `*` or `?` and ALPHA\_SET(M) = {} if
206206
OP = `+`.
207207
* FIRST(M) = (FIRST(`tt ...`) \\ {ε}) ∪ SEP\_SET(M) ∪ ALPHA\_SET(M).
208208

@@ -211,7 +211,7 @@ the possibility that the separator could be a valid first token for M, which
211211
happens when there is a separator defined and the repeated fragment could be
212212
empty. ALPHA\_SET(M) defines the possibility that the complex NT could be empty,
213213
meaning that M's valid first tokens are those of the following token-tree
214-
sequences `α`. This occurs when either `\*` or `?` is used, in which case there
214+
sequences `α`. This occurs when either `*` or `?` is used, in which case there
215215
could be zero repetitions. In theory, this could also occur if `+` was used with
216216
a potentially-empty repeating fragment, but this is forbidden by the third
217217
invariant.
@@ -339,17 +339,17 @@ represent simple nonterminals with the given fragment specifier.
339339
* FOLLOW(M), for any other M, is defined as the intersection, as t ranges over
340340
(LAST(M) \ {ε}), of FOLLOW(t).
341341

342-
The tokens that can begin a type are, as of this writing, {`(`, `[`, `!`, `\*`,
342+
The tokens that can begin a type are, as of this writing, {`(`, `[`, `!`, `*`,
343343
`&`, `&&`, `?`, lifetimes, `>`, `>>`, `::`, any non-keyword identifier, `super`,
344344
`self`, `Self`, `extern`, `crate`, `$crate`, `_`, `for`, `impl`, `fn`, `unsafe`,
345345
`typeof`, `dyn`}, although this list may not be complete because people won't
346346
always remember to update the appendix when new ones are added.
347347

348348
Examples of FOLLOW for complex M:
349349

350-
* FOLLOW(`$( $d:ident $e:expr )\*`) = FOLLOW(`$e:expr`)
351-
* FOLLOW(`$( $d:ident $e:expr )\* $(;)\*`) = FOLLOW(`$e:expr`) ∩ ANYTOKEN = FOLLOW(`$e:expr`)
352-
* FOLLOW(`$( $d:ident $e:expr )\* $(;)\* $( f |)+`) = ANYTOKEN
350+
* FOLLOW(`$( $d:ident $e:expr )*`) = FOLLOW(`$e:expr`)
351+
* FOLLOW(`$( $d:ident $e:expr )* $(;)*`) = FOLLOW(`$e:expr`) ∩ ANYTOKEN = FOLLOW(`$e:expr`)
352+
* FOLLOW(`$( $d:ident $e:expr )* $(;)* $( f |)+`) = ANYTOKEN
353353

354354
### Examples of valid and invalid matchers
355355

0 commit comments

Comments
 (0)