Branch
Hash :
1849158a
Author :
Date :
2019-12-27T15:10:10
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
%{
#include "config.h"
#include "xkbcomp-priv.h"
#include "parser-priv.h"
static const struct keyword_tok *
keyword_gperf_lookup (register const char *str, register size_t len);
%}
struct keyword_tok { int name; int tok; };
%language=ANSI-C
%define hash-function-name keyword_gperf_hash
%define lookup-function-name keyword_gperf_lookup
%readonly-tables
%enum
%includes
%struct-type
%pic
%ignore-case
%%
action, ACTION_TOK
alias, ALIAS
alphanumeric_keys, ALPHANUMERIC_KEYS
alternate_group, ALTERNATE_GROUP
alternate, ALTERNATE
augment, AUGMENT
default, DEFAULT
function_keys, FUNCTION_KEYS
group, GROUP
hidden, HIDDEN
include, INCLUDE
indicator, INDICATOR
interpret, INTERPRET
keypad_keys, KEYPAD_KEYS
key, KEY
keys, KEYS
logo, LOGO
modifier_keys, MODIFIER_KEYS
modifier_map, MODIFIER_MAP
mod_map, MODIFIER_MAP
modmap, MODIFIER_MAP
outline, OUTLINE
overlay, OVERLAY
override, OVERRIDE
partial, PARTIAL
replace, REPLACE
row, ROW
section, SECTION
shape, SHAPE
solid, SOLID
text, TEXT
type, TYPE
virtual_modifiers, VIRTUAL_MODS
virtual, VIRTUAL
xkb_compatibility_map, XKB_COMPATMAP
xkb_compatibility, XKB_COMPATMAP
xkb_compat_map, XKB_COMPATMAP
xkb_compat, XKB_COMPATMAP
xkb_geometry, XKB_GEOMETRY
xkb_keycodes, XKB_KEYCODES
xkb_keymap, XKB_KEYMAP
xkb_layout, XKB_LAYOUT
xkb_semantics, XKB_SEMANTICS
xkb_symbols, XKB_SYMBOLS
xkb_types, XKB_TYPES
%%
int
keyword_to_token(const char *string, size_t len)
{
const struct keyword_tok *kt = keyword_gperf_lookup(string, len);
if (!kt)
return -1;
return kt->tok;
}