@@ -86,24 +86,25 @@ component_type component_replacement(StringView path) noexcept {
8686
8787 for (std::size_t i = 0 ; i < path.size (); ++i) {
8888 char c = path[i];
89- found_special_char = found_special_char || is_str_special (c);
90- found_digit = found_digit || is_digit (c);
9189
92- std::uint8_t digit_mask =
93- bool2mask (is_digit (c)) &
94- (component_type::is_int | component_type::is_int_id |
95- component_type::is_hex | component_type::is_hex_id);
96-
97- std::uint8_t hex_alpha_mask =
98- bool2mask (is_hex_alpha (c)) &
99- (component_type::is_hex | component_type::is_hex_id);
100-
101- std::uint8_t delimiter_mask =
102- bool2mask (is_delim (c)) &
103- (component_type::is_int_id | component_type::is_hex_id);
104-
105- viable_components &=
106- (digit_mask | hex_alpha_mask | delimiter_mask | component_type::is_str);
90+ if (is_str_special (c)) {
91+ found_special_char = true ;
92+ viable_components &=
93+ ~(component_type::is_int | component_type::is_int_id |
94+ component_type::is_hex | component_type::is_hex_id);
95+ } else if (is_hex_alpha (c)) {
96+ viable_components &=
97+ ~(component_type::is_int | component_type::is_int_id);
98+ } else if (is_delim (c)) {
99+ viable_components &= ~(component_type::is_int | component_type::is_hex);
100+ } else if (is_digit (c)) {
101+ found_digit = true ;
102+ } else {
103+ // other character
104+ viable_components &=
105+ ~(component_type::is_int | component_type::is_int_id |
106+ component_type::is_hex | component_type::is_hex_id);
107+ }
107108 }
108109
109110 // is_str requires a special char or a size >= 20
0 commit comments