Commit graph

4256 commits

Author SHA1 Message Date
Marc Durdin
fad0a05155
Merge branch 'refactor/common/9665-move-kvk-file-to-developer' into refactor/common/9665-move-keyman-touch-layout-file-to-developer 2024-08-01 14:02:55 +10:00
Marc Durdin
261ced4f98
Merge branch 'refactor/common/9665-move-kps-file-type-to-developer' into refactor/common/9665-move-kvk-file-to-developer 2024-08-01 14:02:06 +10:00
Marc Durdin
1352558026
Merge branch 'refactor/common/9665-move-project-file-type-to-developer' into refactor/common/9665-move-kps-file-type-to-developer 2024-08-01 14:01:56 +10:00
Marc Durdin
b48ac789eb chore(developer): update git commit date test due to non-merge commit 2024-08-01 11:01:28 +07:00
Marc Durdin
08803111e5
Merge branch 'refactor/common/9665-move-kvk-file-to-developer' into refactor/common/9665-move-keyman-touch-layout-file-to-developer 2024-08-01 10:35:48 +10:00
Marc Durdin
53551f5662
Merge branch 'refactor/common/9665-move-kps-file-type-to-developer' into refactor/common/9665-move-kvk-file-to-developer 2024-08-01 10:35:33 +10:00
Marc Durdin
ad9ba1f188
Merge branch 'refactor/common/9665-move-project-file-type-to-developer' into refactor/common/9665-move-kps-file-type-to-developer 2024-08-01 10:34:05 +10:00
Marc Durdin
d8986be12f refactor(common): merge master into branch 2024-08-01 07:07:07 +07:00
Marc Durdin
eb43f81d43
Update developer/src/kmc-keyboard-info/build.sh 2024-08-01 09:16:29 +10:00
Marc Durdin
dbcc70cfa6
Update developer/src/kmc-keyboard-info/build.sh 2024-08-01 08:58:26 +10:00
Marc Durdin
d1e351a1ac
Revert "chore(developer): remove redundant references from tsconfig.json" 2024-08-01 08:57:27 +10:00
Eberhard Beilharz
1389d40965
Merge branch 'master' into change/web/11878_remove-es5 2024-07-31 15:28:38 +02:00
Dr Mark C. Sinclair
2d7683c395 chore(developer): Merge branch 'master' into test/developer/kmcmplib-compiler-unit-tests-3
# Keyman Conventional Commit suggestions:
#
# - Link to a Sentry issue with git trailer:
#     Fixes: _MODULE_-_ID_
# - Give credit to co-authors:
#     Co-authored-by: _Name_ <_email_>
# - Use imperative, present tense ('attach' not 'attaches', 'attached' etc)
# - Don't include a period at the end of the title
# - Always include a blank line before trailers
# - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
2024-07-31 11:29:43 +01:00
Dr Mark C. Sinclair
e8e28b60d4
Merge pull request #11894 from keymanapp/fix/developer/correct-use-of-u16chr-when-second-parameter-could-be-null
test(developer): check correct use of u16chr when second parameter could be null
2024-07-31 11:25:31 +01:00
Marc Durdin
6f62edf976
Merge pull request #12037 from keymanapp/chore/developer/12027-remove-references-from-tsconfig.json
chore(developer): remove redundant references from tsconfig.json
2024-07-31 07:55:39 +10:00
Dr Mark C. Sinclair
a53ea2ced4 chore(developer): add additional comment to LineTokenType test case for 'c' with no following space 2024-07-30 11:49:23 +01:00
Dr Mark C. Sinclair
298853bccb chore(developer): correct copy-paste error in finl test case of u16tok_str_compare_to_strtok 2024-07-30 11:30:59 +01:00
Dr Mark C. Sinclair
0e303cd38a chore(developer): Merge branch 'master' into fix/developer/correct-use-of-u16chr-when-second-parameter-could-be-null
# Keyman Conventional Commit suggestions:
#
# - Link to a Sentry issue with git trailer:
#     Fixes: _MODULE_-_ID_
# - Give credit to co-authors:
#     Co-authored-by: _Name_ <_email_>
# - Use imperative, present tense ('attach' not 'attaches', 'attached' etc)
# - Don't include a period at the end of the title
# - Always include a blank line before trailers
# - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
2024-07-30 11:20:10 +01:00
Marc Durdin
dc459a0926 refactor(developer): replace VERIFY_KEYBOARD_VERSION() calls with VerifyKeyboardVersion()
Remove the `VERIFY_KEYBOARD_VERSION()` and
`VERIFY_KEYBOARD_VERSION_ret()` macros, and instead use
`VerifyKeyboardVersion()`. The DRYing out of this function call pattern
moved the return statement into a macro, which is an inappropriate way
to reduce repetition, because (a) it is hard for devs to spot function
exits, and (b) automated code analysis tools stumble on it.

