@@ -29,7 +29,9 @@ enum RuleName {
2929 UnterminatedBlockComment ,
3030 Punctuation ,
3131 SingleQuotedLiteral ,
32- LifetimeOrLabel ,
32+ RawLifetimeOrLabel2021 ,
33+ ReservedLifetimeOrLabelPrefix2021 ,
34+ NonRawLifetimeOrLabel ,
3335 DoublequotedNonrawLiteral2015 ,
3436 DoublequotedNonrawLiteral2021 ,
3537 DoublequotedHashlessRawLiteral2015 ,
@@ -56,7 +58,7 @@ const RULES_FOR_EDITION_2015: &[RuleName] = [
5658 RuleName :: UnterminatedBlockComment ,
5759 RuleName :: Punctuation ,
5860 RuleName :: SingleQuotedLiteral ,
59- RuleName :: LifetimeOrLabel ,
61+ RuleName :: NonRawLifetimeOrLabel ,
6062 RuleName :: DoublequotedNonrawLiteral2015 ,
6163 RuleName :: DoublequotedHashlessRawLiteral2015 ,
6264 RuleName :: DoublequotedHashedRawLiteral2015 ,
@@ -80,7 +82,9 @@ const RULES_FOR_EDITION_2021: &[RuleName] = [
8082 RuleName :: UnterminatedBlockComment ,
8183 RuleName :: Punctuation ,
8284 RuleName :: SingleQuotedLiteral ,
83- RuleName :: LifetimeOrLabel ,
85+ RuleName :: RawLifetimeOrLabel2021 ,
86+ RuleName :: ReservedLifetimeOrLabelPrefix2021 ,
87+ RuleName :: NonRawLifetimeOrLabel ,
8488 RuleName :: DoublequotedNonrawLiteral2021 ,
8589 RuleName :: DoublequotedHashlessRawLiteral2021 ,
8690 RuleName :: DoublequotedHashedRawLiteral2021 ,
@@ -183,7 +187,30 @@ fn make_named_rules() -> BTreeMap<RuleName, Rule> {
183187 "## ) ) ,
184188
185189 // Lifetime or label
186- ( RuleName :: LifetimeOrLabel ,
190+ ( RuleName :: RawLifetimeOrLabel2021 ,
191+ Rule :: new_regex (
192+ |cp| PretokenData :: RawLifetimeOrLabel {
193+ name : cp[ "name" ] . into ( ) ,
194+ } , r##"\A
195+ ' r \#
196+ (?<name>
197+ [ \p{XID_Start} _ ]
198+ \p{XID_Continue} *
199+ )
200+ "## ) ) ,
201+
202+ // Reserved lifetime or label prefix
203+ ( RuleName :: ReservedLifetimeOrLabelPrefix2021 ,
204+ Rule :: new_regex (
205+ |_| PretokenData :: Reserved , r##"\A
206+ '
207+ [ \p{XID_Start} _ ]
208+ \p{XID_Continue} *
209+ \#
210+ "## ) ) ,
211+
212+ // Lifetime or label
213+ ( RuleName :: NonRawLifetimeOrLabel ,
187214 Rule :: new_regex_with_forbidden_follower (
188215 |cp| PretokenData :: LifetimeOrLabel {
189216 name : cp[ "name" ] . into ( ) ,
0 commit comments