@@ -15,9 +15,11 @@ use super::{PretokenData, Rule};
1515pub fn list_rules ( edition : Edition ) -> & ' static Vec < & ' static Rule > {
1616 static EDITION_2015_RULES : OnceLock < Vec < & ' static Rule > > = OnceLock :: new ( ) ;
1717 static EDITION_2021_RULES : OnceLock < Vec < & ' static Rule > > = OnceLock :: new ( ) ;
18+ static EDITION_2024_RULES : OnceLock < Vec < & ' static Rule > > = OnceLock :: new ( ) ;
1819 match edition {
1920 Edition :: E2015 => EDITION_2015_RULES . get_or_init ( || make_rules ( RULES_FOR_EDITION_2015 ) ) ,
2021 Edition :: E2021 => EDITION_2021_RULES . get_or_init ( || make_rules ( RULES_FOR_EDITION_2021 ) ) ,
22+ Edition :: E2024 => EDITION_2024_RULES . get_or_init ( || make_rules ( RULES_FOR_EDITION_2024 ) ) ,
2123 }
2224}
2325
@@ -101,6 +103,32 @@ const RULES_FOR_EDITION_2021: &[RuleName] = [
101103]
102104. as_slice ( ) ;
103105
106+ const RULES_FOR_EDITION_2024 : & [ RuleName ] = [
107+ RuleName :: Whitespace ,
108+ RuleName :: LineComment ,
109+ RuleName :: BlockComment ,
110+ RuleName :: UnterminatedBlockComment ,
111+ RuleName :: Punctuation ,
112+ RuleName :: SingleQuotedLiteral ,
113+ RuleName :: RawLifetimeOrLabel2021 ,
114+ RuleName :: ReservedLifetimeOrLabelPrefix2021 ,
115+ RuleName :: NonRawLifetimeOrLabel ,
116+ RuleName :: DoublequotedNonrawLiteral2021 ,
117+ RuleName :: DoublequotedHashlessRawLiteral2021 ,
118+ RuleName :: DoublequotedHashedRawLiteral2021 ,
119+ RuleName :: FloatLiteralWithExponent ,
120+ RuleName :: FloatLiteralWithoutExponent ,
121+ RuleName :: FloatLiteralWithFinalDot ,
122+ RuleName :: IntegerBinaryLiteral ,
123+ RuleName :: IntegerOctalLiteral ,
124+ RuleName :: IntegerHexadecimalLiteral ,
125+ RuleName :: IntegerDecimalLiteral ,
126+ RuleName :: RawIdentifier ,
127+ RuleName :: ReservedPrefixOrUnterminatedLiteral2021 ,
128+ RuleName :: NonrawIdentifier ,
129+ ]
130+ . as_slice ( ) ;
131+
104132fn make_rules ( wanted : & [ RuleName ] ) -> Vec < & ' static Rule > {
105133 static NAMED_RULES : OnceLock < BTreeMap < RuleName , Rule > > = OnceLock :: new ( ) ;
106134 let named_rules = NAMED_RULES . get_or_init ( make_named_rules) ;
0 commit comments