Skip to content

Commit

Permalink
Renamed LazyList to Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Jan 24, 2025
1 parent 146dbca commit f463353
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/gossamer-core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,20 @@ extension [TextType: Textual](text: TextType)
def contains(substring: into Text): Boolean = TextType.indexOf(text, substring).present
def contains(char: Char): Boolean = TextType.indexOf(text, char.show).present

def search(regex: Regex, overlap: Boolean = false): LazyList[TextType] =
def search(regex: Regex, overlap: Boolean = false): Stream[TextType] =
regex.search(TextType.text(text), overlap = overlap).map(text.segment(_))

def extract[ValueType](start: Ordinal)(lambda: Matching ?=> TextType ~> ValueType)
: LazyList[ValueType] =
: Stream[ValueType] =

val input = TextType.text(text)
if start.n0 < input.s.length then
val matching = Matching(start.n0)
lambda(using matching).lift(text) match
case Some(head) => head #:: extract(matching.nextStart.or(0).z)(lambda)
case _ => LazyList()
case _ => Stream()

else LazyList()
else Stream()

def seek(regex: Regex): Optional[TextType] = regex.seek(TextType.text(text)).let(text.segment(_))

Expand Down

0 comments on commit f463353

Please sign in to comment.