Also means that we uncover more clearly the return mismatches between
`KMX_DWORD` and `KMX_BOOL` through the compiler source.

Fixes: #12047
2024-07-30 13:13:10 +07:00
Marc Durdin
897697d208 chore(developer): support filename field in kmcmplib compiler messages
Relates-to: #10866
2024-07-30 13:09:55 +07:00
Marc Durdin
7682a31e32 refactor(developer): replace AddWarning() and AddWarningBool() macro usage with call to ReportCompilerMessage()
The `AddWarning()` and `AddWarningBool()` macros just called
`ReportCompilerMessage()`. A side-effect of removing `AddWarningBool()`
is that the functions that called it always returned `TRUE` (and the
return value was never checked anyway), and so these functions have been
made `void`.
2024-07-30 11:02:37 +07:00
Marc Durdin
619b03a20d refactor(developer): rename AddCompileError() to ReportCompilerMessage() 2024-07-30 10:05:06 +07:00
Marc Durdin
8cd97e5f5d refactor(developer): move kmcmplib message construction to kmc-kmn
* Remove compiler message definitions from kmcmplib
* Add parameterization to compiler message structures
* Translate parameters for existing parameterized messages (except for
  `ERROR_InvalidToken`, which requires a bigger refactor of
  `GetXStringImpl()` and many friends)
* Add columnNumber to message structures (not yet used in kmc-kmn)
* Add filename to message structures (not yet used in kmcmplib)
* Rename `INFO_Info` to `INFO_MinimumCoreEngineVersion` and
  `INFO_MinimumEngineVersion` to `INFO_MinimumWebEngineVersion`

Relates-to: #10866
2024-07-30 10:01:19 +07:00
Eberhard Beilharz
fd8ffb5efc
chore(web): don't deep import and remove sub-export of util
Addresses code review comments and reverts eb9205f46e and
partially reverts 5552fdd5ad.
2024-07-29 17:43:34 +02:00
Marc Durdin
59addc5d2b refactor(developer): move error reporting inside GetCompileTargetsFromTargetsStore
This supports upcoming changes for parameterized errors in
`GetCompileTargetsFromTargetsStore`.
2024-07-29 10:52:23 +07:00
Marc Durdin
c359fd6ccc refactor(developer): move error reporting inside ProcessGroupFinish
This supports upcoming changes for parameterized errors in
`VerifyUnreachableRules` (now a `void` return because it always returned
success anyway).
2024-07-29 10:41:32 +07:00
Marc Durdin
bcec446144 refactor(developer): return KMX_BOOL instead of KMX_DWORD for AddStore() and friends
This is definitely a yak shave, but should have payoff in terms of
cleaner and more descriptive error messages in the long run.

In the existing design, many (but not all) functions return a KMX_DWORD
error value, and that is passed on up the call stack to be reported as
an error elsewhere. This separation of error reporting from error site
makes it difficult to add parameters (and masks the actual error site in
analysis).

This commit starts to move the error reporting to the actual site of the
error, in `AddStore()`, `ProcessSystemStore()`, `ParseLine()`,
`AddCompilerVersionStore()`, `BuildVKDictionary()`, and
`ProcessBeginLine()`.

During analysis, identified a memory leak (missing `delete[] temp`) in
`process_if()`. Fixed on line 2716.

Many of the `process_*()` functions call `AddStore()`, which is now
responsible for reporting its own errors; these functions have not yet
been updated and so if `AddStore()` fails, the compiler will generate
two error messages -- one from `AddStore()` and a second one in the
value returned from the calling `process_*()` function.

The `VERIFY_KEYBOARD_VERSION` macro hides a `return` statement which
returned an error code on failure. This has been split into
`VERIFY_KEYBOARD_VERSION_ret` which causes the caller to returns the
error code, and the existing `VERIFY_KEYBOARD_VERSION` macro now causes
the caller to return `FALSE` on failure. This should be refactored to
move the `return` condition into the caller (removing the `return`
side-effect) in the future.
2024-07-29 06:21:21 +07:00
Marc Durdin
05fd680a9e refactor(developer): Move error reporting inside CheckForDuplicateStore
This is the same change as for `CheckForDuplicateGroup`.

`CheckForDuplicateStore` is one of a few places where parameterized
errors are returned. Moving the error reporting inside the function
makes it cleaner to refactor those parameterized errors later. (This
requires a similar change in `ProcessStoreLine`, also formatted and
rebraced per style guide.)
2024-07-29 04:27:06 +07:00
Marc Durdin
7371c87867 refactor(developer): Move error reporting inside CheckForDuplicateGroup
`CheckForDuplicateGroup` is one of a few places where parameterized
errors are returned. Moving the error reporting inside the function
makes it cleaner to refactor those parameterized errors later. (This
requires a similar, simple change in `ProcessGroupLine`.)
2024-07-29 04:18:28 +07:00
Marc Durdin
92c5d41501 refactor(developer): make AddCompileError void type
`AddCompileError` would return FALSE only for 'user interruption' (not
used since Developer 17) or for fatal errors. After analysis, it turns
out that this error value was not used anywhere and removing it
simplifies the error management logic, making code paths much easier to
follow.

The return value was used in v17.0 and earlier in the macro for
`AddCompileWarning`, effectively only relevant for 'user interruption'
(`CERR_Break`); this was an ugly code pattern as it meant that any
`AddCompileWarning` could exit a function with failure -- though as
noted above `CERR_Break` was never emitted in v17.0.
2024-07-29 04:13:15 +07:00
Marc Durdin
d53b4c8322 test(developer): validate that messages in kmcmplib and kmc-kmn match
Add a unit test to verify that kmn_compiler_errors.h and
kmn-compiler-messages.ts have identical definitions for all errors in
kmcmplib. Then remove mismatched (and unused) messages identified by
this test.
2024-07-28 12:37:58 +07:00
Marc Durdin
6a48f5e550 refactor(developer): align kmcmplib error codes with kmc
Renames kmcmplib error codes to match those in kmc-kmn, and updates the
bitmasks accordingly. Adds a KmnCompilerMessages namespace so a trivial
enum can be declared without risk of clashes with other ERROR_ or
similar messages.
2024-07-28 11:45:03 +07:00
Marc Durdin
c8b055101f refactor(developer): rename CWARN_Info to CINFO_Info 2024-07-28 08:42:57 +07:00
Marc Durdin
091b4042a2 refactor(developer): rename CERR_None and CERR_EndOfFile to STATUS_
These two codes are not true error or message codes, but are used as
return values extensively throughout kmcmplib. The codes are never
passed to message callbacks. As such, I have renamed them to reflect
usage, but opted not to change their values as there would be some risk
in doing so (e.g. use of `!v` vs `v == CERR_None`).
2024-07-27 09:24:13 +07:00
Marc Durdin
a0e786035f refactor(developer): rename error severity masks to match typescript 2024-07-27 09:17:20 +07:00
Marc Durdin
503d9c6ea9 chore(developer): use FATAL_ prefix for fatal errors in kmcmplib 2024-07-27 09:11:03 +07:00
Marc Durdin
0e0e96c810
Merge pull request #12029 from keymanapp/chore/developer/api-refresh
chore(developer): api doc refresh
2024-07-27 11:34:20 +10:00
Marc Durdin
2f6ffd9ca3
Merge pull request #12028 from keymanapp/fix/developer/12027-remove-paths-from-tsconfig.json
fix(developer): remove `paths` from tsconfig.json
2024-07-27 11:34:13 +10:00
Marc Durdin
ed6374c3b8
Merge pull request #12017 from keymanapp/chore/developer/10254-analyzer-messages
chore(developer): rename to analyzer-messages.ts
2024-07-27 11:34:03 +10:00
Marc Durdin
1cff1a5084 chore(developer): remove redundant references from tsconfig.json
With the full move to ES Modules, we no longer need to include
`references` in tsconfig.json, as we can rely on package.json and
build.sh dependency management. Note however that `tsc -b` may not work
to build dependencies -- they need to be built using `build.sh`, which
calculates which dependencies need building.

