Look

halotukozak.regex.Regex.Look
final case class Look

Zero-width lookahead assertion. positive = true is (?=r): holds at a position iff some prefix of the string remaining there is in L(r), without consuming any of it. positive = false is (?!r): holds iff no such prefix exists.

Attributes

Source
Regex.scala

Members list

Value members

Inherited methods

infix def &(other: Regex): Regex

Intersection: this ∩ other.

Intersection: this ∩ other.

Attributes

Inherited from:
Regex
Source
Regex.scala
def *: Regex

Attributes

Inherited from:
Regex
Source
Regex.scala
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala
def repeat(lo: Int, hi: Int): Regex

Quantifier this{lo,hi} where hi can be Int.MaxValue for unbounded. Produces a single Repeat node carrying lo/hi symbolically - not lo/hi copies of this - the way regex-syntax (Rust's regex crate) keeps counted repetitions unexpanded in its Hir so AST size stays proportional to the pattern's text, not the language it denotes; a {1,1000} quantifier used to mean ~1000 Concat/Alt nodes here too, which was both wasted allocation on every call and, when spliced by regex"..."'s ToExpr[Regex], deep enough to overflow the compiler's own stack expanding the macro.

Quantifier this{lo,hi} where hi can be Int.MaxValue for unbounded. Produces a single Repeat node carrying lo/hi symbolically - not lo/hi copies of this - the way regex-syntax (Rust's regex crate) keeps counted repetitions unexpanded in its Hir so AST size stays proportional to the pattern's text, not the language it denotes; a {1,1000} quantifier used to mean ~1000 Concat/Alt nodes here too, which was both wasted allocation on every call and, when spliced by regex"..."'s ToExpr[Regex], deep enough to overflow the compiler's own stack expanding the macro.

Attributes

Inherited from:
Regex
Source
Regex.scala
def star: Regex

Kleene star: this*.

Kleene star: this*.

Attributes

Inherited from:
Regex
Source
Regex.scala
def unary_!: Regex

Complement: ¬this.

Complement: ¬this.

Attributes

Inherited from:
Regex
Source
Regex.scala
infix def |(other: Regex): Regex

Alternation: this | other, preferring this - see Regex.Alt's doc comment.

Alternation: this | other, preferring this - see Regex.Alt's doc comment.

Attributes

Inherited from:
Regex
Source
Regex.scala

Inherited fields

lazy val alphabetBoundaries: SortedSet[Int]

Cached: sorted boundary points (range starts, and one-past-the-end of range ends) of every Chars leaf reachable from this node — the raw material Subset.partitionReps combines with the sentinels 0/CharSet.maxCodePoint + 1 to pick one representative code point per equivalence class of the alphabet partition. This is queried once per BFS state during Subset.isEmptyImpl/subset; recomputing it by re-walking the whole subtree on every state (most of which share large unchanged substructures across consecutive derivative steps) would repeatedly re-derive the same per-node result.

Cached: sorted boundary points (range starts, and one-past-the-end of range ends) of every Chars leaf reachable from this node — the raw material Subset.partitionReps combines with the sentinels 0/CharSet.maxCodePoint + 1 to pick one representative code point per equivalence class of the alphabet partition. This is queried once per BFS state during Subset.isEmptyImpl/subset; recomputing it by re-walking the whole subtree on every state (most of which share large unchanged substructures across consecutive derivative steps) would repeatedly re-derive the same per-node result.

Attributes

Inherited from:
Regex
Source
Regex.scala
lazy val hasEndAnchor: Boolean

Cached: true iff $/\Z/\z occurs anywhere in this tree. They parse to the end-of-input lookahead (?!.) over every code point, so a pattern with one matches only where the input ends - e.g. a TokenMatcher pattern that matches only as the input's last token. The same plain structural recursion as hasStartAnchor.

Cached: true iff $/\Z/\z occurs anywhere in this tree. They parse to the end-of-input lookahead (?!.) over every code point, so a pattern with one matches only where the input ends - e.g. a TokenMatcher pattern that matches only as the input's last token. The same plain structural recursion as hasStartAnchor.

Attributes

Inherited from:
Regex
Source
Regex.scala
lazy val hasStartAnchor: Boolean

Cached: true iff ^/\A occurs anywhere in this tree, including inside Look bodies (a start-anchor there refers to the same global position as the Look node itself) and Star bodies (loop iterations past the first can never be at position 0 again). Guards Subset.derive's post-derivation strip pass so it's a single cheap check - not a tree walk - for the overwhelming majority of patterns that never use ^/\A at all.

Cached: true iff ^/\A occurs anywhere in this tree, including inside Look bodies (a start-anchor there refers to the same global position as the Look node itself) and Star bodies (loop iterations past the first can never be at position 0 again). Guards Subset.derive's post-derivation strip pass so it's a single cheap check - not a tree walk - for the overwhelming majority of patterns that never use ^/\A at all.

Deliberately plain structural recursion through each child's own .hasStartAnchor (not a worklist loop): Subset.stripStartAnchor re-checks this at every level of its own descent, relying on it being O(1) once the top-level check has run - which only holds if reaching a child here forces (and permanently caches, via that child's own lazy val) that child's result too. A worklist loop computing the boolean inline, without ever touching each child's own hasStartAnchor, would lose exactly that cross-node memoization and turn stripStartAnchor's per-level "cheap check" into a fresh sub-tree walk at every level - same trade nullable/alphabetBoundaries above already decline for the same reason, and (like them) can't use deepRecursive either: a lazy val's self-references are bare Selects, not Apply nodes, so the macro has nothing to trampoline. Shares their same pre-existing, accepted stack-depth ceiling as a result.

Attributes

Inherited from:
Regex
Source
Regex.scala
lazy override val hashCode: Int

Cached: this tree is immutable and gets hashed repeatedly by the Set-based ACI normalization in Regex.alt/Regex.inter and by the visited-state set driving Brzozowski derivative exploration in Subset — recomputing structurally every time would walk the whole subtree on each lookup.

Cached: this tree is immutable and gets hashed repeatedly by the Set-based ACI normalization in Regex.alt/Regex.inter and by the visited-state set driving Brzozowski derivative exploration in Subset — recomputing structurally every time would walk the whole subtree on each lookup.

Attributes

Inherited from:
Regex
Source
Regex.scala
lazy val nullable: Boolean

Cached: nullability is invariant per node but gets re-queried by Subset.deriveImpl's Concat case on every derivative step (once per representative char, for every Concat node on the path) — recomputing structurally every time would re-walk the same subtree over and over during Brzozowski derivative exploration.

Cached: nullability is invariant per node but gets re-queried by Subset.deriveImpl's Concat case on every derivative step (once per representative char, for every Concat node on the path) — recomputing structurally every time would re-walk the same subtree over and over during Brzozowski derivative exploration.

Attributes

Inherited from:
Regex
Source
Regex.scala