Handbook
Glossary
capture-closure ( seeds position string table -- ready )
Vocabulary
regexp
.
captures
.
private
Inputs
seeds
an
object
position
an
object
string
an
object
table
an
object
Outputs
ready
an
object
Definition
USING:
accessors
assocs
combinators
kernel
sequences
sets
vectors
;
IN:
regexp.captures.private
::
capture-closure
( seeds position string table -- ready )
seeds
reverse
>vector
:>
work
HS{
}
clone
:>
seen
V{
}
clone
:>
ready
[
work
empty?
not
]
[
work
pop
:>
thread thread
pc>>
:>
pc thread
registers>>
:>
registers pc
{
{
[
dup
capture-branch?
]
[
position string pc
quot>>
( index string -- ? )
call-effect
pc
yes>>
pc
no>>
?
registers
capture-thread
boa
work
push
drop
]
}
{
[
dup
capture-edge?
]
[
drop
pc
label>>
:>
label label
{
~array~ ~array~ ~array~ ~quotation~
}
cond
]
}
[
seen
?adjoin
[
pc table
final-states>>
in?
[
f
registers
capture-thread
boa
ready
push
]
when
pc table
transitions>>
at
<reversed>
[
registers
capture-thread
boa
work
push
]
each
]
when
]
}
cond
]
while
ready
;