]> git.proxmox.com Git - rustc.git/blob - vendor/bstr/scripts/regex/grapheme.sh
New upstream version 1.70.0+dfsg2
[rustc.git] / vendor / bstr / scripts / regex / grapheme.sh
1 #!/bin/sh
2
3 # vim: indentexpr= nosmartindent autoindent
4 # vim: tabstop=2 shiftwidth=2 softtabstop=2
5
6 # This regex was manually written, derived from the rules in UAX #29.
7 # Particularly, from Table 1c, which lays out a regex for grapheme clusters.
8
9 CR="\p{gcb=CR}"
10 LF="\p{gcb=LF}"
11 Control="\p{gcb=Control}"
12 Prepend="\p{gcb=Prepend}"
13 L="\p{gcb=L}"
14 V="\p{gcb=V}"
15 LV="\p{gcb=LV}"
16 LVT="\p{gcb=LVT}"
17 T="\p{gcb=T}"
18 RI="\p{gcb=RI}"
19 Extend="\p{gcb=Extend}"
20 ZWJ="\p{gcb=ZWJ}"
21 SpacingMark="\p{gcb=SpacingMark}"
22
23 Any="\p{any}"
24 ExtendPict="\p{Extended_Pictographic}"
25
26 echo "(?x)
27 $CR $LF
28 |
29 $Control
30 |
31 $Prepend*
32 (
33 (
34 ($L* ($V+ | $LV $V* | $LVT) $T*)
35 |
36 $L+
37 |
38 $T+
39 )
40 |
41 $RI $RI
42 |
43 $ExtendPict ($Extend* $ZWJ $ExtendPict)*
44 |
45 [^$Control $CR $LF]
46 )
47 [$Extend $ZWJ $SpacingMark]*
48 |
49 $Any
50 "