Commit graph

390 commits

Author SHA1 Message Date
Steven R. Loomis
04a6e164d7 feat(core): ldml actions: updates per code review 🌱
- fix backspace processing
- fix k_102 - we can no longer test for context invalidation here
- fix a test that assumed non-const km_core_actions.output

For: #10410
2024-01-19 11:24:41 -06:00
Steven R. Loomis
6ea83391a7 Merge remote-tracking branch 'origin/epic/core/9999-normalization' into feat/core/10410-ldml-really-use-action-struct 2024-01-19 10:40:42 -06:00
Eberhard Beilharz
a4c940418f
fix(core): Fix nuances when updating context
Fixes #10100.
2024-01-19 15:56:40 +01:00
Marc Durdin
249ed77835
Merge branch 'epic/core/9999-normalization' into chore/merge-master-into-core/9999-normalization 2024-01-19 17:42:40 +11:00
Steven R. Loomis
9ff937b4ab
Apply suggestions from code review
Co-authored-by: Marc Durdin <marc@durdin.net>
2024-01-18 23:59:29 -06:00
Marc Durdin
583b0836de
Merge pull request #10430 from keymanapp/chore/core/10424-surrogate-pair-tests
chore(core): add surrogate pair tests to test_actions_normalize 🌱
2024-01-19 13:51:16 +11:00
Marc Durdin
c1304a9c19
Merge pull request #10428 from keymanapp/refactor/core/10423-move=context-helpers
refactor(core): move context helpers to a new module 🌱
2024-01-19 13:51:09 +11:00
Marc Durdin
ba46d2127d chore(core): address review comments 2024-01-19 09:50:00 +07:00
Marc Durdin
a26e21aba7 chore(core): address review comments 2024-01-19 08:01:45 +07:00
Steven R. Loomis
973cf5d044 feat(core): ldml use action struct in tests 🌱
- clarify warnings in ldml.cpp for assertions we are skipping for now
- remove unused parameter

For: #10410
2024-01-18 08:48:50 -06:00
Steven R. Loomis
8095977bec feat(core): ldml action struct test runner changes 🌱
- change ldml test suite, with TODOs
- backspace validation is different, as we don't know the expected char.

For: #10410
2024-01-18 22:55:06 -06:00
Marc Durdin
83f80c061a refactor(core): remove unused context APIs
Fixes #10431.

The `km_core_` prefix has been removed from internal-only functions, and
these function declarations moved to context.hpp.

The functions have not been moved from km_core_context_api.cpp at this
stage.

Rewrote the function documentation in Javadoc style comments for the
internal use functions.
2024-01-18 12:18:07 +07:00
Marc Durdin
8b3c247520 chore(core): add surrogate pair tests to test_actions_normalize
Fixes #10424.
2024-01-18 09:48:29 +07:00
Marc Durdin
b3261b8dc4 refactor(core): move context helpers to a new module
Fixes #10423.
2024-01-18 09:26:58 +07:00
Marc Durdin
823120b0c4 chore(core): simplify input assumptions for actions_normalize
Per discussion in #10422, we can assume that input cached_context is
always NFD. However input actions->output may not start at a
normalization boundary, so we still need to backtrack to a normalization
boundary in order to get our NFC output. But cached_context never need
change.

This makes no change to the algorithm, but tweaks some of the unit tests
to adhere to this input assumption.

Note: we could consider adding a debug assertion that cached_context is
NFD.
2024-01-18 08:25:15 +07:00
Steven R. Loomis
7bc8831267 feat(core): updates to add_back_markers 🙀
- support out-of-order re-adding
- test for updated marker map
2024-01-17 19:04:11 -06:00
Steven R. Loomis
2e46bfea81 chore: reformat 2024-01-17 19:04:05 -06:00
Steven R. Loomis
990635eb09 feat(core): WIP attempt at cross segment markers 🙀
#10369
2024-01-17 19:03:43 -06:00
Steven R. Loomis
e4e7d9fd27
Merge branch 'feat/core/10319-escaping-you-epic-ldml' into feat/developer/10319-remove-old-escape-epic-ldml 2024-01-17 18:49:50 -06:00
Steven R. Loomis
b6a6b7e6b8 feat(core): ldml fix test case and parser 🙀
For: #10319
2024-01-17 18:32:39 -06:00
Steven R. Loomis
d08e7051cf feat(core): ldml updates per code review 🙀
- don't try to remove irregular sentinel sequences
- update test

