Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 17.0 (home page)Version 16.0 (home page, current version)Version 15.0 (home page)Version 14.0 (home page)Version 13.0 (home page)Version 12.0 (home page)Version 11.0 (home page)Version 10.0 (home page)Version 9.0 (home page)Version 8.0Version 7.0 (home page)Version 6.0 (home page)Version 5.0 (home page)Version 4.0 (home page)

Index

On this page

Using Groups

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.html Defines the starting group for the keyboard layout
group group.html Starts a new group of rules
match match.html A system rule that is fired when another rule is matched
nomatch nomatch.html A system rule that is fired when no rule is matched
return return.html Stops processing of the current keystroke
use use.html Starts processing in another group