Commit graph

15 commits

Author SHA1 Message Date
Marc Durdin
09a1ad7b69 feat(developer): add hint when index() store is longer than any() store
While it does not cause any problems to have a index() store that is
longer than its corresponding any() store, it often indicates a mistake,
as the trailing characters in the store are ignored. Thus, adding as a
hint (which can be disabled via message suppression) rather than as a
warning or error.

Example code:
    store(abc) 'abc'
    store(defg) 'defg'
    any(abc) + 'x' > index(defg, 1)  c generates HINT_IndexStoreLong

Fixes: #10666
2024-07-24 07:35:31 +07:00
Marc Durdin
e6f8765d91
chore: Update developer/src/common/include/kmn_compiler_errors.h 2024-07-23 15:13:07 +10:00
Marc Durdin
dcf1d29bdb
Merge branch 'fix/developer/11814-kmx_u16-buffer-overrun' into fix/developer/11773-prevent-invalid-targets-store-values 2024-07-23 15:11:22 +10:00
Marc Durdin
63ca95ed76 fix(developer): prevent invalid values in targets store
Fixes: #11773
2024-07-03 08:33:15 +10:00
Marc Durdin
2dcc8fb948 fix(developer): prevent non-BMP characters in key part of rule
Currently, keys must be a UTF-16 code unit or a virtual key. Non-BMP
characters are unsupported. Technically, there is space available in the
.kmx `COMP_KEY` structure to accommodate UTF-32 codepoints, from
kmx_file.h:

    KMX_WORD_unaligned Key;
    KMX_WORD_unaligned _reserved;

However, the utility of this is almost nil, as it is very unlikely we
will encounter base keyboards (for mnemonic layouts) that generate any
characters outside the BMP, so there is little value in adding support
for this at this time.

The compiler will generate an error if this is encountered.

Fixes: #11643
2024-06-12 16:23:32 +07:00
Marc Durdin
02f9ce15c4 fix(developer): handle buffer boundaries in four cases
Fixes #11092.

Addresses buffer boundary tests for four cases, so a fatal error is not
returned to the user:
* character range too long (U+1234 .. U+2468)
* extended string too long ('abcde...xxxxx')
* outs too long (store(foo) .... outs(bar))
* virtual key expansion too long ([K_A] .. [K_Z] ...)

See #11136 for additional work arising.
2024-04-02 14:51:33 +07:00
Marc Durdin
457275e46f fix(developer): ensure fatal errors report message or made non-fatal
Fixes #10678.

Some messages have been reduced to ERROR instead of FATAL, as they are
not internal compiler errors.

Where fatal messages are raised, the message will now be reported
through correctly to Sentry.
2024-02-20 11:10:39 +07:00
Marc Durdin
e983818bda feat(developer): warn on usage of virtual keys in rule output
Fixes #10059.

Use of the unsupported and undocumented virtual key output, that doesn't
work in recent Keyman versions, at all, now results in a build warning.

Only a warning, because it did kinda work in old versions of Keyman.
2023-11-23 15:13:56 +10:00
Marc Durdin
8c1f3c4783 fix(developer): raise error if virtual key in context string
Fixes #7880.

Virtual keys have never been allowed in context. This should be an error
in a keyboard. Note: virtual keys in output are officially unsupported
but still kinda sorta a little bit work in Windows -- but I doubt they
will ever be officially supported.

Also includes small side journey to tidy up names and constants for two
other tests (error_duplicate_group and error_duplicate_store).
2023-10-31 14:04:26 +07:00
Marc Durdin
4c07b6c49c feat(developer): remove kmcmpdll 2023-09-02 12:25:29 +04:00
Marc Durdin
887bea8289
chore: address review comments
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2023-07-21 12:39:02 +10:00
Marc Durdin
0ec7ae8ccf fix(developer): reduce KM0208A to info severity
Fixes #9296.

208A in kmcmplib is the awkwardly-named CWARN_Info. We now have an
'info' severity in kmc, so this tidies that up (we can keep the same
flag in kmcmplib for now).
2023-07-19 12:54:20 +07:00
Marc Durdin
74b65e6486 refactor(developer): import kmcmplib errors into kmc-kmn
Fixes #8960.

Will need a further minor refactor in the future for kmc-kmw as it also
uses some of these same error codes.
2023-06-08 12:14:39 +07:00
Marc Durdin
c3458d040c refactor(developer): move filename consistency check to kmc
kmcmplib no longer has any filesystem access, so it cannot verify if a
referenced filename in a source file has the same case as the actual
filename on disk (a risk when moving projects between platforms). So
I opted to move this to the `loadFile` callback in kmc, which is the
only place where filesystem is actually accessed, and added
corresponding unit test.

Small additional fixes here:

1. Move from `Buffer` to `Uint8Array` in all kmc-* modules, so that we
   remove that barrier to running on web.
2. Use `callbacks.loadFile` instead of `callbacks.fs.readFileSync`, so
   that we can be sure to run the filename consistency check.
3. Fixed kps parser silently swallowing xml errors on load.
4. Added silent mode to NodeCompilerCallbacks so we could cleanly test
   the new filename consistency hint.
5. Noted a location where we still have NodeJS deps in kmc-ldml.
2023-06-01 15:11:38 +07:00
Marc Durdin
39d473fb2d refactor(developer): move comperr.h to kmn_compiler_errors.h
Consolidates the two copies of comperr.h (they were identical) and
moves to a common folder. Updates all references to comperr.h, except
for one github commit ref.
2023-04-20 13:20:29 +07:00