For: #10319
2024-01-17 18:34:56 -06:00
Marc Durdin
39f081391e chore(core): dedup set_context_from_string 2024-01-17 13:05:11 +07:00
Marc Durdin
7218f93ca9 chore(core): test typos 2024-01-17 12:07:38 +07:00
Marc Durdin
671973baab refactor(core): split context API from Core primary API
Relates to #9999.
Fixes #10384.

The context API endpoints should no longer be considered as part of the
standard Core API. The only consumers that have a need to access these
APIs are the IMX integration in Engine for Windows, and the Keyman
Developer Debugger.

These symbols are currently used by Developer:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()`
* `km_core_context_set()`
* `km_core_context_clear()`

These symbols are currently used by Windows IMX:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_context_items_dispose()`
* `km_core_context_item_list_size()`
* `km_core_state_get_intermediate_context()`

The following functions and symbols are moving to
keyman_core_api_context.h:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()` function
* `km_core_state_get_intermediate_context()` function
* `km_core_context_set()` function
* `km_core_context_clear()` function
* `km_core_context_get()` function
* `km_core_context_items_from_utf16()` function
* `km_core_context_items_from_utf8()` function
* `km_core_context_items_to_utf8()` function
* `km_core_context_items_to_utf16()` function
* `km_core_context_items_to_utf32()` function
* `km_core_context_items_dispose()` function
* `km_core_context_length()` function
* `km_core_context_append()` function
* `km_core_context_shrink()` function
* `km_core_context_item_list_size()` function
2024-01-17 14:44:25 +11:00
Marc Durdin
e6096a267c feat(core): action output normalization
Fixes #9999.

Note TODO items:
- [ ] Renormalize cached_context across action boundary. Blocked by #10369.
- [ ] Add extra tests for surrogate pairs
- [ ] Move set_context_from_string into helper module
- [ ] if we don't apply normalization, we still need to fixup the
      app_context, to keep it coherent with cached_context (or at least
      we need to verify that app_context is never used in this
      situation)
2024-01-17 10:41:00 +07:00
Marc Durdin
e39affe93b feat(core): infrastructure for normalization of output
Relates to #9999.

Establishes functions, unit test sources, normalization entry point and
an effectively no-op unit test for normalization support.
2024-01-16 13:46:46 +07:00
Marc Durdin
e5c2525241 refactor(core): split context API from Core primary API
Relates to #9999.
Fixes #10384.

The context API endpoints should no longer be considered as part of the
standard Core API. The only consumers that have a need to access these
APIs are the IMX integration in Engine for Windows, and the Keyman
Developer Debugger.

These symbols are currently used by Developer:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()`
* `km_core_context_set()`
* `km_core_context_clear()`

These symbols are currently used by Windows IMX:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_context_items_dispose()`
* `km_core_context_item_list_size()`
* `km_core_state_get_intermediate_context()`

The following functions and symbols are moving to
keyman_core_api_context.h:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()` function
* `km_core_state_get_intermediate_context()` function
* `km_core_context_set()` function
* `km_core_context_clear()` function
* `km_core_context_get()` function
* `km_core_context_items_from_utf16()` function
* `km_core_context_items_from_utf8()` function
* `km_core_context_items_to_utf8()` function
* `km_core_context_items_to_utf16()` function
* `km_core_context_items_to_utf32()` function
* `km_core_context_items_dispose()` function
* `km_core_context_length()` function
* `km_core_context_append()` function
* `km_core_context_shrink()` function
* `km_core_context_item_list_size()` function
2024-01-16 12:04:41 +07:00
Steven R. Loomis
eb39bba374 chore(developer,core): change sample and test files to use \u{…} 🙀
- #10389 will require this, but at least change the test files

#10319
2024-01-15 17:27:41 -06:00
Marc Durdin
8abab53988 chore(core): Merge branch 'feat/core/10365-context-debug' into feat/core/9999-normalization-of-context
Note: shifted minor changes from action_api.cpp to new
state_context_api.cpp.
2024-01-16 06:16:45 +07:00
Marc Durdin
ba3290de75 chore(core): Merge branch 'master' into feat/core/10365-context-debug
Note: resolved merge conflict with action_api.cpp by shifting new code
into state_context_api.cpp.
2024-01-16 05:46:36 +07:00
Steven R. Loomis
c0928e1835
Merge branch 'master' into feat/core/10319-escaping-you-epic-ldml 2024-01-15 16:45:38 -06:00
Steven R. Loomis
ab67061843 feat(core): 32 bit escapades 🙀
- improved test code and marker parsing

