Subset

halotukozak.regex.Subset$package.Subset
object Subset

Attributes

Source
Subset.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Subset.type

Members list

Type members

Classlikes

object given_ToExpr_Subset extends ToExpr[Subset]

Attributes

Source
Subset.scala
Supertypes
trait ToExpr[Subset]
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

def of(r: Regex): Subset

Lifts an existing Regex into Subset, erasing every Regex.Group wrapper it contains along the way (Regex.Group's own doc comment covers why that's a safe, language-preserving transform: L(Group(_, _, inner)) = L(inner) exactly). Capturing groups matter to code that walks a Regex tree directly (the parser, a future capture-span extractor) - they're invisible to every containment/matching question this type answers, so there's no reason for any of rawDerive/stripStartAnchor/hasLeadingLook below to know Group exists at all, and erasing here guarantees they never have to find out.

Lifts an existing Regex into Subset, erasing every Regex.Group wrapper it contains along the way (Regex.Group's own doc comment covers why that's a safe, language-preserving transform: L(Group(_, _, inner)) = L(inner) exactly). Capturing groups matter to code that walks a Regex tree directly (the parser, a future capture-span extractor) - they're invisible to every containment/matching question this type answers, so there's no reason for any of rawDerive/stripStartAnchor/hasLeadingLook below to know Group exists at all, and erasing here guarantees they never have to find out.

Attributes

Source
Subset.scala
def parse(pattern: String): Either[RegexParseError, Subset]

Parses a pattern into a Subset.

Parses a pattern into a Subset.

Attributes

Source
Subset.scala

Concrete fields

val empty: Subset

The empty-language subset; reference-equal to Regex.Empty under the opaque type.

The empty-language subset; reference-equal to Regex.Empty under the opaque type.

Attributes

Source
Subset.scala

Givens

Givens

Extensions

Extensions

extension (a: Subset)
def derive(c: Int): Subset

Brzozowski derivative of a with respect to code point c. Wrapped with stripStartAnchor: whatever rawDerive returns represents "having consumed c from a", meaning at least one character has now been consumed somewhere in the whole match, so any ^/\A reachable in that raw result — even one that was never itself touched by this step, e.g. because it sat untouched inside an undivided sibling — has to die. See stripStartAnchor's doc for why this can't be handled locally the way Look is.

Brzozowski derivative of a with respect to code point c. Wrapped with stripStartAnchor: whatever rawDerive returns represents "having consumed c from a", meaning at least one character has now been consumed somewhere in the whole match, so any ^/\A reachable in that raw result — even one that was never itself touched by this step, e.g. because it sat untouched inside an undivided sibling — has to die. See stripStartAnchor's doc for why this can't be handled locally the way Look is.

Attributes

Source
Subset.scala
def isEmpty: Boolean

true iff L(a) = ∅.

true iff L(a) = ∅.

Attributes

Source
Subset.scala
def isEmptyBounded(maxStates: Int): Either[StateSpaceLimitExceeded, Boolean]

Like isEmpty, but fails fast with Left(StateSpaceLimitExceeded(maxStates)) the moment the BFS would need to have visited more than maxStates distinct derivative states to keep going, instead of exploring an unbounded number of them. Opt-in guard for callers deciding emptiness/subset (see subsetBounded) of a pattern that may come from untrusted input - see StateSpaceLimitExceeded.

Like isEmpty, but fails fast with Left(StateSpaceLimitExceeded(maxStates)) the moment the BFS would need to have visited more than maxStates distinct derivative states to keep going, instead of exploring an unbounded number of them. Opt-in guard for callers deciding emptiness/subset (see subsetBounded) of a pattern that may come from untrusted input - see StateSpaceLimitExceeded.

Attributes

Source
Subset.scala
def nullable: Boolean

true iff ε ∈ L(a).

true iff ε ∈ L(a).

Attributes

Source
Subset.scala
def properSubset(b: Subset): Boolean

true iff L(a) ⊆ L(b) and L(a) ≠ L(b).

true iff L(a) ⊆ L(b) and L(a) ≠ L(b).

Attributes

Source
Subset.scala
def subset(b: Subset): Boolean

true iff L(a) ⊆ L(b).

true iff L(a) ⊆ L(b).

Attributes

Source
Subset.scala
def subsetBounded(b: Subset, maxStates: Int): Either[StateSpaceLimitExceeded, Boolean]

Like subset, but fails fast with StateSpaceLimitExceeded instead of letting the underlying isEmptyBounded BFS visit more than maxStates distinct derivative states - see StateSpaceLimitExceeded for why that matters on untrusted patterns.

Like subset, but fails fast with StateSpaceLimitExceeded instead of letting the underlying isEmptyBounded BFS visit more than maxStates distinct derivative states - see StateSpaceLimitExceeded for why that matters on untrusted patterns.

Attributes

Source
Subset.scala

Underlying Regex.

Underlying Regex.

Attributes

Source
Subset.scala

Σ*-extended view — matches every string having a as prefix.

Σ*-extended view — matches every string having a as prefix.

Attributes

Source
Subset.scala