Handbook
Glossary
pcre2
Vocabulary
pcre2
Definition
USING:
destructors
;
IN:
pcre2
TUPLE:
pcre2
<
disposable
handle
;
Methods
USING:
accessors
destructors
pcre2
pcre2.ffi
;
M:
pcre2
dispose*
handle>>
pcre2_code_free
;
USING:
accessors
alien.data
alien.strings
arrays
assocs
combinators
destructors
endian
grouping
io.encodings.string
io.encodings.utf8
kernel
make
math
pcre2
pcre2.ffi
pcre2.private
sequences
sorting
;
M::
pcre2
findall
( subject obj -- matches )
[
subject
utf8
encode
:>
subject_bytes subject_bytes
length
:>
subject_length
obj
handle>>
:>
re re
pcre2-utf?
:>
utf? re
pcre2-crlf?
:>
crlf? re
f
pcre2_match_data_create_from_pattern
&pcre2_match_data_free
:>
match_data 0
:>
start_offset!
0
:>
options! re subject_bytes subject_length
start_offset options match_data
f
pcre2_match
:>
rc re
pcre2-name-count
:>
name_count name_count
[
f
]
[
re
pcre2-name-table
re
pcre2-name-entry-size
[
rot
*
memory>byte-array
]
[
<groups>
]
bi
[
2
cut
[
be>
]
[
utf8
alien>string
]
bi*
]
map>alist
sort-keys
]
if-zero
:>
name_table rc 0
<
[
rc
{
{
PCRE2_ERROR_NOMATCH
[
~array~
]
}
[
throw
]
}
case
]
[
match_data
pcre2_get_ovector_pointer
rc
assert-positive
2
*
PCRE2_SIZE
<c-direct-array>
:>
ovector
[
[
f
ovector
first2
subject
subseq
2array
,
name_table
[
ovector
rot
2
*
tail-slice
first2
subject
subseq
2array
,
]
assoc-each
]
{
}
make
,
[
f
:>
break?! 0 options! ovector
second
start_offset! ovector
first2
=
[
ovector
first
subject_length
=
2147483656 options!
]
[
match_data
pcre2_get_startchar
:>
startchar start_offset startchar
<=
~quotation~ ~quotation~
if
]
if
[
f
]
[
re subject_bytes subject_length
start_offset options match_data
f
pcre2_match
:>
rc rc
PCRE2_ERROR_NOMATCH
=
~quotation~ ~quotation~
if
]
if
]
loop
]
{
}
make
]
if
]
with-destructors
;