#10319
2024-01-15 14:07:19 -06:00
Marc Durdin
84785fdd9a chore(core): wasm linker flags 2024-01-15 13:23:29 +07:00
Marc Durdin
932ad9d1df chore(core): add unit test deps for wasm 2024-01-15 12:50:41 +07:00
Marc Durdin
bd46fb271b feat(core): unit tests need to set both app context and cached context 2024-01-15 12:34:00 +07:00
Marc Durdin
036c32af1f feat(core): normalize input context
First half of #9999.

Adds support for normalization (to NFD) of input app context into the
cached context. The keyboard processor will work with the NFD cached
context.

Adds unit tests for the normalization as part of the LDML keyboard
processor test suite.

TODO:
* Comparing modified cached context to app context to determine the
  transform required to send to the app
* Handling illegal unicode and unpaired surrogates on input context
2024-01-15 11:50:16 +07:00
Marc Durdin
cd69405960 feat(core): add app_context and failing tests
Adds the application context member of state and a corresponding,
failing unit test, which starts the process of verifying the handling
of the application context.
2024-01-15 11:50:15 +07:00
Marc Durdin
9868de5abc
Merge branch 'master' into feat/core/10365-context-debug 2024-01-15 12:06:03 +11:00
Marc Durdin
bfb26eaf64 feat(core): adds km_core_state_context_debug
Fixes #10365.

Adds a `km_core_state_context_debug` function that returns a km_core_cp
string containing the current cached or intermediate context. The
function must be used only for debug logging purposes -- the string is
not intended to parsed for other purposes and the format may change in
the future.

This commit adds the function and corresponding unit tests. Subsequent
commits will update existing context debug functions in various engines
to use this API endpoint instead.
2024-01-15 07:19:31 +07:00
Steven R. Loomis
c5d0e0525e feat(developer): 32 bit escapades 🙀
- escaping working, matching not yet

#10319
2024-01-13 12:55:51 -06:00
Eberhard Beilharz
141b85814e
refactor(core): Move km_core_state_context_* tests to separate file
It was fairly surprising to have the unit tests for
`km_core_state_context_*` methods in `action_api.cpp`, so this change
moves them to a separate file.
2024-01-12 15:34:32 +01:00
Steven R. Loomis
e06cf99b02
Merge branch 'feat/core/10320-stack-markers-epic-ldml' into chore/core/10320-refactor-epic-ldml 2024-01-08 12:37:51 -06:00
Steven R. Loomis
776a902eb0 feat(core): stacked markers 🙀
- build fix for win

#10320
2024-01-06 13:56:37 -06:00
Steven R. Loomis
f38054f65a chore(core): split out some files 🙀
- markers/normalization really needs its own file
- split out ldml_markers.* from ldml_transforms.*
- split out ldml_utils.hpp for a common assert macro

#10320
2024-01-06 11:56:11 -06:00
Steven R. Loomis
b2b897970d feat(core): stacked markers 🙀
- renamed the single-segment functions to normalize_nfd_markers_segment() since they should only be run on a single segment
- commented out NFC for now, dead code
- add some additional checks/DebugLog around normalization

#10320
2024-01-06 11:33:51 -06:00
Steven R. Loomis
f4be7856da feat(core): stacked markers tests 🙀
- we can finally support single markers with the new structure
2024-01-06 10:17:10 -06:00
Steven R. Loomis
52fe9073a0 chore(core): stacked markers tests 🙀
- first we break

#10320
2024-01-05 18:52:43 -06:00
Steven R. Loomis
91b761b027 feat(core): fixup markers as regex 🙀
- move prepend_marker out of line
- replace bool for_regex with an enum
- cleanup another instance of \b -> \u0008

#9121
2024-01-02 17:21:04 -06:00
Steven R. Loomis
a6151e681b
Merge branch 'chore/core/ldml-test-robust-epic-ldml' into feat/developer/9121-reject-bad-regex-epic-ldml 2024-01-02 17:04:37 -06:00
Steven R. Loomis
84c218ff85
Merge branch 'feat/core/9121-more-regex-epic-ldml' into chore/core/ldml-test-robust-epic-ldml 2024-01-02 17:03:07 -06:00