@@ -19,6 +19,7 @@ use std::mem::MaybeUninit;
19
19
/// # fn dummy(function_name: &String) { let _ =
20
20
/// match_ignore_ascii_case! { &function_name,
21
21
/// "rgb" => parse_rgb(..),
22
+ /// # #[cfg(not(something))]
22
23
/// "rgba" => parse_rgba(..),
23
24
/// "hsl" => parse_hsl(..),
24
25
/// "hsla" => parse_hsla(..),
@@ -35,6 +36,7 @@ use std::mem::MaybeUninit;
35
36
macro_rules! match_ignore_ascii_case {
36
37
( $input: expr,
37
38
$(
39
+ $( #[ $meta: meta] ) *
38
40
$( $pattern: pat ) |+ $( if $guard: expr ) ? => $then: expr
39
41
) ,+
40
42
$( , ) ?
@@ -46,15 +48,16 @@ macro_rules! match_ignore_ascii_case {
46
48
// rather than expression/statement context,
47
49
// even though the macro only expands to items.
48
50
mod cssparser_internal {
49
- $crate:: cssparser_internal__match_ignore_ascii_case__support ! {
51
+ $crate:: _cssparser_internal_max_len ! {
50
52
$( $( $pattern ) + ) +
51
53
}
52
54
}
53
- cssparser_internal__to_lowercase !( $input, cssparser_internal:: MAX_LENGTH => lowercase) ;
55
+ _cssparser_internal_to_lowercase !( $input, cssparser_internal:: MAX_LENGTH => lowercase) ;
54
56
// "A" is a short string that we know is different for every string pattern,
55
57
// since we’ve verified that none of them include ASCII upper case letters.
56
58
match lowercase. unwrap_or( "A" ) {
57
59
$(
60
+ $( #[ $meta] ) *
58
61
$( $pattern ) |+ $( if $guard ) ? => $then,
59
62
) +
60
63
}
@@ -95,15 +98,19 @@ macro_rules! ascii_case_insensitive_phf_map {
95
98
pub fn $name( input: & str ) -> Option <& ' static $ValueType> {
96
99
// This dummy module works around a feature gate,
97
100
// see comment on the similar module in `match_ignore_ascii_case!` above.
98
- mod cssparser_internal {
99
- use $crate:: _internal__phf:: { Map , phf_map} ;
100
- #[ allow( unused) ] use super :: * ;
101
- $crate:: cssparser_internal__ascii_case_insensitive_phf_map__support! {
102
- $ValueType $( $key $value ) +
101
+ mod _cssparser_internal {
102
+ $crate:: _cssparser_internal_max_len! {
103
+ $( $key ) +
103
104
}
104
105
}
105
- cssparser_internal__to_lowercase!( input, cssparser_internal:: MAX_LENGTH => lowercase) ;
106
- lowercase. and_then( |s| cssparser_internal:: MAP . get( s) )
106
+ use $crate:: _cssparser_internal_phf as phf;
107
+ static MAP : phf:: Map <& ' static str , $ValueType> = phf:: phf_map! {
108
+ $(
109
+ $key => $value,
110
+ ) *
111
+ } ;
112
+ _cssparser_internal_to_lowercase!( input, _cssparser_internal:: MAX_LENGTH => lowercase) ;
113
+ lowercase. and_then( |s| MAP . get( s) )
107
114
}
108
115
}
109
116
}
@@ -113,19 +120,19 @@ macro_rules! ascii_case_insensitive_phf_map {
113
120
/// **This macro is not part of the public API. It can change or be removed between any versions.**
114
121
///
115
122
/// Define a local variable named `$output`
116
- /// and assign it the result of calling `_internal__to_lowercase `
123
+ /// and assign it the result of calling `_cssparser_internal_to_lowercase `
117
124
/// with a stack-allocated buffer of length `$BUFFER_SIZE`.
118
125
#[ macro_export]
119
126
#[ doc( hidden) ]
120
- macro_rules! cssparser_internal__to_lowercase {
127
+ macro_rules! _cssparser_internal_to_lowercase {
121
128
( $input: expr, $BUFFER_SIZE: expr => $output: ident) => {
122
129
#[ allow( unsafe_code) ]
123
130
let mut buffer = unsafe {
124
131
:: std:: mem:: MaybeUninit :: <[ :: std:: mem:: MaybeUninit <u8 >; $BUFFER_SIZE] >:: uninit( )
125
132
. assume_init( )
126
133
} ;
127
134
let input: & str = $input;
128
- let $output = $crate:: _internal__to_lowercase ( & mut buffer, input) ;
135
+ let $output = $crate:: _cssparser_internal_to_lowercase ( & mut buffer, input) ;
129
136
} ;
130
137
}
131
138
@@ -137,7 +144,7 @@ macro_rules! cssparser_internal__to_lowercase {
137
144
/// Otherwise, return `input` ASCII-lowercased, using `buffer` as temporary space if necessary.
138
145
#[ doc( hidden) ]
139
146
#[ allow( non_snake_case) ]
140
- pub fn _internal__to_lowercase < ' a > (
147
+ pub fn _cssparser_internal_to_lowercase < ' a > (
141
148
buffer : & ' a mut [ MaybeUninit < u8 > ] ,
142
149
input : & ' a str ,
143
150
) -> Option < & ' a str > {
0 commit comments