00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #define YYBISON 1
00047
00048
00049 #define YYBISON_VERSION "2.4.1"
00050
00051
00052 #define YYSKELETON_NAME "yacc.c"
00053
00054
00055 #define YYPURE 0
00056
00057
00058 #define YYPUSH 0
00059
00060
00061 #define YYPULL 1
00062
00063
00064 #define YYLSP_NEEDED 0
00065
00066
00067
00068
00069
00070
00071 #line 1 "src/cfgparse.y"
00072
00073
00074
00075
00076
00077 #include <sys/types.h>
00078 #include <sys/stat.h>
00079 #include <sys/wait.h>
00080 #include <unistd.h>
00081 #include <fcntl.h>
00082 #include <limits.h>
00083
00084 #include "all.h"
00085
00086 static pid_t configerror_pid = -1;
00087
00088 static Match current_match;
00089
00090 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00091 extern int yylex(struct context *context);
00092 extern int yyparse(void);
00093 extern int yylex_destroy(void);
00094 extern FILE *yyin;
00095 YY_BUFFER_STATE yy_scan_string(const char *);
00096
00097 static struct bindings_head *current_bindings;
00098 static struct context *context;
00099
00100
00101
00102
00103
00104
00105 void yyerror(const char *error_message) {
00106 context->has_errors = true;
00107
00108 ELOG("\n");
00109 ELOG("CONFIG: %s\n", error_message);
00110 ELOG("CONFIG: in file \"%s\", line %d:\n",
00111 context->filename, context->line_number);
00112 ELOG("CONFIG: %s\n", context->line_copy);
00113 char buffer[context->last_column+1];
00114 buffer[context->last_column] = '\0';
00115 for (int c = 1; c <= context->last_column; c++)
00116 buffer[c-1] = (c >= context->first_column ? '^' : ' ');
00117 ELOG("CONFIG: %s\n", buffer);
00118 ELOG("\n");
00119 }
00120
00121 int yywrap() {
00122 return 1;
00123 }
00124
00125
00126
00127
00128
00129
00130
00131 static int detect_version(char *buf) {
00132 char *walk = buf;
00133 char *line = buf;
00134 while (*walk != '\0') {
00135 if (*walk != '\n') {
00136 walk++;
00137 continue;
00138 }
00139
00140
00141 if (strncasecmp(line, "bindcode", strlen("bindcode")) == 0 ||
00142 strncasecmp(line, "force_focus_wrapping", strlen("force_focus_wrapping")) == 0 ||
00143 strncasecmp(line, "# i3 config file (v4)", strlen("# i3 config file (v4)")) == 0 ||
00144 strncasecmp(line, "workspace_layout", strlen("workspace_layout")) == 0) {
00145 printf("deciding for version 4 due to this line: %.*s\n", (int)(walk-line), line);
00146 return 4;
00147 }
00148
00149
00150 if (strncasecmp(line, "bind", strlen("bind")) == 0) {
00151 char *bind = strchr(line, ' ');
00152 if (bind == NULL)
00153 goto next;
00154 while ((*bind == ' ' || *bind == '\t') && *bind != '\0')
00155 bind++;
00156 if (*bind == '\0')
00157 goto next;
00158 if ((bind = strchr(bind, ' ')) == NULL)
00159 goto next;
00160 while ((*bind == ' ' || *bind == '\t') && *bind != '\0')
00161 bind++;
00162 if (*bind == '\0')
00163 goto next;
00164 if (strncasecmp(bind, "layout", strlen("layout")) == 0 ||
00165 strncasecmp(bind, "floating", strlen("floating")) == 0 ||
00166 strncasecmp(bind, "workspace", strlen("workspace")) == 0 ||
00167 strncasecmp(bind, "focus left", strlen("focus left")) == 0 ||
00168 strncasecmp(bind, "focus right", strlen("focus right")) == 0 ||
00169 strncasecmp(bind, "focus up", strlen("focus up")) == 0 ||
00170 strncasecmp(bind, "focus down", strlen("focus down")) == 0 ||
00171 strncasecmp(bind, "border normal", strlen("border normal")) == 0 ||
00172 strncasecmp(bind, "border 1pixel", strlen("border 1pixel")) == 0 ||
00173 strncasecmp(bind, "border borderless", strlen("border borderless")) == 0) {
00174 printf("deciding for version 4 due to this line: %.*s\n", (int)(walk-line), line);
00175 return 4;
00176 }
00177 }
00178
00179 next:
00180
00181 walk++;
00182 line = walk;
00183 }
00184
00185 return 3;
00186 }
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 static char *migrate_config(char *input, off_t size) {
00198 int writepipe[2];
00199 int readpipe[2];
00200
00201 if (pipe(writepipe) != 0 ||
00202 pipe(readpipe) != 0) {
00203 warn("migrate_config: Could not create pipes");
00204 return NULL;
00205 }
00206
00207 pid_t pid = fork();
00208 if (pid == -1) {
00209 warn("Could not fork()");
00210 return NULL;
00211 }
00212
00213
00214 if (pid == 0) {
00215
00216 close(writepipe[1]);
00217 dup2(writepipe[0], 0);
00218
00219
00220 close(readpipe[0]);
00221 dup2(readpipe[1], 1);
00222
00223 static char *argv[] = {
00224 NULL,
00225 NULL
00226 };
00227 exec_i3_utility("i3-migrate-config-to-v4", argv);
00228 }
00229
00230
00231
00232
00233 close(writepipe[0]);
00234
00235
00236
00237 int written = 0;
00238 int ret;
00239 while (written < size) {
00240 if ((ret = write(writepipe[1], input + written, size - written)) < 0) {
00241 warn("Could not write to pipe");
00242 return NULL;
00243 }
00244 written += ret;
00245 }
00246 close(writepipe[1]);
00247
00248
00249 close(readpipe[1]);
00250
00251
00252 int conv_size = 65535;
00253 char *converted = malloc(conv_size);
00254 int read_bytes = 0;
00255 do {
00256 if (read_bytes == conv_size) {
00257 conv_size += 65535;
00258 converted = realloc(converted, conv_size);
00259 }
00260 ret = read(readpipe[0], converted + read_bytes, conv_size - read_bytes);
00261 if (ret == -1) {
00262 warn("Cannot read from pipe");
00263 return NULL;
00264 }
00265 read_bytes += ret;
00266 } while (ret > 0);
00267
00268
00269 int status;
00270 wait(&status);
00271 if (!WIFEXITED(status)) {
00272 fprintf(stderr, "Child did not terminate normally, using old config file (will lead to broken behaviour)\n");
00273 return NULL;
00274 }
00275
00276 int returncode = WEXITSTATUS(status);
00277 if (returncode != 0) {
00278 fprintf(stderr, "Migration process exit code was != 0\n");
00279 if (returncode == 2) {
00280 fprintf(stderr, "could not start the migration script\n");
00281
00282 } else if (returncode == 1) {
00283 fprintf(stderr, "This already was a v4 config. Please add the following line to your config file:\n");
00284 fprintf(stderr, "# i3 config file (v4)\n");
00285
00286 }
00287 return NULL;
00288 }
00289
00290 return converted;
00291 }
00292
00293
00294
00295
00296
00297
00298 static void nagbar_exited(EV_P_ ev_child *watcher, int revents) {
00299 ev_child_stop(EV_A_ watcher);
00300 if (!WIFEXITED(watcher->rstatus)) {
00301 fprintf(stderr, "ERROR: i3-nagbar did not exit normally.\n");
00302 return;
00303 }
00304
00305 int exitcode = WEXITSTATUS(watcher->rstatus);
00306 printf("i3-nagbar process exited with status %d\n", exitcode);
00307 if (exitcode == 2) {
00308 fprintf(stderr, "ERROR: i3-nagbar could not be found. Is it correctly installed on your system?\n");
00309 }
00310
00311 configerror_pid = -1;
00312 }
00313
00314
00315
00316
00317
00318
00319
00320
00321 static void start_configerror_nagbar(const char *config_path) {
00322 fprintf(stderr, "Would start i3-nagscreen now\n");
00323 configerror_pid = fork();
00324 if (configerror_pid == -1) {
00325 warn("Could not fork()");
00326 return;
00327 }
00328
00329
00330 if (configerror_pid == 0) {
00331 char *editaction,
00332 *pageraction;
00333 if (asprintf(&editaction, TERM_EMU " -e sh -c \"${EDITOR:-vi} \"%s\" && i3-msg reload\"", config_path) == -1)
00334 exit(1);
00335 if (asprintf(&pageraction, TERM_EMU " -e sh -c \"${PAGER:-less} \"%s\"\"", errorfilename) == -1)
00336 exit(1);
00337 char *argv[] = {
00338 NULL,
00339 "-m",
00340 "You have an error in your i3 config file!",
00341 "-b",
00342 "edit config",
00343 editaction,
00344 (errorfilename ? "-b" : NULL),
00345 "show errors",
00346 pageraction,
00347 NULL
00348 };
00349 exec_i3_utility("i3-nagbar", argv);
00350 }
00351
00352
00353
00354 ev_child *child = smalloc(sizeof(ev_child));
00355 ev_child_init(child, &nagbar_exited, configerror_pid, 0);
00356 ev_child_start(main_loop, child);
00357 }
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368 void kill_configerror_nagbar(bool wait_for_it) {
00369 if (configerror_pid == -1)
00370 return;
00371
00372 if (kill(configerror_pid, SIGTERM) == -1)
00373 warn("kill(configerror_nagbar) failed");
00374
00375 if (!wait_for_it)
00376 return;
00377
00378
00379
00380
00381
00382 waitpid(configerror_pid, NULL, 0);
00383 }
00384
00385 void parse_file(const char *f) {
00386 SLIST_HEAD(variables_head, Variable) variables = SLIST_HEAD_INITIALIZER(&variables);
00387 int fd, ret, read_bytes = 0;
00388 struct stat stbuf;
00389 char *buf;
00390 FILE *fstr;
00391 char buffer[1026], key[512], value[512];
00392
00393 if ((fd = open(f, O_RDONLY)) == -1)
00394 die("Could not open configuration file: %s\n", strerror(errno));
00395
00396 if (fstat(fd, &stbuf) == -1)
00397 die("Could not fstat file: %s\n", strerror(errno));
00398
00399 buf = scalloc((stbuf.st_size + 1) * sizeof(char));
00400 while (read_bytes < stbuf.st_size) {
00401 if ((ret = read(fd, buf + read_bytes, (stbuf.st_size - read_bytes))) < 0)
00402 die("Could not read(): %s\n", strerror(errno));
00403 read_bytes += ret;
00404 }
00405
00406 if (lseek(fd, 0, SEEK_SET) == (off_t)-1)
00407 die("Could not lseek: %s\n", strerror(errno));
00408
00409 if ((fstr = fdopen(fd, "r")) == NULL)
00410 die("Could not fdopen: %s\n", strerror(errno));
00411
00412 while (!feof(fstr)) {
00413 if (fgets(buffer, 1024, fstr) == NULL) {
00414 if (feof(fstr))
00415 break;
00416 die("Could not read configuration file\n");
00417 }
00418
00419
00420 if (sscanf(buffer, "%s %[^\n]", key, value) < 1 ||
00421 key[0] == '#' || strlen(key) < 3)
00422 continue;
00423
00424 if (strcasecmp(key, "set") == 0) {
00425 if (value[0] != '$')
00426 die("Malformed variable assignment, name has to start with $\n");
00427
00428
00429 char *v_key = value, *v_value;
00430 if ((v_value = strstr(value, " ")) == NULL)
00431 die("Malformed variable assignment, need a value\n");
00432
00433 *(v_value++) = '\0';
00434
00435 struct Variable *new = scalloc(sizeof(struct Variable));
00436 new->key = sstrdup(v_key);
00437 new->value = sstrdup(v_value);
00438 SLIST_INSERT_HEAD(&variables, new, variables);
00439 DLOG("Got new variable %s = %s\n", v_key, v_value);
00440 continue;
00441 }
00442 }
00443 fclose(fstr);
00444
00445
00446
00447 struct Variable *current, *nearest;
00448 int extra_bytes = 0;
00449
00450
00451
00452 char *bufcopy = sstrdup(buf);
00453 SLIST_FOREACH(current, &variables, variables) {
00454 int extra = (strlen(current->value) - strlen(current->key));
00455 char *next;
00456 for (next = bufcopy;
00457 (next = strcasestr(bufcopy + (next - bufcopy), current->key)) != NULL;
00458 next += strlen(current->key)) {
00459 *next = '_';
00460 extra_bytes += extra;
00461 }
00462 }
00463 FREE(bufcopy);
00464
00465
00466
00467 char *walk = buf, *destwalk;
00468 char *new = smalloc((stbuf.st_size + extra_bytes + 1) * sizeof(char));
00469 destwalk = new;
00470 while (walk < (buf + stbuf.st_size)) {
00471
00472 SLIST_FOREACH(current, &variables, variables)
00473 current->next_match = strcasestr(walk, current->key);
00474 nearest = NULL;
00475 int distance = stbuf.st_size;
00476 SLIST_FOREACH(current, &variables, variables) {
00477 if (current->next_match == NULL)
00478 continue;
00479 if ((current->next_match - walk) < distance) {
00480 distance = (current->next_match - walk);
00481 nearest = current;
00482 }
00483 }
00484 if (nearest == NULL) {
00485
00486 strncpy(destwalk, walk, (buf + stbuf.st_size) - walk);
00487 destwalk += (buf + stbuf.st_size) - walk;
00488 *destwalk = '\0';
00489 break;
00490 } else {
00491
00492 strncpy(destwalk, walk, distance);
00493 strncpy(destwalk + distance, nearest->value, strlen(nearest->value));
00494 walk += distance + strlen(nearest->key);
00495 destwalk += distance + strlen(nearest->value);
00496 }
00497 }
00498
00499
00500
00501 int version = detect_version(buf);
00502 if (version == 3) {
00503
00504 char *converted = migrate_config(new, stbuf.st_size);
00505 if (converted != NULL) {
00506 printf("\n");
00507 printf("****************************************************************\n");
00508 printf("NOTE: Automatically converted configuration file from v3 to v4.\n");
00509 printf("\n");
00510 printf("Please convert your config file to v4. You can use this command:\n");
00511 printf(" mv %s %s.O\n", f, f);
00512 printf(" i3-migrate-config-to-v4 %s.O > %s\n", f, f);
00513 printf("****************************************************************\n");
00514 printf("\n");
00515 free(new);
00516 new = converted;
00517 } else {
00518 printf("\n");
00519 printf("**********************************************************************\n");
00520 printf("ERROR: Could not convert config file. Maybe i3-migrate-config-to-v4\n");
00521 printf("was not correctly installed on your system?\n");
00522 printf("**********************************************************************\n");
00523 printf("\n");
00524 }
00525 }
00526
00527
00528 yy_scan_string(new);
00529
00530 context = scalloc(sizeof(struct context));
00531 context->filename = f;
00532
00533 if (yyparse() != 0) {
00534 fprintf(stderr, "Could not parse configfile\n");
00535 exit(1);
00536 }
00537
00538 if (context->has_errors) {
00539 start_configerror_nagbar(f);
00540 }
00541
00542 yylex_destroy();
00543 FREE(context->line_copy);
00544 free(context);
00545 free(new);
00546 free(buf);
00547
00548 while (!SLIST_EMPTY(&variables)) {
00549 current = SLIST_FIRST(&variables);
00550 FREE(current->key);
00551 FREE(current->value);
00552 SLIST_REMOVE_HEAD(&variables, variables);
00553 FREE(current);
00554 }
00555 }
00556
00557
00558
00559
00560 #line 561 "src/cfgparse.tab.c"
00561
00562
00563 #ifndef YYDEBUG
00564 # define YYDEBUG 1
00565 #endif
00566
00567
00568 #ifdef YYERROR_VERBOSE
00569 # undef YYERROR_VERBOSE
00570 # define YYERROR_VERBOSE 1
00571 #else
00572 # define YYERROR_VERBOSE 1
00573 #endif
00574
00575
00576 #ifndef YYTOKEN_TABLE
00577 # define YYTOKEN_TABLE 0
00578 #endif
00579
00580
00581
00582 #ifndef YYTOKENTYPE
00583 # define YYTOKENTYPE
00584
00585
00586 enum yytokentype {
00587 NUMBER = 258,
00588 WORD = 259,
00589 STR = 260,
00590 STR_NG = 261,
00591 HEX = 262,
00592 OUTPUT = 263,
00593 TOKBINDCODE = 264,
00594 TOKTERMINAL = 265,
00595 TOKCOMMENT = 266,
00596 TOKFONT = 267,
00597 TOKBINDSYM = 268,
00598 MODIFIER = 269,
00599 TOKCONTROL = 270,
00600 TOKSHIFT = 271,
00601 TOKFLOATING_MODIFIER = 272,
00602 QUOTEDSTRING = 273,
00603 TOKWORKSPACE = 274,
00604 TOKOUTPUT = 275,
00605 TOKASSIGN = 276,
00606 TOKSET = 277,
00607 TOKIPCSOCKET = 278,
00608 TOKRESTARTSTATE = 279,
00609 TOKEXEC = 280,
00610 TOKEXEC_ALWAYS = 281,
00611 TOKSINGLECOLOR = 282,
00612 TOKCOLOR = 283,
00613 TOKARROW = 284,
00614 TOKMODE = 285,
00615 TOK_ORIENTATION = 286,
00616 TOK_HORIZ = 287,
00617 TOK_VERT = 288,
00618 TOK_AUTO = 289,
00619 TOK_WORKSPACE_LAYOUT = 290,
00620 TOKNEWWINDOW = 291,
00621 TOK_NORMAL = 292,
00622 TOK_NONE = 293,
00623 TOK_1PIXEL = 294,
00624 TOKFOCUSFOLLOWSMOUSE = 295,
00625 TOK_FORCE_FOCUS_WRAPPING = 296,
00626 TOKWORKSPACEBAR = 297,
00627 TOK_DEFAULT = 298,
00628 TOK_STACKING = 299,
00629 TOK_TABBED = 300,
00630 TOKSTACKLIMIT = 301,
00631 TOK_POPUP_DURING_FULLSCREEN = 302,
00632 TOK_IGNORE = 303,
00633 TOK_LEAVE_FULLSCREEN = 304,
00634 TOK_FOR_WINDOW = 305,
00635 TOK_MARK = 306,
00636 TOK_CLASS = 307,
00637 TOK_ID = 308,
00638 TOK_CON_ID = 309,
00639 TOK_TITLE = 310
00640 };
00641 #endif
00642
00643
00644
00645 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00646 typedef union YYSTYPE
00647 {
00648
00649
00650 #line 491 "src/cfgparse.y"
00651
00652 int number;
00653 char *string;
00654 uint32_t *single_color;
00655 struct Colortriple *color;
00656 Match *match;
00657 struct Binding *binding;
00658
00659
00660
00661
00662 #line 663 "src/cfgparse.tab.c"
00663 } YYSTYPE;
00664 # define YYSTYPE_IS_TRIVIAL 1
00665 # define yystype YYSTYPE
00666 # define YYSTYPE_IS_DECLARED 1
00667 #endif
00668
00669
00670
00671
00672
00673
00674 #line 675 "src/cfgparse.tab.c"
00675
00676 #ifdef short
00677 # undef short
00678 #endif
00679
00680 #ifdef YYTYPE_UINT8
00681 typedef YYTYPE_UINT8 yytype_uint8;
00682 #else
00683 typedef unsigned char yytype_uint8;
00684 #endif
00685
00686 #ifdef YYTYPE_INT8
00687 typedef YYTYPE_INT8 yytype_int8;
00688 #elif (defined __STDC__ || defined __C99__FUNC__ \
00689 || defined __cplusplus || defined _MSC_VER)
00690 typedef signed char yytype_int8;
00691 #else
00692 typedef short int yytype_int8;
00693 #endif
00694
00695 #ifdef YYTYPE_UINT16
00696 typedef YYTYPE_UINT16 yytype_uint16;
00697 #else
00698 typedef unsigned short int yytype_uint16;
00699 #endif
00700
00701 #ifdef YYTYPE_INT16
00702 typedef YYTYPE_INT16 yytype_int16;
00703 #else
00704 typedef short int yytype_int16;
00705 #endif
00706
00707 #ifndef YYSIZE_T
00708 # ifdef __SIZE_TYPE__
00709 # define YYSIZE_T __SIZE_TYPE__
00710 # elif defined size_t
00711 # define YYSIZE_T size_t
00712 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00713 || defined __cplusplus || defined _MSC_VER)
00714 # include <stddef.h>
00715 # define YYSIZE_T size_t
00716 # else
00717 # define YYSIZE_T unsigned int
00718 # endif
00719 #endif
00720
00721 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00722
00723 #ifndef YY_
00724 # if YYENABLE_NLS
00725 # if ENABLE_NLS
00726 # include <libintl.h>
00727 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00728 # endif
00729 # endif
00730 # ifndef YY_
00731 # define YY_(msgid) msgid
00732 # endif
00733 #endif
00734
00735
00736 #if ! defined lint || defined __GNUC__
00737 # define YYUSE(e) ((void) (e))
00738 #else
00739 # define YYUSE(e)
00740 #endif
00741
00742
00743 #ifndef lint
00744 # define YYID(n) (n)
00745 #else
00746 #if (defined __STDC__ || defined __C99__FUNC__ \
00747 || defined __cplusplus || defined _MSC_VER)
00748 static int
00749 YYID (int yyi)
00750 #else
00751 static int
00752 YYID (yyi)
00753 int yyi;
00754 #endif
00755 {
00756 return yyi;
00757 }
00758 #endif
00759
00760 #if ! defined yyoverflow || YYERROR_VERBOSE
00761
00762
00763
00764 # ifdef YYSTACK_USE_ALLOCA
00765 # if YYSTACK_USE_ALLOCA
00766 # ifdef __GNUC__
00767 # define YYSTACK_ALLOC __builtin_alloca
00768 # elif defined __BUILTIN_VA_ARG_INCR
00769 # include <alloca.h>
00770 # elif defined _AIX
00771 # define YYSTACK_ALLOC __alloca
00772 # elif defined _MSC_VER
00773 # include <malloc.h>
00774 # define alloca _alloca
00775 # else
00776 # define YYSTACK_ALLOC alloca
00777 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00778 || defined __cplusplus || defined _MSC_VER)
00779 # include <stdlib.h>
00780 # ifndef _STDLIB_H
00781 # define _STDLIB_H 1
00782 # endif
00783 # endif
00784 # endif
00785 # endif
00786 # endif
00787
00788 # ifdef YYSTACK_ALLOC
00789
00790 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
00791 # ifndef YYSTACK_ALLOC_MAXIMUM
00792
00793
00794
00795
00796 # define YYSTACK_ALLOC_MAXIMUM 4032
00797 # endif
00798 # else
00799 # define YYSTACK_ALLOC YYMALLOC
00800 # define YYSTACK_FREE YYFREE
00801 # ifndef YYSTACK_ALLOC_MAXIMUM
00802 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00803 # endif
00804 # if (defined __cplusplus && ! defined _STDLIB_H \
00805 && ! ((defined YYMALLOC || defined malloc) \
00806 && (defined YYFREE || defined free)))
00807 # include <stdlib.h>
00808 # ifndef _STDLIB_H
00809 # define _STDLIB_H 1
00810 # endif
00811 # endif
00812 # ifndef YYMALLOC
00813 # define YYMALLOC malloc
00814 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00815 || defined __cplusplus || defined _MSC_VER)
00816 void *malloc (YYSIZE_T);
00817 # endif
00818 # endif
00819 # ifndef YYFREE
00820 # define YYFREE free
00821 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00822 || defined __cplusplus || defined _MSC_VER)
00823 void free (void *);
00824 # endif
00825 # endif
00826 # endif
00827 #endif
00828
00829
00830 #if (! defined yyoverflow \
00831 && (! defined __cplusplus \
00832 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00833
00834
00835 union yyalloc
00836 {
00837 yytype_int16 yyss_alloc;
00838 YYSTYPE yyvs_alloc;
00839 };
00840
00841
00842 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00843
00844
00845
00846 # define YYSTACK_BYTES(N) \
00847 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00848 + YYSTACK_GAP_MAXIMUM)
00849
00850
00851
00852 # ifndef YYCOPY
00853 # if defined __GNUC__ && 1 < __GNUC__
00854 # define YYCOPY(To, From, Count) \
00855 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00856 # else
00857 # define YYCOPY(To, From, Count) \
00858 do \
00859 { \
00860 YYSIZE_T yyi; \
00861 for (yyi = 0; yyi < (Count); yyi++) \
00862 (To)[yyi] = (From)[yyi]; \
00863 } \
00864 while (YYID (0))
00865 # endif
00866 # endif
00867
00868
00869
00870
00871
00872
00873 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
00874 do \
00875 { \
00876 YYSIZE_T yynewbytes; \
00877 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
00878 Stack = &yyptr->Stack_alloc; \
00879 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00880 yyptr += yynewbytes / sizeof (*yyptr); \
00881 } \
00882 while (YYID (0))
00883
00884 #endif
00885
00886
00887 #define YYFINAL 2
00888
00889 #define YYLAST 106
00890
00891
00892 #define YYNTOKENS 63
00893
00894 #define YYNNTS 47
00895
00896 #define YYNRULES 98
00897
00898 #define YYNSTATES 146
00899
00900
00901 #define YYUNDEFTOK 2
00902 #define YYMAXUTOK 310
00903
00904 #define YYTRANSLATE(YYX) \
00905 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00906
00907
00908 static const yytype_uint8 yytranslate[] =
00909 {
00910 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00911 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00912 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00913 2, 2, 2, 2, 2, 61, 2, 2, 2, 2,
00914 2, 2, 2, 62, 2, 2, 2, 2, 2, 2,
00915 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00916 2, 58, 2, 2, 2, 2, 2, 2, 2, 2,
00917 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00918 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00919 2, 56, 2, 57, 2, 2, 2, 2, 2, 2,
00920 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00921 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00922 2, 2, 2, 59, 2, 60, 2, 2, 2, 2,
00923 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00924 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00925 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00926 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00927 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00928 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00929 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00930 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00931 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00932 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00933 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00934 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00935 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
00936 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
00937 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
00938 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
00939 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
00940 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
00941 55
00942 };
00943
00944 #if YYDEBUG
00945
00946
00947 static const yytype_uint8 yyprhs[] =
00948 {
00949 0, 0, 3, 4, 7, 10, 12, 14, 16, 18,
00950 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
00951 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
00952 60, 63, 66, 70, 74, 78, 79, 83, 85, 87,
00953 91, 95, 99, 103, 107, 109, 111, 117, 118, 121,
00954 123, 125, 128, 131, 133, 135, 137, 140, 145, 147,
00955 149, 151, 154, 156, 158, 160, 162, 164, 167, 170,
00956 173, 179, 183, 184, 186, 188, 190, 192, 196, 198,
00957 200, 203, 206, 209, 212, 215, 218, 221, 226, 229,
00958 230, 232, 236, 239, 241, 243, 245, 248, 250
00959 };
00960
00961
00962 static const yytype_int8 yyrhs[] =
00963 {
00964 64, 0, -1, -1, 64, 1, -1, 64, 65, -1,
00965 68, -1, 72, -1, 78, -1, 81, -1, 82, -1,
00966 84, -1, 86, -1, 89, -1, 90, -1, 91, -1,
00967 92, -1, 95, -1, 97, -1, 98, -1, 99, -1,
00968 100, -1, 103, -1, 104, -1, 101, -1, 102, -1,
00969 66, -1, 108, -1, 11, -1, 5, -1, 69, -1,
00970 9, 70, -1, 13, 71, -1, 106, 3, 67, -1,
00971 106, 77, 67, -1, 50, 73, 67, -1, -1, 74,
00972 76, 75, -1, 56, -1, 57, -1, 52, 58, 5,
00973 -1, 54, 58, 5, -1, 53, 58, 5, -1, 51,
00974 58, 5, -1, 55, 58, 5, -1, 4, -1, 3,
00975 -1, 30, 18, 59, 79, 60, -1, -1, 79, 80,
00976 -1, 66, -1, 69, -1, 17, 106, -1, 31, 83,
00977 -1, 32, -1, 33, -1, 34, -1, 35, 85, -1,
00978 35, 46, 46, 3, -1, 43, -1, 44, -1, 45,
00979 -1, 36, 87, -1, 37, -1, 38, -1, 39, -1,
00980 3, -1, 4, -1, 40, 88, -1, 41, 88, -1,
00981 42, 88, -1, 19, 3, 20, 8, 93, -1, 19,
00982 3, 94, -1, -1, 94, -1, 18, -1, 5, -1,
00983 4, -1, 21, 96, 5, -1, 18, -1, 6, -1,
00984 23, 5, -1, 24, 5, -1, 25, 5, -1, 26,
00985 5, -1, 10, 5, -1, 12, 5, -1, 27, 105,
00986 -1, 28, 105, 105, 105, -1, 61, 7, -1, -1,
00987 107, -1, 106, 62, 107, -1, 106, 62, -1, 14,
00988 -1, 15, -1, 16, -1, 47, 109, -1, 48, -1,
00989 49, -1
00990 };
00991
00992
00993 static const yytype_uint16 yyrline[] =
00994 {
00995 0, 575, 575, 576, 577, 581, 582, 583, 584, 585,
00996 586, 587, 588, 589, 590, 591, 592, 593, 594, 595,
00997 596, 597, 598, 599, 600, 601, 602, 606, 610, 614,
00998 621, 622, 626, 640, 654, 665, 666, 673, 681, 688,
00999 693, 708, 723, 728, 738, 739, 746, 769, 771, 775,
01000 776, 788, 796, 804, 805, 806, 810, 834, 855, 856,
01001 857, 861, 869, 870, 871, 875, 879, 891, 899, 907,
01002 915, 935, 953, 954, 958, 959, 960, 964, 1016, 1017,
01003 1021, 1028, 1035, 1044, 1053, 1061, 1070, 1078, 1089, 1101,
01004 1102, 1103, 1104, 1108, 1109, 1110, 1114, 1122, 1123
01005 };
01006 #endif
01007
01008 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
01009
01010
01011 static const char *const yytname[] =
01012 {
01013 "$end", "error", "$undefined", "\"<number>\"", "\"<word>\"",
01014 "\"<string>\"", "\"<string (non-greedy)>\"", "\"<hex>\"",
01015 "\"<RandR output>\"", "TOKBINDCODE", "TOKTERMINAL", "\"<comment>\"",
01016 "\"font\"", "\"bindsym\"", "\"<modifier>\"", "\"control\"", "\"shift\"",
01017 "\"floating_modifier\"", "\"<quoted string>\"", "\"workspace\"",
01018 "\"output\"", "\"assign\"", "TOKSET", "\"ipc_socket\"",
01019 "\"restart_state\"", "\"exec\"", "\"exec_always\"", "TOKSINGLECOLOR",
01020 "TOKCOLOR", "\"\\342\\206\\222\"", "\"mode\"", "\"default_orientation\"",
01021 "\"horizontal\"", "\"vertical\"", "\"auto\"", "\"workspace_layout\"",
01022 "\"new_window\"", "\"normal\"", "\"none\"", "\"1pixel\"",
01023 "\"focus_follows_mouse\"", "\"force_focus_wrapping\"",
01024 "\"workspace_bar\"", "\"default\"", "\"stacking\"", "\"tabbed\"",
01025 "\"stack-limit\"", "\"popup_during_fullscreen\"", "\"ignore\"",
01026 "\"leave_fullscreen\"", "\"for_window\"", "\"mark\"", "\"class\"",
01027 "\"id\"", "\"con_id\"", "\"title\"", "'['", "']'", "'='", "'{'", "'}'",
01028 "'#'", "'+'", "$accept", "lines", "line", "comment", "command",
01029 "bindline", "binding", "bindcode", "bindsym", "for_window", "match",
01030 "matchstart", "matchend", "criteria", "word_or_number", "mode",
01031 "modelines", "modeline", "floating_modifier", "orientation", "direction",
01032 "workspace_layout", "layout_mode", "new_window", "border_style", "bool",
01033 "focus_follows_mouse", "force_focus_wrapping", "workspace_bar",
01034 "workspace", "optional_workspace_name", "workspace_name", "assign",
01035 "window_class", "ipcsocket", "restart_state", "exec", "exec_always",
01036 "terminal", "font", "single_color", "color", "colorpixel",
01037 "binding_modifiers", "binding_modifier", "popup_during_fullscreen",
01038 "popup_setting", 0
01039 };
01040 #endif
01041
01042 # ifdef YYPRINT
01043
01044
01045 static const yytype_uint16 yytoknum[] =
01046 {
01047 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
01048 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
01049 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
01050 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
01051 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
01052 305, 306, 307, 308, 309, 310, 91, 93, 61, 123,
01053 125, 35, 43
01054 };
01055 # endif
01056
01057
01058 static const yytype_uint8 yyr1[] =
01059 {
01060 0, 63, 64, 64, 64, 65, 65, 65, 65, 65,
01061 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
01062 65, 65, 65, 65, 65, 65, 65, 66, 67, 68,
01063 69, 69, 70, 71, 72, 73, 73, 74, 75, 76,
01064 76, 76, 76, 76, 77, 77, 78, 79, 79, 80,
01065 80, 81, 82, 83, 83, 83, 84, 84, 85, 85,
01066 85, 86, 87, 87, 87, 88, 88, 89, 90, 91,
01067 92, 92, 93, 93, 94, 94, 94, 95, 96, 96,
01068 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
01069 106, 106, 106, 107, 107, 107, 108, 109, 109
01070 };
01071
01072
01073 static const yytype_uint8 yyr2[] =
01074 {
01075 0, 2, 0, 2, 2, 1, 1, 1, 1, 1,
01076 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
01077 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
01078 2, 2, 3, 3, 3, 0, 3, 1, 1, 3,
01079 3, 3, 3, 3, 1, 1, 5, 0, 2, 1,
01080 1, 2, 2, 1, 1, 1, 2, 4, 1, 1,
01081 1, 2, 1, 1, 1, 1, 1, 2, 2, 2,
01082 5, 3, 0, 1, 1, 1, 1, 3, 1, 1,
01083 2, 2, 2, 2, 2, 2, 2, 4, 2, 0,
01084 1, 3, 2, 1, 1, 1, 2, 1, 1
01085 };
01086
01087
01088
01089
01090 static const yytype_uint8 yydefact[] =
01091 {
01092 2, 0, 1, 3, 89, 0, 27, 0, 89, 89,
01093 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
01094 0, 0, 0, 0, 0, 0, 35, 4, 25, 5,
01095 29, 6, 7, 8, 9, 10, 11, 12, 13, 14,
01096 15, 16, 17, 18, 19, 20, 23, 24, 21, 22,
01097 26, 93, 94, 95, 30, 0, 90, 84, 85, 31,
01098 0, 51, 0, 79, 78, 0, 80, 81, 82, 83,
01099 0, 86, 0, 0, 53, 54, 55, 52, 58, 59,
01100 60, 0, 56, 62, 63, 64, 61, 65, 66, 67,
01101 68, 69, 97, 98, 96, 37, 0, 0, 0, 92,
01102 45, 44, 0, 76, 75, 74, 0, 71, 77, 88,
01103 0, 47, 0, 28, 34, 0, 0, 0, 0, 0,
01104 0, 32, 91, 33, 72, 87, 0, 57, 0, 0,
01105 0, 0, 0, 38, 36, 70, 73, 46, 49, 50,
01106 48, 42, 39, 41, 40, 43
01107 };
01108
01109
01110 static const yytype_int16 yydefgoto[] =
01111 {
01112 -1, 1, 27, 28, 114, 29, 30, 54, 59, 31,
01113 96, 97, 134, 120, 102, 32, 126, 140, 33, 34,
01114 77, 35, 82, 36, 86, 89, 37, 38, 39, 40,
01115 135, 107, 41, 65, 42, 43, 44, 45, 46, 47,
01116 48, 49, 71, 55, 56, 50, 94
01117 };
01118
01119
01120
01121 #define YYPACT_NINF -95
01122 static const yytype_int8 yypact[] =
01123 {
01124 -95, 11, -95, -95, 34, 1, -95, 5, 34, 34,
01125 16, 27, 35, 49, 52, 54, 19, 19, 63, 40,
01126 25, 38, 22, 22, 22, -33, 26, -95, -95, -95,
01127 -95, -95, -95, -95, -95, -95, -95, -95, -95, -95,
01128 -95, -95, -95, -95, -95, -95, -95, -95, -95, -95,
01129 -95, -95, -95, -95, -95, 0, -95, -95, -95, -95,
01130 -2, 21, 9, -95, -95, 79, -95, -95, -95, -95,
01131 78, -95, 19, 28, -95, -95, -95, -95, -95, -95,
01132 -95, 42, -95, -95, -95, -95, -95, -95, -95, -95,
01133 -95, -95, -95, -95, -95, -95, 81, 12, 81, 34,
01134 -95, -95, 81, -95, -95, -95, 82, -95, -95, -95,
01135 19, -95, 86, -95, -95, 33, 36, 37, 39, 41,
01136 43, -95, -95, -95, 13, -95, -4, -95, 87, 91,
01137 93, 96, 97, -95, -95, -95, -95, -95, -95, -95,
01138 -95, -95, -95, -95, -95, -95
01139 };
01140
01141
01142 static const yytype_int8 yypgoto[] =
01143 {
01144 -95, -95, -95, -23, -94, -95, -22, -95, -95, -95,
01145 -95, -95, -95, -95, -95, -95, -95, -95, -95, -95,
01146 -95, -95, -95, -95, -95, 20, -95, -95, -95, -95,
01147 -95, -19, -95, -95, -95, -95, -95, -95, -95, -95,
01148 -95, -95, -17, 70, 7, -95, -95
01149 };
01150
01151
01152
01153
01154
01155 #define YYTABLE_NINF -1
01156 static const yytype_uint8 yytable[] =
01157 {
01158 72, 100, 101, 98, 121, 4, 57, 6, 123, 8,
01159 58, 2, 3, 103, 104, 92, 93, 103, 104, 62,
01160 4, 5, 6, 7, 8, 87, 88, 105, 9, 106,
01161 10, 105, 11, 63, 12, 13, 14, 15, 16, 17,
01162 66, 18, 19, 90, 91, 64, 20, 21, 51, 52,
01163 53, 22, 23, 24, 67, 110, 137, 68, 25, 69,
01164 99, 26, 99, 115, 116, 117, 118, 119, 78, 79,
01165 80, 81, 74, 75, 76, 83, 84, 85, 60, 61,
01166 70, 73, 95, 99, 108, 109, 113, 111, 112, 127,
01167 124, 128, 141, 125, 129, 130, 142, 131, 143, 132,
01168 133, 144, 145, 138, 139, 136, 122
01169 };
01170
01171 static const yytype_uint8 yycheck[] =
01172 {
01173 17, 3, 4, 3, 98, 9, 5, 11, 102, 13,
01174 5, 0, 1, 4, 5, 48, 49, 4, 5, 3,
01175 9, 10, 11, 12, 13, 3, 4, 18, 17, 20,
01176 19, 18, 21, 6, 23, 24, 25, 26, 27, 28,
01177 5, 30, 31, 23, 24, 18, 35, 36, 14, 15,
01178 16, 40, 41, 42, 5, 72, 60, 5, 47, 5,
01179 62, 50, 62, 51, 52, 53, 54, 55, 43, 44,
01180 45, 46, 32, 33, 34, 37, 38, 39, 8, 9,
01181 61, 18, 56, 62, 5, 7, 5, 59, 46, 3,
01182 8, 58, 5, 110, 58, 58, 5, 58, 5, 58,
01183 57, 5, 5, 126, 126, 124, 99
01184 };
01185
01186
01187
01188 static const yytype_uint8 yystos[] =
01189 {
01190 0, 64, 0, 1, 9, 10, 11, 12, 13, 17,
01191 19, 21, 23, 24, 25, 26, 27, 28, 30, 31,
01192 35, 36, 40, 41, 42, 47, 50, 65, 66, 68,
01193 69, 72, 78, 81, 82, 84, 86, 89, 90, 91,
01194 92, 95, 97, 98, 99, 100, 101, 102, 103, 104,
01195 108, 14, 15, 16, 70, 106, 107, 5, 5, 71,
01196 106, 106, 3, 6, 18, 96, 5, 5, 5, 5,
01197 61, 105, 105, 18, 32, 33, 34, 83, 43, 44,
01198 45, 46, 85, 37, 38, 39, 87, 3, 4, 88,
01199 88, 88, 48, 49, 109, 56, 73, 74, 3, 62,
01200 3, 4, 77, 4, 5, 18, 20, 94, 5, 7,
01201 105, 59, 46, 5, 67, 51, 52, 53, 54, 55,
01202 76, 67, 107, 67, 8, 105, 79, 3, 58, 58,
01203 58, 58, 58, 57, 75, 93, 94, 60, 66, 69,
01204 80, 5, 5, 5, 5, 5
01205 };
01206
01207 #define yyerrok (yyerrstatus = 0)
01208 #define yyclearin (yychar = YYEMPTY)
01209 #define YYEMPTY (-2)
01210 #define YYEOF 0
01211
01212 #define YYACCEPT goto yyacceptlab
01213 #define YYABORT goto yyabortlab
01214 #define YYERROR goto yyerrorlab
01215
01216
01217
01218
01219
01220
01221 #define YYFAIL goto yyerrlab
01222
01223 #define YYRECOVERING() (!!yyerrstatus)
01224
01225 #define YYBACKUP(Token, Value) \
01226 do \
01227 if (yychar == YYEMPTY && yylen == 1) \
01228 { \
01229 yychar = (Token); \
01230 yylval = (Value); \
01231 yytoken = YYTRANSLATE (yychar); \
01232 YYPOPSTACK (1); \
01233 goto yybackup; \
01234 } \
01235 else \
01236 { \
01237 yyerror (YY_("syntax error: cannot back up")); \
01238 YYERROR; \
01239 } \
01240 while (YYID (0))
01241
01242
01243 #define YYTERROR 1
01244 #define YYERRCODE 256
01245
01246
01247
01248
01249
01250
01251 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
01252 #ifndef YYLLOC_DEFAULT
01253 # define YYLLOC_DEFAULT(Current, Rhs, N) \
01254 do \
01255 if (YYID (N)) \
01256 { \
01257 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
01258 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
01259 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
01260 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
01261 } \
01262 else \
01263 { \
01264 (Current).first_line = (Current).last_line = \
01265 YYRHSLOC (Rhs, 0).last_line; \
01266 (Current).first_column = (Current).last_column = \
01267 YYRHSLOC (Rhs, 0).last_column; \
01268 } \
01269 while (YYID (0))
01270 #endif
01271
01272
01273
01274
01275
01276
01277 #ifndef YY_LOCATION_PRINT
01278 # if YYLTYPE_IS_TRIVIAL
01279 # define YY_LOCATION_PRINT(File, Loc) \
01280 fprintf (File, "%d.%d-%d.%d", \
01281 (Loc).first_line, (Loc).first_column, \
01282 (Loc).last_line, (Loc).last_column)
01283 # else
01284 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
01285 # endif
01286 #endif
01287
01288
01289
01290
01291 #ifdef YYLEX_PARAM
01292 # define YYLEX yylex (YYLEX_PARAM)
01293 #else
01294 # define YYLEX yylex (context)
01295 #endif
01296
01297
01298 #if YYDEBUG
01299
01300 # ifndef YYFPRINTF
01301 # include <stdio.h>
01302 # define YYFPRINTF fprintf
01303 # endif
01304
01305 # define YYDPRINTF(Args) \
01306 do { \
01307 if (yydebug) \
01308 YYFPRINTF Args; \
01309 } while (YYID (0))
01310
01311 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
01312 do { \
01313 if (yydebug) \
01314 { \
01315 YYFPRINTF (stderr, "%s ", Title); \
01316 yy_symbol_print (stderr, \
01317 Type, Value); \
01318 YYFPRINTF (stderr, "\n"); \
01319 } \
01320 } while (YYID (0))
01321
01322
01323
01324
01325
01326
01327
01328 #if (defined __STDC__ || defined __C99__FUNC__ \
01329 || defined __cplusplus || defined _MSC_VER)
01330 static void
01331 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
01332 #else
01333 static void
01334 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
01335 FILE *yyoutput;
01336 int yytype;
01337 YYSTYPE const * const yyvaluep;
01338 #endif
01339 {
01340 if (!yyvaluep)
01341 return;
01342 # ifdef YYPRINT
01343 if (yytype < YYNTOKENS)
01344 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
01345 # else
01346 YYUSE (yyoutput);
01347 # endif
01348 switch (yytype)
01349 {
01350 default:
01351 break;
01352 }
01353 }
01354
01355
01356
01357
01358
01359
01360 #if (defined __STDC__ || defined __C99__FUNC__ \
01361 || defined __cplusplus || defined _MSC_VER)
01362 static void
01363 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
01364 #else
01365 static void
01366 yy_symbol_print (yyoutput, yytype, yyvaluep)
01367 FILE *yyoutput;
01368 int yytype;
01369 YYSTYPE const * const yyvaluep;
01370 #endif
01371 {
01372 if (yytype < YYNTOKENS)
01373 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
01374 else
01375 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
01376
01377 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
01378 YYFPRINTF (yyoutput, ")");
01379 }
01380
01381
01382
01383
01384
01385
01386 #if (defined __STDC__ || defined __C99__FUNC__ \
01387 || defined __cplusplus || defined _MSC_VER)
01388 static void
01389 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
01390 #else
01391 static void
01392 yy_stack_print (yybottom, yytop)
01393 yytype_int16 *yybottom;
01394 yytype_int16 *yytop;
01395 #endif
01396 {
01397 YYFPRINTF (stderr, "Stack now");
01398 for (; yybottom <= yytop; yybottom++)
01399 {
01400 int yybot = *yybottom;
01401 YYFPRINTF (stderr, " %d", yybot);
01402 }
01403 YYFPRINTF (stderr, "\n");
01404 }
01405
01406 # define YY_STACK_PRINT(Bottom, Top) \
01407 do { \
01408 if (yydebug) \
01409 yy_stack_print ((Bottom), (Top)); \
01410 } while (YYID (0))
01411
01412
01413
01414
01415
01416
01417 #if (defined __STDC__ || defined __C99__FUNC__ \
01418 || defined __cplusplus || defined _MSC_VER)
01419 static void
01420 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
01421 #else
01422 static void
01423 yy_reduce_print (yyvsp, yyrule)
01424 YYSTYPE *yyvsp;
01425 int yyrule;
01426 #endif
01427 {
01428 int yynrhs = yyr2[yyrule];
01429 int yyi;
01430 unsigned long int yylno = yyrline[yyrule];
01431 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
01432 yyrule - 1, yylno);
01433
01434 for (yyi = 0; yyi < yynrhs; yyi++)
01435 {
01436 YYFPRINTF (stderr, " $%d = ", yyi + 1);
01437 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
01438 &(yyvsp[(yyi + 1) - (yynrhs)])
01439 );
01440 YYFPRINTF (stderr, "\n");
01441 }
01442 }
01443
01444 # define YY_REDUCE_PRINT(Rule) \
01445 do { \
01446 if (yydebug) \
01447 yy_reduce_print (yyvsp, Rule); \
01448 } while (YYID (0))
01449
01450
01451
01452 int yydebug;
01453 #else
01454 # define YYDPRINTF(Args)
01455 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01456 # define YY_STACK_PRINT(Bottom, Top)
01457 # define YY_REDUCE_PRINT(Rule)
01458 #endif
01459
01460
01461
01462 #ifndef YYINITDEPTH
01463 # define YYINITDEPTH 200
01464 #endif
01465
01466
01467
01468
01469
01470
01471
01472
01473 #ifndef YYMAXDEPTH
01474 # define YYMAXDEPTH 10000
01475 #endif
01476
01477
01478
01479 #if YYERROR_VERBOSE
01480
01481 # ifndef yystrlen
01482 # if defined __GLIBC__ && defined _STRING_H
01483 # define yystrlen strlen
01484 # else
01485
01486 #if (defined __STDC__ || defined __C99__FUNC__ \
01487 || defined __cplusplus || defined _MSC_VER)
01488 static YYSIZE_T
01489 yystrlen (const char *yystr)
01490 #else
01491 static YYSIZE_T
01492 yystrlen (yystr)
01493 const char *yystr;
01494 #endif
01495 {
01496 YYSIZE_T yylen;
01497 for (yylen = 0; yystr[yylen]; yylen++)
01498 continue;
01499 return yylen;
01500 }
01501 # endif
01502 # endif
01503
01504 # ifndef yystpcpy
01505 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01506 # define yystpcpy stpcpy
01507 # else
01508
01509
01510 #if (defined __STDC__ || defined __C99__FUNC__ \
01511 || defined __cplusplus || defined _MSC_VER)
01512 static char *
01513 yystpcpy (char *yydest, const char *yysrc)
01514 #else
01515 static char *
01516 yystpcpy (yydest, yysrc)
01517 char *yydest;
01518 const char *yysrc;
01519 #endif
01520 {
01521 char *yyd = yydest;
01522 const char *yys = yysrc;
01523
01524 while ((*yyd++ = *yys++) != '\0')
01525 continue;
01526
01527 return yyd - 1;
01528 }
01529 # endif
01530 # endif
01531
01532 # ifndef yytnamerr
01533
01534
01535
01536
01537
01538
01539
01540 static YYSIZE_T
01541 yytnamerr (char *yyres, const char *yystr)
01542 {
01543 if (*yystr == '"')
01544 {
01545 YYSIZE_T yyn = 0;
01546 char const *yyp = yystr;
01547
01548 for (;;)
01549 switch (*++yyp)
01550 {
01551 case '\'':
01552 case ',':
01553 goto do_not_strip_quotes;
01554
01555 case '\\':
01556 if (*++yyp != '\\')
01557 goto do_not_strip_quotes;
01558
01559 default:
01560 if (yyres)
01561 yyres[yyn] = *yyp;
01562 yyn++;
01563 break;
01564
01565 case '"':
01566 if (yyres)
01567 yyres[yyn] = '\0';
01568 return yyn;
01569 }
01570 do_not_strip_quotes: ;
01571 }
01572
01573 if (! yyres)
01574 return yystrlen (yystr);
01575
01576 return yystpcpy (yyres, yystr) - yyres;
01577 }
01578 # endif
01579
01580
01581
01582
01583
01584
01585
01586
01587 static YYSIZE_T
01588 yysyntax_error (char *yyresult, int yystate, int yychar)
01589 {
01590 int yyn = yypact[yystate];
01591
01592 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
01593 return 0;
01594 else
01595 {
01596 int yytype = YYTRANSLATE (yychar);
01597 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01598 YYSIZE_T yysize = yysize0;
01599 YYSIZE_T yysize1;
01600 int yysize_overflow = 0;
01601 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01602 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01603 int yyx;
01604
01605 # if 0
01606
01607
01608 YY_("syntax error, unexpected %s");
01609 YY_("syntax error, unexpected %s, expecting %s");
01610 YY_("syntax error, unexpected %s, expecting %s or %s");
01611 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01612 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01613 # endif
01614 char *yyfmt;
01615 char const *yyf;
01616 static char const yyunexpected[] = "syntax error, unexpected %s";
01617 static char const yyexpecting[] = ", expecting %s";
01618 static char const yyor[] = " or %s";
01619 char yyformat[sizeof yyunexpected
01620 + sizeof yyexpecting - 1
01621 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01622 * (sizeof yyor - 1))];
01623 char const *yyprefix = yyexpecting;
01624
01625
01626
01627 int yyxbegin = yyn < 0 ? -yyn : 0;
01628
01629
01630 int yychecklim = YYLAST - yyn + 1;
01631 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01632 int yycount = 1;
01633
01634 yyarg[0] = yytname[yytype];
01635 yyfmt = yystpcpy (yyformat, yyunexpected);
01636
01637 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01638 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01639 {
01640 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01641 {
01642 yycount = 1;
01643 yysize = yysize0;
01644 yyformat[sizeof yyunexpected - 1] = '\0';
01645 break;
01646 }
01647 yyarg[yycount++] = yytname[yyx];
01648 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01649 yysize_overflow |= (yysize1 < yysize);
01650 yysize = yysize1;
01651 yyfmt = yystpcpy (yyfmt, yyprefix);
01652 yyprefix = yyor;
01653 }
01654
01655 yyf = YY_(yyformat);
01656 yysize1 = yysize + yystrlen (yyf);
01657 yysize_overflow |= (yysize1 < yysize);
01658 yysize = yysize1;
01659
01660 if (yysize_overflow)
01661 return YYSIZE_MAXIMUM;
01662
01663 if (yyresult)
01664 {
01665
01666
01667
01668 char *yyp = yyresult;
01669 int yyi = 0;
01670 while ((*yyp = *yyf) != '\0')
01671 {
01672 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01673 {
01674 yyp += yytnamerr (yyp, yyarg[yyi++]);
01675 yyf += 2;
01676 }
01677 else
01678 {
01679 yyp++;
01680 yyf++;
01681 }
01682 }
01683 }
01684 return yysize;
01685 }
01686 }
01687 #endif
01688
01689
01690
01691
01692
01693
01694
01695 #if (defined __STDC__ || defined __C99__FUNC__ \
01696 || defined __cplusplus || defined _MSC_VER)
01697 static void
01698 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
01699 #else
01700 static void
01701 yydestruct (yymsg, yytype, yyvaluep)
01702 const char *yymsg;
01703 int yytype;
01704 YYSTYPE *yyvaluep;
01705 #endif
01706 {
01707 YYUSE (yyvaluep);
01708
01709 if (!yymsg)
01710 yymsg = "Deleting";
01711 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01712
01713 switch (yytype)
01714 {
01715
01716 default:
01717 break;
01718 }
01719 }
01720
01721
01722 #ifdef YYPARSE_PARAM
01723 #if defined __STDC__ || defined __cplusplus
01724 int yyparse (void *YYPARSE_PARAM);
01725 #else
01726 int yyparse ();
01727 #endif
01728 #else
01729 #if defined __STDC__ || defined __cplusplus
01730 int yyparse (void);
01731 #else
01732 int yyparse ();
01733 #endif
01734 #endif
01735
01736
01737
01738 int yychar;
01739
01740
01741 YYSTYPE yylval;
01742
01743
01744 int yynerrs;
01745
01746
01747
01748
01749
01750
01751
01752 #ifdef YYPARSE_PARAM
01753 #if (defined __STDC__ || defined __C99__FUNC__ \
01754 || defined __cplusplus || defined _MSC_VER)
01755 int
01756 yyparse (void *YYPARSE_PARAM)
01757 #else
01758 int
01759 yyparse (YYPARSE_PARAM)
01760 void *YYPARSE_PARAM;
01761 #endif
01762 #else
01763 #if (defined __STDC__ || defined __C99__FUNC__ \
01764 || defined __cplusplus || defined _MSC_VER)
01765 int
01766 yyparse (void)
01767 #else
01768 int
01769 yyparse ()
01770
01771 #endif
01772 #endif
01773 {
01774
01775
01776 int yystate;
01777
01778 int yyerrstatus;
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788 yytype_int16 yyssa[YYINITDEPTH];
01789 yytype_int16 *yyss;
01790 yytype_int16 *yyssp;
01791
01792
01793 YYSTYPE yyvsa[YYINITDEPTH];
01794 YYSTYPE *yyvs;
01795 YYSTYPE *yyvsp;
01796
01797 YYSIZE_T yystacksize;
01798
01799 int yyn;
01800 int yyresult;
01801
01802 int yytoken;
01803
01804
01805 YYSTYPE yyval;
01806
01807 #if YYERROR_VERBOSE
01808
01809 char yymsgbuf[128];
01810 char *yymsg = yymsgbuf;
01811 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01812 #endif
01813
01814 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
01815
01816
01817
01818 int yylen = 0;
01819
01820 yytoken = 0;
01821 yyss = yyssa;
01822 yyvs = yyvsa;
01823 yystacksize = YYINITDEPTH;
01824
01825 YYDPRINTF ((stderr, "Starting parse\n"));
01826
01827 yystate = 0;
01828 yyerrstatus = 0;
01829 yynerrs = 0;
01830 yychar = YYEMPTY;
01831
01832
01833
01834
01835
01836 yyssp = yyss;
01837 yyvsp = yyvs;
01838
01839 goto yysetstate;
01840
01841
01842
01843
01844 yynewstate:
01845
01846
01847 yyssp++;
01848
01849 yysetstate:
01850 *yyssp = yystate;
01851
01852 if (yyss + yystacksize - 1 <= yyssp)
01853 {
01854
01855 YYSIZE_T yysize = yyssp - yyss + 1;
01856
01857 #ifdef yyoverflow
01858 {
01859
01860
01861
01862 YYSTYPE *yyvs1 = yyvs;
01863 yytype_int16 *yyss1 = yyss;
01864
01865
01866
01867
01868
01869 yyoverflow (YY_("memory exhausted"),
01870 &yyss1, yysize * sizeof (*yyssp),
01871 &yyvs1, yysize * sizeof (*yyvsp),
01872 &yystacksize);
01873
01874 yyss = yyss1;
01875 yyvs = yyvs1;
01876 }
01877 #else
01878 # ifndef YYSTACK_RELOCATE
01879 goto yyexhaustedlab;
01880 # else
01881
01882 if (YYMAXDEPTH <= yystacksize)
01883 goto yyexhaustedlab;
01884 yystacksize *= 2;
01885 if (YYMAXDEPTH < yystacksize)
01886 yystacksize = YYMAXDEPTH;
01887
01888 {
01889 yytype_int16 *yyss1 = yyss;
01890 union yyalloc *yyptr =
01891 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01892 if (! yyptr)
01893 goto yyexhaustedlab;
01894 YYSTACK_RELOCATE (yyss_alloc, yyss);
01895 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
01896 # undef YYSTACK_RELOCATE
01897 if (yyss1 != yyssa)
01898 YYSTACK_FREE (yyss1);
01899 }
01900 # endif
01901 #endif
01902
01903 yyssp = yyss + yysize - 1;
01904 yyvsp = yyvs + yysize - 1;
01905
01906 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01907 (unsigned long int) yystacksize));
01908
01909 if (yyss + yystacksize - 1 <= yyssp)
01910 YYABORT;
01911 }
01912
01913 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01914
01915 if (yystate == YYFINAL)
01916 YYACCEPT;
01917
01918 goto yybackup;
01919
01920
01921
01922
01923 yybackup:
01924
01925
01926
01927
01928
01929 yyn = yypact[yystate];
01930 if (yyn == YYPACT_NINF)
01931 goto yydefault;
01932
01933
01934
01935
01936 if (yychar == YYEMPTY)
01937 {
01938 YYDPRINTF ((stderr, "Reading a token: "));
01939 yychar = YYLEX;
01940 }
01941
01942 if (yychar <= YYEOF)
01943 {
01944 yychar = yytoken = YYEOF;
01945 YYDPRINTF ((stderr, "Now at end of input.\n"));
01946 }
01947 else
01948 {
01949 yytoken = YYTRANSLATE (yychar);
01950 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01951 }
01952
01953
01954
01955 yyn += yytoken;
01956 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01957 goto yydefault;
01958 yyn = yytable[yyn];
01959 if (yyn <= 0)
01960 {
01961 if (yyn == 0 || yyn == YYTABLE_NINF)
01962 goto yyerrlab;
01963 yyn = -yyn;
01964 goto yyreduce;
01965 }
01966
01967
01968
01969 if (yyerrstatus)
01970 yyerrstatus--;
01971
01972
01973 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01974
01975
01976 yychar = YYEMPTY;
01977
01978 yystate = yyn;
01979 *++yyvsp = yylval;
01980
01981 goto yynewstate;
01982
01983
01984
01985
01986
01987 yydefault:
01988 yyn = yydefact[yystate];
01989 if (yyn == 0)
01990 goto yyerrlab;
01991 goto yyreduce;
01992
01993
01994
01995
01996
01997 yyreduce:
01998
01999 yylen = yyr2[yyn];
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009 yyval = yyvsp[1-yylen];
02010
02011
02012 YY_REDUCE_PRINT (yyn);
02013 switch (yyn)
02014 {
02015 case 29:
02016
02017
02018 #line 615 "src/cfgparse.y"
02019 {
02020 TAILQ_INSERT_TAIL(bindings, (yyvsp[(1) - (1)].binding), bindings);
02021 ;}
02022 break;
02023
02024 case 30:
02025
02026
02027 #line 621 "src/cfgparse.y"
02028 { (yyval.binding) = (yyvsp[(2) - (2)].binding); ;}
02029 break;
02030
02031 case 31:
02032
02033
02034 #line 622 "src/cfgparse.y"
02035 { (yyval.binding) = (yyvsp[(2) - (2)].binding); ;}
02036 break;
02037
02038 case 32:
02039
02040
02041 #line 627 "src/cfgparse.y"
02042 {
02043 printf("\tFound keycode binding mod%d with key %d and command %s\n", (yyvsp[(1) - (3)].number), (yyvsp[(2) - (3)].number), (yyvsp[(3) - (3)].string));
02044 Binding *new = scalloc(sizeof(Binding));
02045
02046 new->keycode = (yyvsp[(2) - (3)].number);
02047 new->mods = (yyvsp[(1) - (3)].number);
02048 new->command = (yyvsp[(3) - (3)].string);
02049
02050 (yyval.binding) = new;
02051 ;}
02052 break;
02053
02054 case 33:
02055
02056
02057 #line 641 "src/cfgparse.y"
02058 {
02059 printf("\tFound keysym binding mod%d with key %s and command %s\n", (yyvsp[(1) - (3)].number), (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].string));
02060 Binding *new = scalloc(sizeof(Binding));
02061
02062 new->symbol = (yyvsp[(2) - (3)].string);
02063 new->mods = (yyvsp[(1) - (3)].number);
02064 new->command = (yyvsp[(3) - (3)].string);
02065
02066 (yyval.binding) = new;
02067 ;}
02068 break;
02069
02070 case 34:
02071
02072
02073 #line 655 "src/cfgparse.y"
02074 {
02075 printf("\t should execute command %s for the criteria mentioned above\n", (yyvsp[(3) - (3)].string));
02076 Assignment *assignment = scalloc(sizeof(Assignment));
02077 assignment->type = A_COMMAND;
02078 assignment->match = current_match;
02079 assignment->dest.command = (yyvsp[(3) - (3)].string);
02080 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
02081 ;}
02082 break;
02083
02084 case 36:
02085
02086
02087 #line 667 "src/cfgparse.y"
02088 {
02089 printf("match parsed\n");
02090 ;}
02091 break;
02092
02093 case 37:
02094
02095
02096 #line 674 "src/cfgparse.y"
02097 {
02098 printf("start\n");
02099 match_init(¤t_match);
02100 ;}
02101 break;
02102
02103 case 38:
02104
02105
02106 #line 682 "src/cfgparse.y"
02107 {
02108 printf("match specification finished\n");
02109 ;}
02110 break;
02111
02112 case 39:
02113
02114
02115 #line 689 "src/cfgparse.y"
02116 {
02117 printf("criteria: class = %s\n", (yyvsp[(3) - (3)].string));
02118 current_match.class = (yyvsp[(3) - (3)].string);
02119 ;}
02120 break;
02121
02122 case 40:
02123
02124
02125 #line 694 "src/cfgparse.y"
02126 {
02127 printf("criteria: id = %s\n", (yyvsp[(3) - (3)].string));
02128 char *end;
02129 long parsed = strtol((yyvsp[(3) - (3)].string), &end, 10);
02130 if (parsed == LONG_MIN ||
02131 parsed == LONG_MAX ||
02132 parsed < 0 ||
02133 (end && *end != '\0')) {
02134 ELOG("Could not parse con id \"%s\"\n", (yyvsp[(3) - (3)].string));
02135 } else {
02136 current_match.con_id = (Con*)parsed;
02137 printf("id as int = %p\n", current_match.con_id);
02138 }
02139 ;}
02140 break;
02141
02142 case 41:
02143
02144
02145 #line 709 "src/cfgparse.y"
02146 {
02147 printf("criteria: window id = %s\n", (yyvsp[(3) - (3)].string));
02148 char *end;
02149 long parsed = strtol((yyvsp[(3) - (3)].string), &end, 10);
02150 if (parsed == LONG_MIN ||
02151 parsed == LONG_MAX ||
02152 parsed < 0 ||
02153 (end && *end != '\0')) {
02154 ELOG("Could not parse window id \"%s\"\n", (yyvsp[(3) - (3)].string));
02155 } else {
02156 current_match.id = parsed;
02157 printf("window id as int = %d\n", current_match.id);
02158 }
02159 ;}
02160 break;
02161
02162 case 42:
02163
02164
02165 #line 724 "src/cfgparse.y"
02166 {
02167 printf("criteria: mark = %s\n", (yyvsp[(3) - (3)].string));
02168 current_match.mark = (yyvsp[(3) - (3)].string);
02169 ;}
02170 break;
02171
02172 case 43:
02173
02174
02175 #line 729 "src/cfgparse.y"
02176 {
02177 printf("criteria: title = %s\n", (yyvsp[(3) - (3)].string));
02178 current_match.title = (yyvsp[(3) - (3)].string);
02179 ;}
02180 break;
02181
02182 case 45:
02183
02184
02185 #line 740 "src/cfgparse.y"
02186 {
02187 asprintf(&(yyval.string), "%d", (yyvsp[(1) - (1)].number));
02188 ;}
02189 break;
02190
02191 case 46:
02192
02193
02194 #line 747 "src/cfgparse.y"
02195 {
02196 if (strcasecmp((yyvsp[(2) - (5)].string), "default") == 0) {
02197 printf("You cannot use the name \"default\" for your mode\n");
02198 exit(1);
02199 }
02200 printf("\t now in mode %s\n", (yyvsp[(2) - (5)].string));
02201 printf("\t current bindings = %p\n", current_bindings);
02202 Binding *binding;
02203 TAILQ_FOREACH(binding, current_bindings, bindings) {
02204 printf("got binding on mods %d, keycode %d, symbol %s, command %s\n",
02205 binding->mods, binding->keycode, binding->symbol, binding->command);
02206 }
02207
02208 struct Mode *mode = scalloc(sizeof(struct Mode));
02209 mode->name = (yyvsp[(2) - (5)].string);
02210 mode->bindings = current_bindings;
02211 current_bindings = NULL;
02212 SLIST_INSERT_HEAD(&modes, mode, modes);
02213 ;}
02214 break;
02215
02216 case 50:
02217
02218
02219 #line 777 "src/cfgparse.y"
02220 {
02221 if (current_bindings == NULL) {
02222 current_bindings = scalloc(sizeof(struct bindings_head));
02223 TAILQ_INIT(current_bindings);
02224 }
02225
02226 TAILQ_INSERT_TAIL(current_bindings, (yyvsp[(1) - (1)].binding), bindings);
02227 ;}
02228 break;
02229
02230 case 51:
02231
02232
02233 #line 789 "src/cfgparse.y"
02234 {
02235 DLOG("floating modifier = %d\n", (yyvsp[(2) - (2)].number));
02236 config.floating_modifier = (yyvsp[(2) - (2)].number);
02237 ;}
02238 break;
02239
02240 case 52:
02241
02242
02243 #line 797 "src/cfgparse.y"
02244 {
02245 DLOG("New containers should start with split direction %d\n", (yyvsp[(2) - (2)].number));
02246 config.default_orientation = (yyvsp[(2) - (2)].number);
02247 ;}
02248 break;
02249
02250 case 53:
02251
02252
02253 #line 804 "src/cfgparse.y"
02254 { (yyval.number) = HORIZ; ;}
02255 break;
02256
02257 case 54:
02258
02259
02260 #line 805 "src/cfgparse.y"
02261 { (yyval.number) = VERT; ;}
02262 break;
02263
02264 case 55:
02265
02266
02267 #line 806 "src/cfgparse.y"
02268 { (yyval.number) = NO_ORIENTATION; ;}
02269 break;
02270
02271 case 56:
02272
02273
02274 #line 811 "src/cfgparse.y"
02275 {
02276 DLOG("new containers will be in mode %d\n", (yyvsp[(2) - (2)].number));
02277 config.default_layout = (yyvsp[(2) - (2)].number);
02278
02279 #if 0
02280
02281
02282
02283
02284
02285
02286
02287
02288 Workspace *ws;
02289 TAILQ_FOREACH(ws, workspaces, workspaces) {
02290 if (ws->table == NULL)
02291 continue;
02292 switch_layout_mode(global_conn,
02293 ws->table[0][0],
02294 config.container_mode);
02295 }
02296 #endif
02297 ;}
02298 break;
02299
02300 case 57:
02301
02302
02303 #line 835 "src/cfgparse.y"
02304 {
02305 DLOG("stack-limit %d with val %d\n", (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].number));
02306 config.container_stack_limit = (yyvsp[(3) - (4)].number);
02307 config.container_stack_limit_value = (yyvsp[(4) - (4)].number);
02308
02309 #if 0
02310
02311 Workspace *ws;
02312 TAILQ_FOREACH(ws, workspaces, workspaces) {
02313 if (ws->table == NULL)
02314 continue;
02315 Container *con = ws->table[0][0];
02316 con->stack_limit = config.container_stack_limit;
02317 con->stack_limit_value = config.container_stack_limit_value;
02318 }
02319 #endif
02320 ;}
02321 break;
02322
02323 case 58:
02324
02325
02326 #line 855 "src/cfgparse.y"
02327 { (yyval.number) = L_DEFAULT; ;}
02328 break;
02329
02330 case 59:
02331
02332
02333 #line 856 "src/cfgparse.y"
02334 { (yyval.number) = L_STACKED; ;}
02335 break;
02336
02337 case 60:
02338
02339
02340 #line 857 "src/cfgparse.y"
02341 { (yyval.number) = L_TABBED; ;}
02342 break;
02343
02344 case 61:
02345
02346
02347 #line 862 "src/cfgparse.y"
02348 {
02349 DLOG("new windows should start with border style %d\n", (yyvsp[(2) - (2)].number));
02350 config.default_border = (yyvsp[(2) - (2)].number);
02351 ;}
02352 break;
02353
02354 case 62:
02355
02356
02357 #line 869 "src/cfgparse.y"
02358 { (yyval.number) = BS_NORMAL; ;}
02359 break;
02360
02361 case 63:
02362
02363
02364 #line 870 "src/cfgparse.y"
02365 { (yyval.number) = BS_NONE; ;}
02366 break;
02367
02368 case 64:
02369
02370
02371 #line 871 "src/cfgparse.y"
02372 { (yyval.number) = BS_1PIXEL; ;}
02373 break;
02374
02375 case 65:
02376
02377
02378 #line 876 "src/cfgparse.y"
02379 {
02380 (yyval.number) = ((yyvsp[(1) - (1)].number) == 1);
02381 ;}
02382 break;
02383
02384 case 66:
02385
02386
02387 #line 880 "src/cfgparse.y"
02388 {
02389 DLOG("checking word \"%s\"\n", (yyvsp[(1) - (1)].string));
02390 (yyval.number) = (strcasecmp((yyvsp[(1) - (1)].string), "yes") == 0 ||
02391 strcasecmp((yyvsp[(1) - (1)].string), "true") == 0 ||
02392 strcasecmp((yyvsp[(1) - (1)].string), "on") == 0 ||
02393 strcasecmp((yyvsp[(1) - (1)].string), "enable") == 0 ||
02394 strcasecmp((yyvsp[(1) - (1)].string), "active") == 0);
02395 ;}
02396 break;
02397
02398 case 67:
02399
02400
02401 #line 892 "src/cfgparse.y"
02402 {
02403 DLOG("focus follows mouse = %d\n", (yyvsp[(2) - (2)].number));
02404 config.disable_focus_follows_mouse = !((yyvsp[(2) - (2)].number));
02405 ;}
02406 break;
02407
02408 case 68:
02409
02410
02411 #line 900 "src/cfgparse.y"
02412 {
02413 DLOG("force focus wrapping = %d\n", (yyvsp[(2) - (2)].number));
02414 config.force_focus_wrapping = (yyvsp[(2) - (2)].number);
02415 ;}
02416 break;
02417
02418 case 69:
02419
02420
02421 #line 908 "src/cfgparse.y"
02422 {
02423 DLOG("workspace bar = %d\n", (yyvsp[(2) - (2)].number));
02424 config.disable_workspace_bar = !((yyvsp[(2) - (2)].number));
02425 ;}
02426 break;
02427
02428 case 70:
02429
02430
02431 #line 916 "src/cfgparse.y"
02432 {
02433 int ws_num = (yyvsp[(2) - (5)].number);
02434 if (ws_num < 1) {
02435 DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
02436 } else {
02437 char *ws_name = NULL;
02438 if ((yyvsp[(5) - (5)].string) == NULL) {
02439 asprintf(&ws_name, "%d", ws_num);
02440 } else {
02441 ws_name = (yyvsp[(5) - (5)].string);
02442 }
02443
02444 DLOG("Should assign workspace %s to output %s\n", ws_name, (yyvsp[(4) - (5)].string));
02445 struct Workspace_Assignment *assignment = scalloc(sizeof(struct Workspace_Assignment));
02446 assignment->name = ws_name;
02447 assignment->output = (yyvsp[(4) - (5)].string);
02448 TAILQ_INSERT_TAIL(&ws_assignments, assignment, ws_assignments);
02449 }
02450 ;}
02451 break;
02452
02453 case 71:
02454
02455
02456 #line 936 "src/cfgparse.y"
02457 {
02458 int ws_num = (yyvsp[(2) - (3)].number);
02459 if (ws_num < 1) {
02460 DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
02461 } else {
02462 DLOG("workspace name to: %s\n", (yyvsp[(3) - (3)].string));
02463 #if 0
02464 if ((yyvsp[(3) - (3)].string) != NULL) {
02465 workspace_set_name(workspace_get(ws_num - 1), (yyvsp[(3) - (3)].string));
02466 free((yyvsp[(3) - (3)].string));
02467 }
02468 #endif
02469 }
02470 ;}
02471 break;
02472
02473 case 72:
02474
02475
02476 #line 953 "src/cfgparse.y"
02477 { (yyval.string) = NULL; ;}
02478 break;
02479
02480 case 73:
02481
02482
02483 #line 954 "src/cfgparse.y"
02484 { (yyval.string) = (yyvsp[(1) - (1)].string); ;}
02485 break;
02486
02487 case 74:
02488
02489
02490 #line 958 "src/cfgparse.y"
02491 { (yyval.string) = (yyvsp[(1) - (1)].string); ;}
02492 break;
02493
02494 case 75:
02495
02496
02497 #line 959 "src/cfgparse.y"
02498 { (yyval.string) = (yyvsp[(1) - (1)].string); ;}
02499 break;
02500
02501 case 76:
02502
02503
02504 #line 960 "src/cfgparse.y"
02505 { (yyval.string) = (yyvsp[(1) - (1)].string); ;}
02506 break;
02507
02508 case 77:
02509
02510
02511 #line 965 "src/cfgparse.y"
02512 {
02513 printf("assignment of %s to *%s*\n", (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].string));
02514 char *workspace = (yyvsp[(3) - (3)].string);
02515 char *criteria = (yyvsp[(2) - (3)].string);
02516
02517 Assignment *assignment = scalloc(sizeof(Assignment));
02518 Match *match = &(assignment->match);
02519 match_init(match);
02520
02521 char *separator = NULL;
02522 if ((separator = strchr(criteria, '/')) != NULL) {
02523 *(separator++) = '\0';
02524 match->title = sstrdup(separator);
02525 }
02526 if (*criteria != '\0')
02527 match->class = sstrdup(criteria);
02528 free(criteria);
02529
02530 printf(" class = %s\n", match->class);
02531 printf(" title = %s\n", match->title);
02532
02533
02534
02535
02536
02537
02538 if (*workspace == '~') {
02539 workspace++;
02540 if (*workspace == '\0') {
02541
02542 assignment->type = A_COMMAND;
02543 assignment->dest.command = sstrdup("floating enable");
02544 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
02545 break;
02546 } else {
02547
02548 Assignment *floating = scalloc(sizeof(Assignment));
02549 match_copy(&(floating->match), match);
02550 floating->type = A_COMMAND;
02551 floating->dest.command = sstrdup("floating enable");
02552 TAILQ_INSERT_TAIL(&assignments, floating, assignments);
02553 }
02554 }
02555
02556 assignment->type = A_TO_WORKSPACE;
02557 assignment->dest.workspace = workspace;
02558 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
02559 ;}
02560 break;
02561
02562 case 80:
02563
02564
02565 #line 1022 "src/cfgparse.y"
02566 {
02567 config.ipc_socket_path = (yyvsp[(2) - (2)].string);
02568 ;}
02569 break;
02570
02571 case 81:
02572
02573
02574 #line 1029 "src/cfgparse.y"
02575 {
02576 config.restart_state_path = (yyvsp[(2) - (2)].string);
02577 ;}
02578 break;
02579
02580 case 82:
02581
02582
02583 #line 1036 "src/cfgparse.y"
02584 {
02585 struct Autostart *new = smalloc(sizeof(struct Autostart));
02586 new->command = (yyvsp[(2) - (2)].string);
02587 TAILQ_INSERT_TAIL(&autostarts, new, autostarts);
02588 ;}
02589 break;
02590
02591 case 83:
02592
02593
02594 #line 1045 "src/cfgparse.y"
02595 {
02596 struct Autostart *new = smalloc(sizeof(struct Autostart));
02597 new->command = (yyvsp[(2) - (2)].string);
02598 TAILQ_INSERT_TAIL(&autostarts_always, new, autostarts_always);
02599 ;}
02600 break;
02601
02602 case 84:
02603
02604
02605 #line 1054 "src/cfgparse.y"
02606 {
02607 ELOG("The terminal option is DEPRECATED and has no effect. "
02608 "Please remove it from your configuration file.\n");
02609 ;}
02610 break;
02611
02612 case 85:
02613
02614
02615 #line 1062 "src/cfgparse.y"
02616 {
02617 config.font = load_font((yyvsp[(2) - (2)].string), true);
02618 printf("font %s\n", (yyvsp[(2) - (2)].string));
02619 free((yyvsp[(2) - (2)].string));
02620 ;}
02621 break;
02622
02623 case 86:
02624
02625
02626 #line 1071 "src/cfgparse.y"
02627 {
02628 uint32_t *dest = (yyvsp[(1) - (2)].single_color);
02629 *dest = (yyvsp[(2) - (2)].number);
02630 ;}
02631 break;
02632
02633 case 87:
02634
02635
02636 #line 1079 "src/cfgparse.y"
02637 {
02638 struct Colortriple *dest = (yyvsp[(1) - (4)].color);
02639
02640 dest->border = (yyvsp[(2) - (4)].number);
02641 dest->background = (yyvsp[(3) - (4)].number);
02642 dest->text = (yyvsp[(4) - (4)].number);
02643 ;}
02644 break;
02645
02646 case 88:
02647
02648
02649 #line 1090 "src/cfgparse.y"
02650 {
02651 char *hex;
02652 if (asprintf(&hex, "#%s", (yyvsp[(2) - (2)].string)) == -1)
02653 die("asprintf()");
02654 (yyval.number) = get_colorpixel(hex);
02655 free(hex);
02656 ;}
02657 break;
02658
02659 case 89:
02660
02661
02662 #line 1101 "src/cfgparse.y"
02663 { (yyval.number) = 0; ;}
02664 break;
02665
02666 case 91:
02667
02668
02669 #line 1103 "src/cfgparse.y"
02670 { (yyval.number) = (yyvsp[(1) - (3)].number) | (yyvsp[(3) - (3)].number); ;}
02671 break;
02672
02673 case 92:
02674
02675
02676 #line 1104 "src/cfgparse.y"
02677 { (yyval.number) = (yyvsp[(1) - (2)].number); ;}
02678 break;
02679
02680 case 93:
02681
02682
02683 #line 1108 "src/cfgparse.y"
02684 { (yyval.number) = (yyvsp[(1) - (1)].number); ;}
02685 break;
02686
02687 case 94:
02688
02689
02690 #line 1109 "src/cfgparse.y"
02691 { (yyval.number) = BIND_CONTROL; ;}
02692 break;
02693
02694 case 95:
02695
02696
02697 #line 1110 "src/cfgparse.y"
02698 { (yyval.number) = BIND_SHIFT; ;}
02699 break;
02700
02701 case 96:
02702
02703
02704 #line 1115 "src/cfgparse.y"
02705 {
02706 DLOG("popup_during_fullscreen setting: %d\n", (yyvsp[(2) - (2)].number));
02707 config.popup_during_fullscreen = (yyvsp[(2) - (2)].number);
02708 ;}
02709 break;
02710
02711 case 97:
02712
02713
02714 #line 1122 "src/cfgparse.y"
02715 { (yyval.number) = PDF_IGNORE; ;}
02716 break;
02717
02718 case 98:
02719
02720
02721 #line 1123 "src/cfgparse.y"
02722 { (yyval.number) = PDF_LEAVE_FULLSCREEN; ;}
02723 break;
02724
02725
02726
02727
02728 #line 2729 "src/cfgparse.tab.c"
02729 default: break;
02730 }
02731 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
02732
02733 YYPOPSTACK (yylen);
02734 yylen = 0;
02735 YY_STACK_PRINT (yyss, yyssp);
02736
02737 *++yyvsp = yyval;
02738
02739
02740
02741
02742
02743 yyn = yyr1[yyn];
02744
02745 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
02746 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
02747 yystate = yytable[yystate];
02748 else
02749 yystate = yydefgoto[yyn - YYNTOKENS];
02750
02751 goto yynewstate;
02752
02753
02754
02755
02756
02757 yyerrlab:
02758
02759 if (!yyerrstatus)
02760 {
02761 ++yynerrs;
02762 #if ! YYERROR_VERBOSE
02763 yyerror (YY_("syntax error"));
02764 #else
02765 {
02766 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
02767 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
02768 {
02769 YYSIZE_T yyalloc = 2 * yysize;
02770 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
02771 yyalloc = YYSTACK_ALLOC_MAXIMUM;
02772 if (yymsg != yymsgbuf)
02773 YYSTACK_FREE (yymsg);
02774 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
02775 if (yymsg)
02776 yymsg_alloc = yyalloc;
02777 else
02778 {
02779 yymsg = yymsgbuf;
02780 yymsg_alloc = sizeof yymsgbuf;
02781 }
02782 }
02783
02784 if (0 < yysize && yysize <= yymsg_alloc)
02785 {
02786 (void) yysyntax_error (yymsg, yystate, yychar);
02787 yyerror (yymsg);
02788 }
02789 else
02790 {
02791 yyerror (YY_("syntax error"));
02792 if (yysize != 0)
02793 goto yyexhaustedlab;
02794 }
02795 }
02796 #endif
02797 }
02798
02799
02800
02801 if (yyerrstatus == 3)
02802 {
02803
02804
02805
02806 if (yychar <= YYEOF)
02807 {
02808
02809 if (yychar == YYEOF)
02810 YYABORT;
02811 }
02812 else
02813 {
02814 yydestruct ("Error: discarding",
02815 yytoken, &yylval);
02816 yychar = YYEMPTY;
02817 }
02818 }
02819
02820
02821
02822 goto yyerrlab1;
02823
02824
02825
02826
02827
02828 yyerrorlab:
02829
02830
02831
02832
02833 if ( 0)
02834 goto yyerrorlab;
02835
02836
02837
02838 YYPOPSTACK (yylen);
02839 yylen = 0;
02840 YY_STACK_PRINT (yyss, yyssp);
02841 yystate = *yyssp;
02842 goto yyerrlab1;
02843
02844
02845
02846
02847
02848 yyerrlab1:
02849 yyerrstatus = 3;
02850
02851 for (;;)
02852 {
02853 yyn = yypact[yystate];
02854 if (yyn != YYPACT_NINF)
02855 {
02856 yyn += YYTERROR;
02857 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02858 {
02859 yyn = yytable[yyn];
02860 if (0 < yyn)
02861 break;
02862 }
02863 }
02864
02865
02866 if (yyssp == yyss)
02867 YYABORT;
02868
02869
02870 yydestruct ("Error: popping",
02871 yystos[yystate], yyvsp);
02872 YYPOPSTACK (1);
02873 yystate = *yyssp;
02874 YY_STACK_PRINT (yyss, yyssp);
02875 }
02876
02877 *++yyvsp = yylval;
02878
02879
02880
02881 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
02882
02883 yystate = yyn;
02884 goto yynewstate;
02885
02886
02887
02888
02889
02890 yyacceptlab:
02891 yyresult = 0;
02892 goto yyreturn;
02893
02894
02895
02896
02897 yyabortlab:
02898 yyresult = 1;
02899 goto yyreturn;
02900
02901 #if !defined(yyoverflow) || YYERROR_VERBOSE
02902
02903
02904
02905 yyexhaustedlab:
02906 yyerror (YY_("memory exhausted"));
02907 yyresult = 2;
02908
02909 #endif
02910
02911 yyreturn:
02912 if (yychar != YYEMPTY)
02913 yydestruct ("Cleanup: discarding lookahead",
02914 yytoken, &yylval);
02915
02916
02917 YYPOPSTACK (yylen);
02918 YY_STACK_PRINT (yyss, yyssp);
02919 while (yyssp != yyss)
02920 {
02921 yydestruct ("Cleanup: popping",
02922 yystos[*yyssp], yyvsp);
02923 YYPOPSTACK (1);
02924 }
02925 #ifndef yyoverflow
02926 if (yyss != yyssa)
02927 YYSTACK_FREE (yyss);
02928 #endif
02929 #if YYERROR_VERBOSE
02930 if (yymsg != yymsgbuf)
02931 YYSTACK_FREE (yymsg);
02932 #endif
02933
02934 return YYID (yyresult);
02935 }
02936
02937
02938