This recursively walks down a tree of restriction/union types.
This recursively walks down a tree of restriction/union types.
For each restriction, it checks facets. For each union, it stops at the first things satisfied, and sets the unionMember in the infoset element, which provides DFDL's unionMemberSchema functionality.
Note that we don't pre-flatten unions into flat lists. We could but since a union can be a restriction derived from a union, and within that union can be other restrictions derived from other unions, we'd have to massage around the facet checking (push-down) to the "leaf level" types of the union, and that would result in them being checked redundantly, and potentially make diagnostics harder because the transformed type wouldn't match the written DFDL schema's structure.
Better to just walk the nest recursively.
Performs the constraint checks using information contained within the PState object.
Performs the constraint checks using information contained within the PState object.
a Unit on success, String (message) on failure.
These are creators of regex pattern matcher objects.
These are creators of regex pattern matcher objects. we want to avoid allocating Matchers, so this is thread-safe in terms of allocating and returning the matchers, and we need this generally because matchers are stateful so cannot be shared across threads.