Xeger.Generator (Xeger v0.1.0)

View Source

Generator for string enumeration from AST patterns.

Generates strings in shortlex order (shortest first, then lexicographic).

An unbounded :rep node (*, +, {m,}) is capped at opts[:max_repeat] repeats when given; without it, stream/2 returns a genuinely infinite stream, walking one length at a time forever. A repeated unit that can itself match the empty string (e.g. (a?)*) would make the per-length repeat count k unbounded too (k * 0 <= len for every k), so that case is capped at len + 1 regardless of :max_repeat -- otherwise generation of that single length would never finish, let alone move on to the next.

Summary

Functions

stream(ast, opts)

@spec stream(
  Xeger.AST.t(),
  keyword()
) :: Enumerable.t()