Keyman Compilation Trouble(shooting) Summary

Developer: Rachhpal Sahota
Keyboard: RomanPunjabi
Keyman Developer Version: 17.0.335
Platform: Windows 11

GOAL:

To map Roman keystrokes such that:

  • ‘d’ + ‘h’ → ‘ਧ’ (U+0A27)
  • ‘d’ + any other character → ‘ਦ’ (U+0A26), plus the original second character
    This should work via deadkey or context-based handling for dynamic fallback logic.

ATTEMPT 1: Unicode Literal on Right-hand Side

group(main) using keys
‘dh’ > U+0A27
‘d’ > U+0A26

Error: KM0200A – Invalid token: U+0A27
Issue: Keyman doesn’t accept bare Unicode code points without wrapping.

ATTEMPT 2: Character Literal Output

group(main) using keys
‘dh’ > ‘ਧ’
‘d’ > ‘ਦ’

:white_check_mark: Compiles
:warning: But doesn’t allow context-based fallback or multiple rule resolution.

ATTEMPT 3: Deadkey and Context-Based Logic (Fails)

store(otherLetterStore) ‘a’ ‘b’ ‘c’ ‘e’ ‘f’ ‘g’ ‘i’ ‘j’ ‘k’ ‘l’ ‘m’ ‘n’ ‘o’ ‘p’ ‘q’ ‘r’ ‘s’ ‘t’ ‘u’ ‘v’ ‘w’ ‘x’ ‘y’ ‘z’

group(main) using keys
‘d’ > deadkey(1)
deadkey(1) + ‘h’ > ‘ਧ’
deadkey(1) + any(otherLetterStore) > ‘ਦ’ + context

:cross_mark: Error: KM0200A – Invalid token found character offset: 5 token: >
Even when retyped character-by-character manually

NOTE: Clean UTF-8 file, removed layout/bitmap references, declared store above group,
all syntax rules followed. Suspected compiler bug or undocumented restriction.

REQUEST:

  1. Is there a limitation in how deadkeys/context must be used when triggered by alphabetic keys like ‘d’?
  2. What is the recommended way to:
    • Prevent output after ‘d’ until ‘h’ or other key is typed?
    • Dynamically decide the output based on next keystroke?

Hello @Rachhpal and Welcome!

I changed the category of your post to “Keyman” since your question is about Keyman.

I’m trying to understand what your requirements are. Would the following work?

  • When ‘d’ is typed, produce U+0A26
  • If ‘h’ is typed after U+0A26, change the U+0A26 into U+0A27
+ 'd' > U+0A26
U+0A26 + 'h' > U+0A27

A Keyman rule has:

  • a context, consisting of zero or more characters
  • a “+” separating the context from the keystroke
  • a single keystroke
  • a “>” separating the keystroke from the output
  • the output, which can contain characters and/or other Keyman directives

If I’ve misunderstood your question, or if you have additional questions, please write again.