@@ -6,19 +6,21 @@ use crate::parser::CssParser;
66use crate :: syntax:: css_modules:: {
77 composes_not_allowed, expected_classes_list, expected_composes_import_source,
88} ;
9- use crate :: syntax:: parse_error:: { expected_component_value, expected_identifier} ;
9+ use crate :: syntax:: parse_error:: {
10+ expected_component_value, expected_identifier, tailwind_disabled,
11+ } ;
1012use crate :: syntax:: {
11- is_at_any_value, is_at_dashed_identifier, is_at_identifier, is_at_string, parse_any_value ,
12- parse_custom_identifier_with_keywords , parse_dashed_identifier , parse_regular_identifier ,
13- parse_string,
13+ CssSyntaxFeatures , is_at_any_value, is_at_dashed_identifier, is_at_identifier, is_at_string,
14+ parse_any_value , parse_custom_identifier_with_keywords , parse_dashed_identifier ,
15+ parse_regular_identifier , parse_string,
1416} ;
1517use biome_css_syntax:: CssSyntaxKind :: * ;
1618use biome_css_syntax:: { CssSyntaxKind , T } ;
1719use biome_parser:: parse_lists:: ParseNodeList ;
1820use biome_parser:: parse_recovery:: { ParseRecovery , ParseRecoveryTokenSet , RecoveryResult } ;
1921use biome_parser:: prelude:: ParsedSyntax ;
2022use biome_parser:: prelude:: ParsedSyntax :: { Absent , Present } ;
21- use biome_parser:: { Parser , TokenSet , token_set} ;
23+ use biome_parser:: { Parser , SyntaxFeature , TokenSet , token_set} ;
2224
2325#[ inline]
2426pub ( crate ) fn is_at_any_property ( p : & mut CssParser ) -> bool {
@@ -160,7 +162,11 @@ const END_OF_COMPOSES_CLASS_TOKEN_SET: TokenSet<CssSyntaxKind> =
160162#[ inline]
161163fn is_at_generic_property ( p : & mut CssParser ) -> bool {
162164 is_at_identifier ( p)
163- && ( p. nth_at ( 1 , T ! [ : ] ) || ( p. nth_at ( 1 , T ! [ -] ) && p. nth_at ( 2 , T ! [ * ] ) && p. nth_at ( 3 , T ! [ : ] ) ) )
165+ && ( p. nth_at ( 1 , T ! [ : ] )
166+ // handle --*:
167+ || ( p. nth_at ( 1 , T ! [ * ] ) && p. nth_at ( 2 , T ! [ : ] ) )
168+ // handle --color-*:
169+ || ( p. nth_at ( 1 , T ! [ -] ) && p. nth_at ( 2 , T ! [ * ] ) && p. nth_at ( 3 , T ! [ : ] ) ) )
164170}
165171
166172#[ inline]
@@ -174,13 +180,22 @@ fn parse_generic_property(p: &mut CssParser) -> ParsedSyntax {
174180 if is_at_dashed_identifier ( p) {
175181 let ident = parse_dashed_identifier ( p) . ok ( ) ;
176182 if let Some ( ident) = ident
177- && p. options ( ) . is_tailwind_directives_enabled ( )
178- && p. at ( T ! [ -] )
183+ && p. at_ts ( token_set ! [ T ![ -] , T ![ * ] ] )
179184 {
180- let m = ident. precede ( p) ;
181- p. expect ( T ! [ -] ) ;
182- p. expect ( T ! [ * ] ) ;
183- m. complete ( p, TW_VALUE_THEME_REFERENCE ) ;
185+ CssSyntaxFeatures :: Tailwind
186+ . parse_exclusive_syntax (
187+ p,
188+ |p| {
189+ let m = ident. precede ( p) ;
190+ if p. at ( T ! [ -] ) {
191+ p. expect ( T ! [ -] ) ;
192+ }
193+ p. expect ( T ! [ * ] ) ;
194+ Present ( m. complete ( p, TW_VALUE_THEME_REFERENCE ) )
195+ } ,
196+ |p, m| tailwind_disabled ( p, m. range ( p) ) ,
197+ )
198+ . ok ( ) ;
184199 }
185200 } else {
186201 parse_regular_identifier ( p) . ok ( ) ;
0 commit comments