Files
rose-ash/lib/ocaml/baseline
giles 6c77dec495
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
ocaml: phase 5.1 wildcard_match.ml baseline (* / ? matcher, 6/18 match)
Recursive wildcard matcher:

  let rec is_match s i p j =
    if j = String.length p then i = String.length s
    else if p.[j] = '*' then
         is_match s i p (j + 1)             (* * matches empty   *)
      || (i < String.length s && is_match s (i + 1) p j)  (* * eats char *)
    else
      i < String.length s
      && (p.[j] = '?' || p.[j] = s.[i])
      && is_match s (i + 1) p (j + 1)

Patterns vs texts:
  a*b      | aaab abc abxyz xy xyz axby   -> 1 match
  ?b*c     | aaab abc abxyz xy xyz axby   -> 1 match
  *x*y*    | aaab abc abxyz xy xyz axby   -> 4 matches
                                  total   = 6

Tests deeply nested short-circuit && / ||, char equality on
pattern bytes, doubly-nested List.iter cross product.

173 baseline programs total.
2026-05-11 00:52:42 +00:00
..