Finish configfile parsing with lexer, implement -l to use the lexer.

Every user is encouraged to use -l to switch to the new lexer and
see if there are any problems.
This commit is contained in:
Michael Stapelberg
2009-09-19 19:05:15 +02:00
parent 207ad0a7df
commit ca472559b9
5 changed files with 60 additions and 12 deletions

View File

@ -152,6 +152,7 @@ void parse_file(const char *f) {
int number;
char *string;
struct Colortriple *color;
struct Assignment *assignment;
}
%token <number>NUMBER
@ -272,13 +273,39 @@ screen:
;
assign:
TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow NUMBER
TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow assign_target
{
/* TODO */
printf("assignment of %s to %d\n", $<string>3, $<number>6);
struct Assignment *new = $<assignment>6;
new->windowclass_title = strdup($<string>3);
TAILQ_INSERT_TAIL(&assignments, new, assignments);
}
;
assign_target:
NUMBER
{
struct Assignment *new = scalloc(sizeof(struct Assignment));
new->workspace = $<number>1;
new->floating = ASSIGN_FLOATING_NO;
$<assignment>$ = new;
}
| '~'
{
struct Assignment *new = scalloc(sizeof(struct Assignment));
new->floating = ASSIGN_FLOATING_ONLY;
$<assignment>$ = new;
}
| '~' NUMBER
{
struct Assignment *new = scalloc(sizeof(struct Assignment));
new->workspace = $<number>2;
new->floating = ASSIGN_FLOATING;
$<assignment>$ = new;
}
;
window_class:
QUOTEDSTRING
| STR_NG