hydra.print.pcre.regex module

Per-dialect printer rendering the hydra.regex AST into the PCRE / java.util.regex / ECMA family syntax (Java, Scala, Clojure, Python, Common Lisp, TypeScript). Differs from the canonical hydra.print.regex in exactly one place: Hydra’s . (any character INCLUDING newline) renders as [sS] rather than a bare . (whose native meaning excludes newline in these engines). All other productions match the canonical form. See docs/specification/regex.md and issue #567.

hydra.print.pcre.regex.alternation(alt: Sequence[Sequence[Quantified]]) str

Render an alternation, joining its branches with the | operator.

hydra.print.pcre.regex.atom(a: Atom) str

Render a single atom; the . metacharacter renders as [sS] to preserve newline-inclusive ‘any’.

hydra.print.pcre.regex.character_class(cc: CharacterClass) str

Render a character class, including the leading ^ for a negated class.

hydra.print.pcre.regex.class_item(item: ClassItem) str

Render one character-class member (a single character or an inclusive range).

hydra.print.pcre.regex.escape_class_char(c: int) str

Render a code point inside a character class, uniformly escaping the class metacharacters ] ^ -.

hydra.print.pcre.regex.escape_literal(c: int) str

Render a literal code point in top-level context, backslash-escaping PCRE/ECMA metacharacters.

hydra.print.pcre.regex.print_code_point(c: int) str

Render a single Unicode code point as a one-character string.

hydra.print.pcre.regex.print_regex(r: Sequence[Sequence[Quantified]]) str

Render a hydra.regex AST into PCRE / java.util.regex / ECMA syntax. Identical to the canonical printer except that . (any incl. newline) becomes [sS].

hydra.print.pcre.regex.quantified(qa: Quantified) str

Render an atom followed by its quantifier suffix.

hydra.print.pcre.regex.quantifier(q: Quantifier) str

Render a quantifier suffix; the ‘one’ quantifier renders as the empty string.

hydra.print.pcre.regex.regex_sequence(s: Sequence[Quantified]) str

Render a sequence of quantified atoms by concatenation.