Groups provide a facility for grouping related rules, similar to functions in other programming languages. When used effectively, groups can reduce the size and complexity of your keyboards significantly.
Groups can match on context only, or on context and keystroke. The context-only groups can be very useful for pre- and post-processing rules, such as reordering stacked diacritics.
The examples below show the two types of groups.
group(mygroup) c context only 'a' > 'b' group(mygroup) using keys c context and keystroke 'a' + 'a' > 'c'
The use statement allows you move into another group when a rule
is matched. All output from the current group preceding the use
statement is
processed into the context before the subsequent group is entered (although it is not
sent to the application until processing finishes for the current keystroke).
For example:
c This example prohibits two vowels in a row begin > use(precheck) group(precheck) any(vowel) > context use(vowelstate) nomatch > use(nostate) group(vowelstate) using keys + any(vowel) > beep nomatch > use(nostate) group(nostate) using keys + any(cons) > index(cons, 1)
Several important things to note from this example:
The first rule (any(vowel) > context use(vowelstate)) uses the context keyword to copy the matched context to the output, so that Keyman can move it back into the context for use with the vowelstate group. If you do not do this, the context will be dropped before vowelstate is used, and the character will be deleted from the screen.
If the final group processed is a context and keystroke group ("using keys"), and there is not a nomatch rule, and the keystroke is not matched in the group, the keystroke will be output to the screen, regardless of whether or not it was matched in earlier groups.
The following statements and special rules are used with groups:
begin | begin.php | Defines the starting group for the keyboard layout |
group | group.php | Starts a new group of rules |
match | match.php | A system rule that is fired when another rule is matched |
nomatch | nomatch.php | A system rule that is fired when no rule is matched |
return | return.php | Stops processing of the current keystroke |
use | use.php | Starts processing in another group |