2
2
- RFC PR: (leave this empty)
3
3
- Rust Issue: (leave this empty)
4
4
5
- ** NOTE** : Draft, not finalized.
6
-
7
5
# Key Terminology
8
6
9
7
- ` macro ` : anything invokable as ` foo!(...) ` in source code.
@@ -87,9 +85,9 @@ allowed tokens for the given NT's fragment specifier, and is defined below.
87
85
2 . For each token ` T ` in ` M ` :
88
86
1 . If ` T ` is not an NT, continue.
89
87
2 . If ` T ` is a simple NT, look ahead to the next token ` T' ` in ` M ` . If
90
- ` T' ` is ` EOF ` , replace ` T' ` with ` F ` . If ` T' ` is in the set
91
- ` FOLLOW(NT) ` , ` T' ` is EOF , ` T' ` is any NT, or ` T' ` is any identifier ,
92
- continue. Else, reject.
88
+ ` T' ` is ` EOF ` or a close delimiter of a token tree, replace ` T' ` with
89
+ ` F ` . If ` T' ` is in the set ` FOLLOW(NT) ` , ` T' ` is EOF, ` T' ` is any NT ,
90
+ or ` T' ` is any identifier, continue. Else, reject.
93
91
3 . Else, ` T ` is a complex NT.
94
92
1 . If ` T ` has the form ` $(...)+ ` or ` $(...)* ` , run the algorithm on
95
93
the contents with ` F ` set to ` EOF ` . If it accepts, continue, else,
@@ -105,21 +103,16 @@ emitted and compilation should not complete.
105
103
The current legal fragment specifiers are: ` item ` , ` block ` , ` stmt ` , ` pat ` ,
106
104
` expr ` , ` ty ` , ` ident ` , ` path ` , ` meta ` , and ` tt ` .
107
105
108
- - ` FOLLOW(item) ` = ` {} `
109
- - ` FOLLOW(block) ` = ` FOLLOW(expr) `
110
106
- ` FOLLOW(stmt) ` = ` FOLLOW(expr) `
111
107
- ` FOLLOW(pat) ` = ` {FatArrow, Comma, Pipe} `
112
- - ` FOLLOW(expr) ` = ` {Comma, FatArrow, CloseBrace, CloseParen, Lit} ` (where
113
- ` Lit ` is any literal, string or numeric)
114
- - ` FOLLOW(ty) ` = `{Comma, Eq, Gt, Lt, RArrow, FatArrow, OpenBrace, OpenParen,
115
- CloseBrace, CloseParen}`
108
+ - ` FOLLOW(expr) ` = ` {Comma, FatArrow, CloseBrace, CloseParen, CloseBracket} `
109
+ - ` FOLLOW(ty) ` = ` {Comma, CloseBrace, CloseParen, CloseBracket} `
110
+ - ` FOLLOW(block) ` = any token
116
111
- ` FOLLOW(ident) ` = any token
117
- - ` FOLLOW(path) ` = any token
118
- - ` FOLLOW(meta) ` = any token
119
112
- ` FOLLOW(tt) ` = any token
120
-
121
- ** Note ** : the ` FOLLOW ` sets as given are based on every MBE in the Rust
122
- distribution, but should probably be tuned before the RFC is accepted.
113
+ - ` FOLLOW(item) ` = up for discussion
114
+ - ` FOLLOW(path) ` = up for discussion
115
+ - ` FOLLOW(meta) ` = up for discussion
123
116
124
117
# Drawbacks
125
118
@@ -146,4 +139,9 @@ reasonable freedom.
146
139
147
140
# Unresolved questions
148
141
149
- Are the given ` FOLLOW ` sets adequate?
142
+ 1 . What should the FOLLOW sets for ` item ` , ` path ` , and ` meta ` be?
143
+ 2 . Should the ` FOLLOW ` set for ` ty ` be extended? In practice, ` RArrow ` ,
144
+ ` Colon ` , ` as ` , and ` in ` are also used. (See next item)
145
+ 2 . What, if any, identifiers should be allowed in the FOLLOW sets? The author
146
+ is concerned that allowing arbitrary identifiers would limit the future use
147
+ of "contextual keywords".
0 commit comments