vkeyMaps table compiler, unit test, and fixes to json schema. Adds a
vkeyMaps entry to the basic e2e test.
us-virtual-keys.ts has a new mapping for CLDR VKey Enums, but I will
tweak this in an upcoming commit to use constants instead of hard-coded
values.
Just wanted to rename this to make it clearer. Also added a prefix to
each message generator to indicate the type of message, as otherwise it
is not obvious within the compiler which messages are going to cause the
compiler to fail.
Note that the message generator function prefixes are Title Cased
whereas the message identifier constant prefixes are CAPS. I guess this
could be confusing but I think it works okay in practice.
Just reorders all work around the various sections to match the binary
format order -- that is, 'sect' first, then all other sections
alphabetically.
This also means the compiler now emits the sections in the expected
order.
No other changes to functionality.
Updates compiler, headers and documentation for the 'name' section,
which will always be present as the LDML keyboard spec requires at least
one name in the `<names>` element.
Adds an `index` command as suggested by #7186.
> Future enhancement suggestion: include ... index() for block indices
> within these repeated blocks. Would be very useful for string tables
> in the example ref.
This makes it easier to write a binary file which contains offsets and
size values. Using this for unit tests for the LDML keyboard compiler.
Example kmldmlc basic.txt is updated and included.
Future enhancement suggestion: include count() for repeated blocks and
index() for block indices within these repeated blocks. Would be very
useful for string tables in the example ref.
This is reasonably random, but wanted to add another test for content
rather than structure, just to verify that the DTD-XSD-jsonschema
translation is doing the right thing according to what we expect.
Looking good.
As we do not appear to have access to a good DTD validation library in
Node.js, we will instead convert the DTD to a JSON schema file and use
that for validation.
I have not verified every aspect of the JSON schema at this point, but
will incrementally do so as I implement further aspects of the compiler.
This updates all the testing to use the schema. As the schema validation
is slow, I have increased the 'normal' time for tests.
Note: bumps target to es2020 for better Intl.* support. Verified as
supported by Node 16+ and modern browsers.
Adds support for multiple locales and basic canonicalization. Does not
support normalization of locales.
First, a little bit of refactoring to make it cleaner to do unit test
for each section.
Then add some global error values.
Throw in a helper function or two.
Dust off the edges of the CompilerCallbacks object.
Duct tape together validation of the normalization attribute.
And ... eventually we get a nice clean-like unit test for the meta
compiler, with three pretty little fixtures and as-neat-as-you-like-it
assertions.
Well, almost. There are still callback side-effects for messages. These
may in future be returned as an array as well, eliminating the need for
a message callback.
But restructures each section compiler so that it is self-contained and
responsible only for writing its own section. Also tightens up the types
for the sections constants.
Last, but not least, moves responsibility for writing the output .kmx
out of compiler.ts and into its callers -- removing one dependency from
the compiler. Reading input files still needs to be done in the
compiler, as there may be multiple input files with `<import>` that we
cannot know about until we start parsing xml.
Removes .kmx from repo and builds them from the source .xml files using
kmldmlc (building that if necessary also with a poor fella's dependency
check for now), and generally a lot of cleanup of the meson.build files
for the ldml tests.
Moves keyboards to a subfolder of the ldml unit test folder to keep them
neat and tidy and avoid embedding huge files into ldml.js for test of
WASM.
Note: 000_null_keyboard and 002_null_invalid do build successfully, but
the core ldml keyboardprocessor currently fails on them, because they
are missing keys and vkey sections.
Adds support for writing kmxplus section of a kmx file. Extends KMXFile
to a KMXPlusFile subclass. Adds KMXPlusBuilder which is called from
KMXBuilder if KMXBuilder finds that the file is a KMXPlusFile.
This means that KMXPlusBuilder generates a buffer that could be stored
independently of its parent .kmx file transport, if that is later
considered desirable.
Adds new constants for sizes of various table components, which makes
building the file much simpler.
Splits the building of keyboardprocessor_ldml.h into a separate
tsconfig.build.json, and designates keyboardprocessor_ldml.ts as a new
Typescript/Node module @keymanapp/ldml-keyboard-constants.
Includes an example usage in the (currently unused) kmx-plus.ts.
Generates a valid .kmx file (legacy structures only) from an
intermediate in-memory structure. Included for completeness, although it
is anticipated that LDML keyboards will not have any groups, though they
will probably have some metadata stores.
Defines kmx binary structures and wireframe builder to emit a .kmx file.
Currently the builder will emit a roughly correct header. Next steps are
to build a .kmx file with stores, groups and keys, to match existing KMX
compiler behaviour. Once that is done, will return to generation of
KMXPlus data structures.
Compiler is designed to work independent of file system so it should run
inside browser or node environment. kmldmlc.ts is node-specific, but all
other modules should be multi-platform.