BOUNDARY: write a regex as data, get a Pattern the existing subsystem already knows how to run.
(api/->expr :java [:cat :start [:+ :digit] :end]) ;; => {:ok "^\d+$"}
(api/register! #:pattern{:id :audit/probe} [:cat "ready" [:? "?"]]) (pattern/match? :audit/probe "ready?")
A Construct projects INTO the existing Pattern value object rather than
replacing it: :pattern/expr is filled from the construct, :pattern/construct
records what it was built from, and everything downstream — the registry's
validation, IPatternEngine, match?, scan — is untouched. A pattern
written as a literal string keeps working exactly as before.
register! goes through pattern.registry/register-pattern! so a construct
that projects to an invalid Pattern is refused at the same gate as every
other pattern.
BOUNDARY: write a regex as data, get a Pattern the existing subsystem
already knows how to run.
(api/->expr :java [:cat :start [:+ :digit] :end])
;; => {:ok "^\\d+$"}
(api/register! #:pattern{:id :audit/probe} [:cat "ready" [:? "?"]])
(pattern/match? :audit/probe "ready?")
A Construct projects INTO the existing `Pattern` value object rather than
replacing it: `:pattern/expr` is filled from the construct, `:pattern/construct`
records what it was built from, and everything downstream — the registry's
validation, `IPatternEngine`, `match?`, `scan` — is untouched. A pattern
written as a literal string keeps working exactly as before.
`register!` goes through `pattern.registry/register-pattern!` so a construct
that projects to an invalid Pattern is refused at the same gate as every
other pattern.Dialect used when a caller names none. The JVM runs the default engine.
Dialect used when a caller names none. The JVM runs the default engine.
(->expr form)(->expr dialect-id form)Result<String>: FORM as a regex source string in DIALECT-ID.
FORM is regal's authored syntax or a normalized Construct. A construct the dialect cannot express is refused, never approximated.
Result<String>: FORM as a regex source string in DIALECT-ID. FORM is regal's authored syntax or a normalized Construct. A construct the dialect cannot express is refused, never approximated.
(->pattern base form)(->pattern dialect-id base form)Result<Pattern>: BASE (a Pattern map without :pattern/expr) completed from
FORM. :pattern/construct records the normalized construct, so the source of
an expression survives into the registry.
Result<Pattern>: BASE (a Pattern map without `:pattern/expr`) completed from FORM. `:pattern/construct` records the normalized construct, so the source of an expression survives into the registry.
(explain form)Result<map>: what FORM needs, and which registered dialects can express it.
The introspection surface — use it before shelling a pattern to rg.
Result<map>: what FORM needs, and which registered dialects can express it. The introspection surface — use it before shelling a pattern to `rg`.
(register! base form)(register! dialect-id base form)Build a Pattern from BASE + FORM and register it. Result<Pattern>.
Refused — and not stored — if the construct will not normalize, the dialect cannot express it, or the projected Pattern fails the Pattern schema.
Build a Pattern from BASE + FORM and register it. Result<Pattern>. Refused — and not stored — if the construct will not normalize, the dialect cannot express it, or the projected Pattern fails the Pattern schema.
(supported? dialect-id form)Can DIALECT-ID express FORM? Result<boolean> — an unnormalizable form is an error, not a false.
Can DIALECT-ID express FORM? Result<boolean> — an unnormalizable form is an error, not a false.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |