Rename bind to bindcode

Also fallback when using just 'bind' to be backward-compatible
This commit is contained in:
Sardem FF7
2011-04-18 23:06:32 +02:00
committed by Michael Stapelberg
parent 84b804cda6
commit cd6f93be3f
4 changed files with 50 additions and 49 deletions

View File

@ -33,7 +33,7 @@ int yycolumn = 1;
EOL (\r?\n)
%s BIND_COND
%s BINDCODE_COND
%s BINDSYM_COND
%s BIND_AWS_COND
%s BINDSYM_AWS_COND
@ -73,7 +73,8 @@ EOL (\r?\n)
<COLOR_COND>[0-9a-fA-F]+ { yylval.string = strdup(yytext); return HEX; }
[0-9]+ { yylval.number = atoi(yytext); return NUMBER; }
mode { return TOKMODE; }
bind { BEGIN(BIND_COND); return TOKBIND; }
bind { BEGIN(BINDCODE_COND); return TOKBINDCODE; }
bindcode { BEGIN(BINDCODE_COND); return TOKBINDCODE; }
bindsym { BEGIN(BINDSYM_COND); return TOKBINDSYM; }
floating_modifier { BEGIN(INITIAL); return TOKFLOATING_MODIFIER; }
workspace { BEGIN(INITIAL); return TOKWORKSPACE; }
@ -138,7 +139,7 @@ shift { return TOKSHIFT; }
BEGIN(INITIAL);
yy_push_state(BUFFER_LINE);
}
<BIND_COND>[ \t]+ { BEGIN(BIND_AWS_COND); return WHITESPACE; }
<BINDCODE_COND>[ \t]+ { BEGIN(BIND_AWS_COND); return WHITESPACE; }
<BINDSYM_COND>[ \t]+ { BEGIN(BINDSYM_AWS_COND); return WHITESPACE; }
<BIND_AWS_COND>[ \t]+ { BEGIN(BIND_A2WS_COND); return WHITESPACE; }
<BINDSYM_AWS_COND>[ \t]+ { BEGIN(BIND_A2WS_COND); return WHITESPACE; }

View File

@ -202,7 +202,7 @@ void parse_file(const char *f) {
%token <string>STR_NG "<string (non-greedy)>"
%token <string>HEX "<hex>"
%token <string>OUTPUT "<RandR output>"
%token TOKBIND
%token TOKBINDCODE
%token TOKTERMINAL
%token TOKCOMMENT "<comment>"
%token TOKFONT "font"
@ -289,14 +289,14 @@ bindline:
;
binding:
TOKBIND WHITESPACE bind { $<binding>$ = $<binding>3; }
TOKBINDCODE WHITESPACE bindcode { $<binding>$ = $<binding>3; }
| TOKBINDSYM WHITESPACE bindsym { $<binding>$ = $<binding>3; }
;
bind:
bindcode:
binding_modifiers NUMBER WHITESPACE command
{
printf("\tFound binding mod%d with key %d and command %s\n", $<number>1, $2, $<string>4);
printf("\tFound keycode binding mod%d with key %d and command %s\n", $<number>1, $2, $<string>4);
Binding *new = scalloc(sizeof(Binding));
new->keycode = $<number>2;
@ -310,7 +310,7 @@ bind:
bindsym:
binding_modifiers word_or_number WHITESPACE command
{
printf("\tFound symbolic mod%d with key %s and command %s\n", $<number>1, $<string>2, $<string>4);
printf("\tFound keysym binding mod%d with key %s and command %s\n", $<number>1, $<string>2, $<string>4);
Binding *new = scalloc(sizeof(Binding));
new->symbol = $<string>2;