9 extern int yylex(void);
14 void yyerror(const char *str) {
15 fprintf(stderr,"error: %s\n",str);
22 void parse_file(const char *f) {
23 printf("opening %s\n", f);
24 if ((yyin = fopen(f, "r")) == NULL) {
29 fprintf(stderr, "Could not parse configfile\n");
39 printf("parsing done\n");
48 struct Colortriple *color;
55 %token <string>VARNAME
66 %token TOKFLOATING_MODIFIER
80 | lines WHITESPACE line
108 TOKBIND WHITESPACE binding_modifiers NUMBER WHITESPACE command
110 printf("\tFound binding mod%d with key %d and command %s\n", $<number>3, $4, $<string>6);
115 TOKBINDSYM WHITESPACE binding_modifiers WORD WHITESPACE command
117 printf("\tFound symbolic mod%d with key %s and command %s\n", $<number>3, $4, $<string>6);
122 TOKFLOATING_MODIFIER WHITESPACE binding_modifiers
124 printf("\tfloating modifier %d\n", $<number>3);
129 TOKWORKSPACE WHITESPACE NUMBER WHITESPACE TOKSCREEN WHITESPACE screen
131 printf("\t workspace %d to screen %s\n", $<number>3, $<string>7);
133 | TOKWORKSPACE WHITESPACE NUMBER WHITESPACE TOKSCREEN WHITESPACE screen WHITESPACE workspace_name
135 printf("\t quoted: %s\n", $<string>9);
145 NUMBER { asprintf(&$<string>$, "%d", $<number>1); }
146 | NUMBER 'x' { asprintf(&$<string>$, "%d", $<number>1); }
147 | NUMBER 'x' NUMBER { asprintf(&$<string>$, "%dx%d", $<number>1, $<number>3); }
148 | 'x' NUMBER { asprintf(&$<string>$, "x%d", $<number>2); }
152 TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow NUMBER
154 printf("assignment of %s to %d\n", $<string>3, $<number>6);
165 | TOKARROW WHITESPACE
169 TOKSET WHITESPACE variable WHITESPACE STR
171 printf("set %s to %s\n", $<string>3, $<string>5);
176 '$' WORD { asprintf(&$<string>$, "$%s", $<string>2); }
177 | '$' VARNAME { asprintf(&$<string>$, "$%s", $<string>2); }
181 TOKIPCSOCKET WHITESPACE STR
183 printf("ipc %s\n", $<string>3);
188 TOKEXEC WHITESPACE STR
190 printf("exec %s\n", $<string>3);
195 TOKTERMINAL WHITESPACE STR
197 printf("terminal %s\n", $<string>3);
202 TOKFONT WHITESPACE STR
204 printf("font %s\n", $<string>3);
210 TOKCOLOR WHITESPACE '#' HEX WHITESPACE '#' HEX WHITESPACE '#' HEX
212 printf("color %p, %s and %s and %s\n", $<color>1, $<string>4, $<string>7, $<string>10);
218 /* NULL */ { $<number>$ = 0; }
220 | binding_modifiers '+' binding_modifier { $<number>$ = $<number>1 | $<number>3; }
221 | binding_modifiers '+' { $<number>$ = $<number>1; }
225 MODIFIER { $<number>$ = $<number>1; }
226 | TOKCONTROL { $<number>$ = BIND_CONTROL; }
227 | TOKSHIFT { $<number>$ = BIND_SHIFT; }