]> Dogcows Code - chaz/openbox/blob - plugins/keyboard/keysrc.l
load keybindings from keysrc
[chaz/openbox] / plugins / keyboard / keysrc.l
1 %{
2 #include <glib.h>
3 #include "y.tab.h"
4
5 extern void kparseerror(char *s);
6 int kparselineno;
7 %}
8
9 field [A-Za-z0-9][-A-Za-z0-9]*
10 number [0-9]+
11 desktop [dD][eE][sS][kK][tT][oO][pP]
12 execute [eE][xX][eE][cC][uU][tT][eE]
13 restart [rR][eE][sS][tT][aA][rR][tT]
14 string \"[^"\n]*\"
15
16 %%
17
18 ^[ \t]*#.*\n kparselineno++;
19 {number} kparselval.integer = atoi(kparsetext); return INTEGER;
20 {execute} kparselval.string = g_strdup(kparsetext); return EXECUTE;
21 {restart} kparselval.string = g_strdup(kparsetext); return RESTART;
22 {desktop} kparselval.string = g_strdup(kparsetext); return DESKTOP;
23 {field} kparselval.string = g_strdup(kparsetext); return FIELD;
24 {string} {
25 /* drop the quotes */
26 kparselval.string = g_strdup(kparsetext+1);
27 if (kparselval.string[kparseleng-2] != '"') {
28 g_warning("improperly terminated string on line %d\n",
29 kparselineno);
30 kparseerror("");
31 } else
32 kparselval.string[kparseleng-2] = '\0';
33 return STRING;
34 }
35
36 [ \t]
37 \n kparselineno++; return *yytext;
38 . kparseerror("");
39
40 %%
41
42 int kparsewrap() {
43 return 1;
44 }
This page took 0.033394 seconds and 4 git commands to generate.