kmc-keyboard-info was missing a dependency link to kmc-package in
build.sh, correcting this at the same time.

Relates-to: #12027
2024-07-27 05:44:22 +07:00
Dr Mark C. Sinclair
37464e9438 chore(developer): Merge branch 'master' into fix/developer/correct-use-of-u16chr-when-second-parameter-could-be-null
# Keyman Conventional Commit suggestions:
#
# - Link to a Sentry issue with git trailer:
#     Fixes: _MODULE_-_ID_
# - Give credit to co-authors:
#     Co-authored-by: _Name_ <_email_>
# - Use imperative, present tense ('attach' not 'attaches', 'attached' etc)
# - Don't include a period at the end of the title
# - Always include a blank line before trailers
# - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
2024-07-26 14:03:10 +01:00
Dr Mark C. Sinclair
194bfd6bed chore(developer): Merge branch 'master' into test/developer/kmcmplib-compiler-unit-tests-3
# Keyman Conventional Commit suggestions:
#
# - Link to a Sentry issue with git trailer:
#     Fixes: _MODULE_-_ID_
# - Give credit to co-authors:
#     Co-authored-by: _Name_ <_email_>
# - Use imperative, present tense ('attach' not 'attaches', 'attached' etc)
# - Don't include a period at the end of the title
# - Always include a blank line before trailers
# - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
2024-07-26 13:54:59 +01:00
Dr Mark C. Sinclair
d816bf608d chore(developer): Merge branch 'master' into test/developer/kmcmplib-compiler-unit-tests-2
# Keyman Conventional Commit suggestions:
#
# - Link to a Sentry issue with git trailer:
#     Fixes: _MODULE_-_ID_
# - Give credit to co-authors:
#     Co-authored-by: _Name_ <_email_>
# - Use imperative, present tense ('attach' not 'attaches', 'attached' etc)
# - Don't include a period at the end of the title
# - Always include a blank line before trailers
# - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
2024-07-26 11:26:57 +01:00
Marc Durdin
37e1a9d296 refactor(developer): improve the callbacks for kmcmplib
* Removes redundant calls
* Uses C++ classes on the interface side
* Removes global callbacks from the Javascript side

In preparation for cleanup of compiler messages
2024-07-26 15:55:44 +07:00
Marc Durdin
833efeb53f refactor(developer): move functions and variables into CompilerErrors.cpp
Groundwork for rework of compiler errors. No functional changes.
2024-07-26 10:03:12 +07:00
Marc Durdin
6310c2e9ed chore(developer): api doc refresh 2024-07-26 09:23:17 +07:00
Marc Durdin
1afa4beb01 fix(developer): remove paths from tsconfig.json
Fixes: #12027
2024-07-26 06:59:45 +07:00
Marc Durdin
db904b5617 fix(developer): cleanup package.json and build.sh errant references
During analysis of root causes for #12027, discovered a few package
relationship issues in package.json and build.sh.

analyzer-messages.ts ///<reference> is a mitigation for now.

Relates-to: #12027
2024-07-26 06:57:32 +07:00
Marc Durdin
70a32b081b chore(developer): rename to analyzer-messages.ts
Fixes #10254.

A full clean and build resolved this, so seems likely the rename caused
some intermediate file to break?
2024-07-25 15:09:00 +07:00
Marc Durdin
b0c7147dfa
Merge pull request #12000 from keymanapp/feat/developer/10666-hint-on-index-store-longer-than-any
feat(developer): add hint when index() store is longer than any() store
2024-07-25 17:45:58 +10:00