12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152(* Copyright (C) 2022 Petter A. Urkedal <paurkedal@gmail.com>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version, with the LGPL-3.0 Linking Exception.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* and the LGPL-3.0 Linking Exception along with this library. If not, see
* <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively.
*)openAllkeysletimplicitwAwB=letelements=[|E.create[|wA;0x20;0x2|];E.create[|wB|];|]inM.Accept(elements,rej)letfallbackch=letk=Uchar.to_intchinif0x17000<=k&&k<=0x18AFF||0x18D00<=k&&k<=0x18D8Fthenimplicit0xFB00((k-0x17000)lor0x8000)elseif0x1B170<=k&&k<=0x1B2FFthenimplicit0xFB01((k-0x1B170)lor0x8000)elseif0x18B00<=k&&k<=0x18CFFthenimplicit0xFB02((k-0x18B00)lor0x8000)elseletw0=ifUucp.Cjk.is_unified_ideographchthenif0x4e00<=k&&k<0x10000then0xfb40else0xfb80else0xFBC0inimplicit(w0+klsr15)(kland0x7FFFlor0x8000)letmappingch=(matchAllkeys.mappingchwith|M.Accept_asnode->node|M.Reject->fallbackch)let()=Confero.register_collation_mappingmapping