cvsimport
* refs/heads/master: cycling fix: when no client is active, warp pointer to last active; from Walter Alejandro Iglesias. whitespace Fix spelling of some unused MWM hints; from Sean C. Farley. Add group-last command that shows only the previously active group; ok okan Allow bare numbers for key and mouse bindings; taken from similar support in other parse.y's; from Leon Fischer <lfischer@airmail.cc>. sync parse.y changes from base; ok naddy@ Do not attempt to grab keys without a keycode; this incidentally allows XF86 keys support.
This commit is contained in:
41
parse.y
41
parse.y
@@ -83,7 +83,7 @@ typedef struct {
|
||||
%token <v.string> STRING
|
||||
%token <v.number> NUMBER
|
||||
%type <v.number> yesno
|
||||
%type <v.string> string
|
||||
%type <v.string> string numberstring
|
||||
%%
|
||||
|
||||
grammar : /* empty */
|
||||
@@ -106,6 +106,17 @@ string : string STRING {
|
||||
| STRING
|
||||
;
|
||||
|
||||
numberstring : NUMBER {
|
||||
char *s;
|
||||
if (asprintf(&s, "%lld", $1) == -1) {
|
||||
yyerror("string: asprintf");
|
||||
YYERROR;
|
||||
}
|
||||
$$ = s;
|
||||
}
|
||||
| STRING
|
||||
;
|
||||
|
||||
yesno : YES { $$ = 1; }
|
||||
| NO { $$ = 0; }
|
||||
;
|
||||
@@ -211,7 +222,7 @@ main : FONTNAME STRING {
|
||||
conf->gap.left = $4;
|
||||
conf->gap.right = $5;
|
||||
}
|
||||
| BINDKEY STRING string {
|
||||
| BINDKEY numberstring string {
|
||||
if (!conf_bind_key(conf, $2, $3)) {
|
||||
yyerror("invalid bind-key: %s %s", $2, $3);
|
||||
free($2);
|
||||
@@ -221,7 +232,7 @@ main : FONTNAME STRING {
|
||||
free($2);
|
||||
free($3);
|
||||
}
|
||||
| UNBINDKEY STRING {
|
||||
| UNBINDKEY numberstring {
|
||||
if (!conf_bind_key(conf, $2, NULL)) {
|
||||
yyerror("invalid unbind-key: %s", $2);
|
||||
free($2);
|
||||
@@ -229,7 +240,7 @@ main : FONTNAME STRING {
|
||||
}
|
||||
free($2);
|
||||
}
|
||||
| BINDMOUSE STRING string {
|
||||
| BINDMOUSE numberstring string {
|
||||
if (!conf_bind_mouse(conf, $2, $3)) {
|
||||
yyerror("invalid bind-mouse: %s %s", $2, $3);
|
||||
free($2);
|
||||
@@ -239,7 +250,7 @@ main : FONTNAME STRING {
|
||||
free($2);
|
||||
free($3);
|
||||
}
|
||||
| UNBINDMOUSE STRING {
|
||||
| UNBINDMOUSE numberstring {
|
||||
if (!conf_bind_mouse(conf, $2, NULL)) {
|
||||
yyerror("invalid unbind-mouse: %s", $2);
|
||||
free($2);
|
||||
@@ -376,7 +387,7 @@ lgetc(int quotec)
|
||||
if (parsebuf) {
|
||||
/* Read character from the parsebuffer instead of input. */
|
||||
if (parseindex >= 0) {
|
||||
c = parsebuf[parseindex++];
|
||||
c = (unsigned char)parsebuf[parseindex++];
|
||||
if (c != '\0')
|
||||
return (c);
|
||||
parsebuf = NULL;
|
||||
@@ -385,7 +396,7 @@ lgetc(int quotec)
|
||||
}
|
||||
|
||||
if (pushback_index)
|
||||
return (pushback_buffer[--pushback_index]);
|
||||
return ((unsigned char)pushback_buffer[--pushback_index]);
|
||||
|
||||
if (quotec) {
|
||||
if ((c = getc(file->stream)) == EOF) {
|
||||
@@ -426,10 +437,10 @@ lungetc(int c)
|
||||
if (parseindex >= 0)
|
||||
return (c);
|
||||
}
|
||||
if (pushback_index < MAXPUSHBACK-1)
|
||||
return (pushback_buffer[pushback_index++] = c);
|
||||
else
|
||||
if (pushback_index + 1 >= MAXPUSHBACK)
|
||||
return (EOF);
|
||||
pushback_buffer[pushback_index++] = c;
|
||||
return (c);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -442,7 +453,7 @@ findeol(void)
|
||||
/* skip to either EOF or the first real EOL */
|
||||
while (1) {
|
||||
if (pushback_index)
|
||||
c = pushback_buffer[--pushback_index];
|
||||
c = (unsigned char)pushback_buffer[--pushback_index];
|
||||
else
|
||||
c = lgetc(0);
|
||||
if (c == '\n') {
|
||||
@@ -516,7 +527,7 @@ yylex(void)
|
||||
if (c == '-' || isdigit(c)) {
|
||||
do {
|
||||
*p++ = c;
|
||||
if ((unsigned)(p-buf) >= sizeof(buf)) {
|
||||
if ((size_t)(p-buf) >= sizeof(buf)) {
|
||||
yyerror("string too long");
|
||||
return (findeol());
|
||||
}
|
||||
@@ -539,8 +550,8 @@ yylex(void)
|
||||
} else {
|
||||
nodigits:
|
||||
while (p > buf + 1)
|
||||
lungetc(*--p);
|
||||
c = *--p;
|
||||
lungetc((unsigned char)*--p);
|
||||
c = (unsigned char)*--p;
|
||||
if (c == '-')
|
||||
return (c);
|
||||
}
|
||||
@@ -555,7 +566,7 @@ nodigits:
|
||||
if (isalnum(c) || c == ':' || c == '_' || c == '*' || c == '/') {
|
||||
do {
|
||||
*p++ = c;
|
||||
if ((unsigned)(p-buf) >= sizeof(buf)) {
|
||||
if ((size_t)(p-buf) >= sizeof(buf)) {
|
||||
yyerror("string too long");
|
||||
return (findeol());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user