Ref: https://wicg.github.io/urlpattern/#is-a-search-prefix
(&self)
| 58 | |
| 59 | // Ref: https://wicg.github.io/urlpattern/#is-a-search-prefix |
| 60 | fn is_search_prefix(&self) -> bool { |
| 61 | if self.is_non_special_pattern_char(self.token_index, "?") { |
| 62 | return true; |
| 63 | } |
| 64 | if self.token_list[self.token_index].value != "?" { |
| 65 | return false; |
| 66 | } |
| 67 | if self.token_index == 0 { |
| 68 | return true; |
| 69 | } |
| 70 | let previous_token = self.get_safe_token(self.token_index - 1); |
| 71 | !matches!( |
| 72 | previous_token.kind, |
| 73 | TokenType::Name |
| 74 | | TokenType::Regexp |
| 75 | | TokenType::Close |
| 76 | | TokenType::Asterisk |
| 77 | ) |
| 78 | } |
| 79 | |
| 80 | // Ref: https://wicg.github.io/urlpattern/#is-a-password-prefix |
| 81 | #[inline] |
no test coverage detected