MCPcopy Create free account
hub / github.com/davidblewett/rure-python / hir_difference

Function hir_difference

regex/regex-syntax/src/hir/translate.rs:1328–1348  ·  view source on GitHub ↗
(expr1: Hir, expr2: Hir)

Source from the content-addressed store, hash-verified

1326 }
1327
1328 fn hir_difference(expr1: Hir, expr2: Hir) -> Hir {
1329 use hir::Class::{Bytes, Unicode};
1330
1331 match (expr1.into_kind(), expr2.into_kind()) {
1332 (
1333 HirKind::Class(Unicode(mut c1)),
1334 HirKind::Class(Unicode(c2)),
1335 ) => {
1336 c1.difference(&c2);
1337 Hir::class(hir::Class::Unicode(c1))
1338 }
1339 (
1340 HirKind::Class(Bytes(mut c1)),
1341 HirKind::Class(Bytes(c2)),
1342 ) => {
1343 c1.difference(&c2);
1344 Hir::class(hir::Class::Bytes(c1))
1345 }
1346 _ => panic!("cannot difference non-class Hir exprs"),
1347 }
1348 }
1349
1350 fn hir_anchor(anchor: hir::Anchor) -> Hir {
1351 Hir::anchor(anchor)

Callers

nothing calls this directly

Calls 5

classFunction · 0.85
UnicodeClass · 0.85
BytesClass · 0.85
into_kindMethod · 0.80
differenceMethod · 0.45

Tested by

no test coverage detected