package corvus-json-schema
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=d0a084719770883384e488d42ff1a2c0f84a53e2b2898016183533b8393f2cab
sha512=d5875f234b316cd50a888e1a3acc055133d705eb6622e3856c22f6719fa3eae196f1f08cd08cc073cc0924d27e330ae2ea5388142dd5e91b173bdfd91ad997f0
doc/corvus-json-schema.ucd/Corvus_json_schema_ucd/index.html
Module Corvus_json_schema_ucdSource
The Unicode Character Database properties the package reads, for one fixed version of Unicode.
This library is internal to the corvus-json-schema package. It is installed because the package is built from it, and it is not a supported interface: it can change in any release. Programs use Corvus_json_schema.
Nothing in the package takes Unicode properties from anywhere else. With its own tables the package gives the same answers whichever compiler builds it and wherever it runs, and the answers change only when the tables are generated again. version names the version of Unicode they hold.
The tables are in tables.ml, which tools/gen-ucd-tables.ps1 writes. Each is a sorted list of inclusive ranges. A value that follows from other values (a General_Category group such as L, the Assigned property, the Unknown script) has no table of its own and is built from them.
This is a port of the ucd package of the Go module (src-go/corvus-json-schema/internal/ucd). One thing differs. The Go package builds a value that follows from others when it is first asked for, behind a sync.Once. Here every table is made when the module is initialised, as in the Object Pascal port, so that reading a table needs no lock and every value of the module is immutable and safe to share between threads and domains.
A code point is an int. Every function accepts any int and treats one outside 0 to max_rune as a code point that is in no table and has no case mapping.
The version of Unicode the tables hold.
The last Unicode code point, U+10FFFF.
An immutable set of code points.
contains t r reports whether the table holds the code point. It does not allocate.
ranges t returns the ranges of the table as inclusive pairs in ascending order (lo0; hi0; lo1; hi1; ...). The pairs neither overlap nor touch. The array is fresh and the caller may change it.
The bounds of the ranges that end at or below U+FFFF, as the table stores them. A range that crosses U+FFFF is stored in two parts, and this is the first. For the tests.
The bounds of the ranges that start above U+FFFF, as the table stores them. For the tests.
union tables builds the table of the code points that any of the tables holds. A caller that tests one code point against several properties builds their union once and searches one table.
Values built from others
The General_Category values that are groups of other values, the Assigned property and the Unknown script. tools/gen-ucd-tables.ps1 checks each definition against the source of the tables.
The code points that belong to no script. They are the unassigned, private use and surrogate code points.
Tables by name
category name returns the table of a General_Category value by its short name, such as "Lu" or "L". It returns None for any other name.
binary name returns the table of a binary property by its canonical name, such as "Alphabetic" or "White_Space". It returns None for any other name. ASCII and Any, which ECMA-262 adds to the properties of Unicode, are not here.
script name returns the table of a Script value by its long name or an alias, such as "Greek" or "Grek". It returns None for any other name. The value Katakana_Or_Hiragana (Hrkt), which PropertyValueAliases.txt lists and no code point has, is a table with no code point, here and in script_extensions.
script_extensions name returns the table of a Script_Extensions value by the long name of the script or an alias. It returns None for any other name.
The names of every script. Each element is the long name of one script followed by its aliases. The caller must not change it.
The canonical name of every binary property that has a table, which is every name binary knows but Assigned. The caller must not change it.
Case
fold r returns the simple case folding of a code point (the C and S rows of CaseFolding.txt), which is the code point itself when it has none. Two code points are equal ignoring case when fold gives the same result for both. It does not allocate.
to_upper r returns the simple uppercase mapping of a code point, which is the code point itself when it has none. It does not allocate.
folding () returns every code point that fold changes, in ascending order. The array is fresh.
fold without its path for ASCII. The tests compare the two paths.