@@ -87,7 +87,7 @@ allowed tokens for the given NT's fragment specifier, and is defined below.
87
87
2 . If ` T ` is a simple NT, look ahead to the next token ` T' ` in ` M ` . If
88
88
` T' ` is ` EOF ` or a close delimiter of a token tree, replace ` T' ` with
89
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.
90
+ or ` T' ` is any close delimiter , continue. Else, reject.
91
91
3 . Else, ` T ` is a complex NT.
92
92
1 . If ` T ` has the form ` $(...)+ ` or ` $(...)* ` , run the algorithm on
93
93
the contents with ` F ` set to ` EOF ` . If it accepts, continue, else,
@@ -104,15 +104,17 @@ The current legal fragment specifiers are: `item`, `block`, `stmt`, `pat`,
104
104
` expr ` , ` ty ` , ` ident ` , ` path ` , ` meta ` , and ` tt ` .
105
105
106
106
- ` FOLLOW(stmt) ` = ` FOLLOW(expr) `
107
- - ` FOLLOW(pat) ` = ` {FatArrow, Comma, Pipe} `
108
- - ` FOLLOW(expr) ` = ` {Comma, FatArrow, CloseBrace, CloseParen, CloseBracket} `
109
- - ` FOLLOW(ty) ` = ` {Comma, CloseBrace, CloseParen, CloseBracket} `
107
+ - ` FOLLOW(pat) ` = ` {FatArrow, Comma, Eq} `
108
+ - ` FOLLOW(expr) ` = ` {Comma, Semicolon} `
109
+ - ` FOLLOW(path) ` = ` FOLLOW(ty) `
110
+ - ` FOLLOW(ty) ` = ` {Comma, RArrow, Colon, Eq, Gt, Ident(as)} `
110
111
- ` FOLLOW(block) ` = any token
111
112
- ` FOLLOW(ident) ` = any token
112
113
- ` FOLLOW(tt) ` = any token
113
- - ` FOLLOW(item) ` = up for discussion
114
- - ` FOLLOW(path) ` = up for discussion
115
- - ` FOLLOW(meta) ` = up for discussion
114
+ - ` FOLLOW(item) ` = any token
115
+ - ` FOLLOW(meta) ` = any token
116
+
117
+ (Note that close delimiters are valid following any NT.)
116
118
117
119
# Drawbacks
118
120
@@ -136,12 +138,3 @@ reasonable freedom.
136
138
same issue would come up.
137
139
3 . Do nothing. This is very dangerous, and has the potential to essentially
138
140
freeze Rust's syntax for fear of accidentally breaking a macro.
139
-
140
- # Unresolved questions
141
-
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