-
Notifications
You must be signed in to change notification settings - Fork 37
/
XKBGrammarWalker.g
57 lines (48 loc) · 1.09 KB
/
XKBGrammarWalker.g
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// XKB Grammar (X.org)
// Written by Simos Xenitellis <[email protected]>, 2008.
// Version 0.8
tree grammar XKBGrammarWalker;
options
{
language = Python;
tokenVocab = XKBGrammar;
ASTLabelType = CommonTree;
}
layout
: ^(LAYOUT symbols+)
;
symbols
: ^(SYMBOLS mapType ^(MAPMATERIAL mapMaterial+))
;
mapType
: ^(MAPTYPE ^(MAPOPTIONS MAPOPTS+) ^(MAPNAME DQSTRING))
;
mapMaterial
: ^(TOKEN_INCLUDE DQSTRING)
| ^(TOKEN_NAME DQSTRING)
| ^(TOKEN_KEY_TYPE NAME? ^(VALUE DQSTRING))
| ^(TOKEN_KEY OVERRIDE? ^(KEYCODEX NAME) keyelements+)
| ^(TOKEN_MODIFIER_MAP STATE keycode+)
| ^(TOKEN_VIRTUAL_MODIFIERS NAME+)
;
keycode
: ^(KEYCODE NAME)
| ^(KEYCODEX NAME)
;
keyelements
: ^(ELEM_KEYSYMS DQSTRING)
| ^(ELEM_KEYSYMGROUP ^(VALUE NAME+))
| ^(ELEM_VIRTUALMODS NAME)
| ^(ELEM_OVERLAY NAME keycode)
;
mapopts
: 'default'
| 'hidden'
| 'partial'
| 'alphanumeric_keys'
| 'keypad_keys'
| 'function_keys'
| 'modifier_keys'
| 'alternate_group'
| 'xkb_symbols'
;