Group
Capturing group (...) / named group (?...). Purely a marker for where a capture begins and ends - L(Group(_, _, inner)) = L(inner) exactly, and every operation in this file (nullable, alphabetBoundaries, hasStartAnchor, and every smart constructor) treats it as fully transparent, recursing straight through to inner. Subset goes one step further and erases every Group node outright before ever deriving through it (see that file's doc comment for why) - so this node only matters to code that walks a Regex tree directly looking for where groups are, not to anything answering a containment/matching question through Subset.
index is the group's 1-based number, assigned left-to-right by opening paren (0 is reserved for "the whole match", which isn't its own node); name is Some for (?...), None for a bare (...). (?:...) (explicitly non-capturing) produces no Group node at all, same as today.
Attributes
- Source
- Regex.scala
Members list
Value members
Inherited methods
Intersection: this ∩ other.
Attributes
- Inherited from:
- Regex
- Source
- Regex.scala
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
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
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
Kleene star: this*.
Complement: ¬this.
Inherited fields
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
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
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
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
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