Handbook
Glossary
grapheme-class ( str -- class )
Vocabulary
unicode
.
breaks
.
private
Inputs
str
an
object
Outputs
class
an
object
Definition
USING:
combinators
combinators.short-circuit
interval-maps
kernel
sequences
unicode.normalize.private
;
IN:
unicode.breaks.private
::
grapheme-class
( str -- class )
str
last
{
{
[
dup
jamo?
]
[
jamo-class
]
}
{
[
dup
hangul?
]
[
hangul-class
]
}
{
[
dup
grapheme-control?
]
[
control-class
dup
ZWJ
=
[
drop
str
unclip-last-slice
drop
dup
[
~array~
1||
not
]
find-last
drop
[
swap
?nth
]
[
last
]
if*
extended-pictographic-table
interval-key?
[
(Extended_Pictographic-Extend*-)ZWJ
]
[
ZWJ
]
if
]
when
]
}
{
[
dup
extend?
]
[
drop
Extend
]
}
{
[
dup
modifier?
]
[
drop
Extend
]
}
{
[
dup
spacing?
]
[
spacing-mark-exceptions-table
interval-key?
[
Any
]
[
SpacingMark
]
if
]
}
{
[
dup
loe?
]
[
drop
Prepend
]
}
{
[
dup
regional?
]
[
drop
f
:>
ri-even?! str
unclip-last-slice
drop
[
regional?
[
ri-even?
not
ri-even?!
f
]
[
t
]
if
]
find-last
2drop
ri-even?
[
Regional_Indicator(even)
]
[
Regional_Indicator(odd)
]
if
]
}
{
[
dup
extended-pictographic-table
interval-key?
]
[
drop
Extended_Pictographic
]
}
[
drop
Any
]
}
cond
;