MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / item_match

Function item_match

std/re/src/main/matcher.rs:272–283  ·  view source on GitHub ↗

Predefined class predicates lean on std, so Unicode needs no tables. */

(item: &ClassItem, c: char)

Source from the content-addressed store, hash-verified

270
271/* Predefined class predicates lean on std, so Unicode needs no tables. */
272fn item_match(item: &ClassItem, c: char) -> bool {
273 match item {
274 ClassItem::Ch(x) => c == *x,
275 ClassItem::Range(lo, hi) => *lo <= c && c <= *hi,
276 ClassItem::Digit => c.is_numeric(),
277 ClassItem::NotDigit => !c.is_numeric(),
278 ClassItem::Word => is_word(c),
279 ClassItem::NotWord => !is_word(c),
280 ClassItem::Space => c.is_whitespace(),
281 ClassItem::NotSpace => !c.is_whitespace(),
282 }
283}
284
285fn class_contains(items: &[ClassItem], c: char) -> bool {
286 items.iter().any(|it| item_match(it, c))

Callers 1

class_containsFunction · 0.85

Calls 2

is_wordFunction · 0.85
is_numericMethod · 0.80

Tested by

no test coverage detected