i3
cfgparse.tab.c
Go to the documentation of this file.
1 /* A Bison parser, made by GNU Bison 2.6.1. */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5  Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 
20 /* As a special exception, you may create a larger work that contains
21  part or all of the Bison parser skeleton and distribute that work
22  under terms of your choice, so long as that work isn't itself a
23  parser generator using the skeleton or a modified version thereof
24  as a parser skeleton. Alternatively, if you modify or redistribute
25  the parser skeleton itself, you may (at your option) remove this
26  special exception, which will cause the skeleton and the resulting
27  Bison output files to be licensed under the GNU General Public
28  License without this special exception.
29 
30  This special exception was added by the Free Software Foundation in
31  version 2.2 of Bison. */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34  simplifying the original so-called "semantic" parser. */
35 
36 /* All symbols defined below should begin with yy or YY, to avoid
37  infringing on user name space. This should be done even for local
38  variables, as they might otherwise be expanded by user macros.
39  There are some unavoidable exceptions within include files to
40  define necessary library symbols; they are noted "INFRINGES ON
41  USER NAME SPACE" below. */
42 
43 /* Identify Bison output. */
44 #define YYBISON 1
45 
46 /* Bison version. */
47 #define YYBISON_VERSION "2.6.1"
48 
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers. */
53 #define YYPURE 0
54 
55 /* Push parsers. */
56 #define YYPUSH 0
57 
58 /* Pull parsers. */
59 #define YYPULL 1
60 
61 
62 
63 
64 /* Copy the first part of user declarations. */
65 /* Line 336 of yacc.c */
66 #line 1 "../i3-4.3/src/cfgparse.y"
67 
68 /*
69  * vim:ts=4:sw=4:expandtab
70  *
71  */
72 #undef I3__FILE__
73 #define I3__FILE__ "cfgparse.y"
74 #include <sys/types.h>
75 #include <sys/stat.h>
76 #include <sys/wait.h>
77 #include <unistd.h>
78 #include <fcntl.h>
79 
80 #include "all.h"
81 
82 static pid_t configerror_pid = -1;
83 
86 /* The pattern which was specified by the user, for example -misc-fixed-*. We
87  * store this in a separate variable because in the i3 config struct we just
88  * store the i3Font. */
89 static char *font_pattern;
90 /* The path to the temporary script files used by i3-nagbar. We need to keep
91  * them around to delete the files in the i3-nagbar SIGCHLD handler. */
93 
95 extern int yylex(struct context *context);
96 extern int yyparse(void);
97 extern int yylex_destroy(void);
98 extern FILE *yyin;
99 YY_BUFFER_STATE yy_scan_string(const char *);
100 
101 static struct bindings_head *current_bindings;
102 static struct context *context;
103 
104 /* We don’t need yydebug for now, as we got decent error messages using
105  * yyerror(). Should you ever want to extend the parser, it might be handy
106  * to just comment it in again, so it stays here. */
107 //int yydebug = 1;
108 
109 void yyerror(const char *error_message) {
110  context->has_errors = true;
111 
112  ELOG("\n");
113  ELOG("CONFIG: %s\n", error_message);
114  ELOG("CONFIG: in file \"%s\", line %d:\n",
115  context->filename, context->line_number);
116  ELOG("CONFIG: %s\n", context->line_copy);
117  char buffer[context->last_column+1];
118  buffer[context->last_column] = '\0';
119  for (int c = 1; c <= context->last_column; c++)
120  buffer[c-1] = (c >= context->first_column ? '^' : ' ');
121  ELOG("CONFIG: %s\n", buffer);
122  ELOG("\n");
123 }
124 
125 int yywrap(void) {
126  return 1;
127 }
128 
129 /*
130  * Goes through each line of buf (separated by \n) and checks for statements /
131  * commands which only occur in i3 v4 configuration files. If it finds any, it
132  * returns version 4, otherwise it returns version 3.
133  *
134  */
135 static int detect_version(char *buf) {
136  char *walk = buf;
137  char *line = buf;
138  while (*walk != '\0') {
139  if (*walk != '\n') {
140  walk++;
141  continue;
142  }
143 
144  /* check for some v4-only statements */
145  if (strncasecmp(line, "bindcode", strlen("bindcode")) == 0 ||
146  strncasecmp(line, "force_focus_wrapping", strlen("force_focus_wrapping")) == 0 ||
147  strncasecmp(line, "# i3 config file (v4)", strlen("# i3 config file (v4)")) == 0 ||
148  strncasecmp(line, "workspace_layout", strlen("workspace_layout")) == 0) {
149  printf("deciding for version 4 due to this line: %.*s\n", (int)(walk-line), line);
150  return 4;
151  }
152 
153  /* if this is a bind statement, we can check the command */
154  if (strncasecmp(line, "bind", strlen("bind")) == 0) {
155  char *bind = strchr(line, ' ');
156  if (bind == NULL)
157  goto next;
158  while ((*bind == ' ' || *bind == '\t') && *bind != '\0')
159  bind++;
160  if (*bind == '\0')
161  goto next;
162  if ((bind = strchr(bind, ' ')) == NULL)
163  goto next;
164  while ((*bind == ' ' || *bind == '\t') && *bind != '\0')
165  bind++;
166  if (*bind == '\0')
167  goto next;
168  if (strncasecmp(bind, "layout", strlen("layout")) == 0 ||
169  strncasecmp(bind, "floating", strlen("floating")) == 0 ||
170  strncasecmp(bind, "workspace", strlen("workspace")) == 0 ||
171  strncasecmp(bind, "focus left", strlen("focus left")) == 0 ||
172  strncasecmp(bind, "focus right", strlen("focus right")) == 0 ||
173  strncasecmp(bind, "focus up", strlen("focus up")) == 0 ||
174  strncasecmp(bind, "focus down", strlen("focus down")) == 0 ||
175  strncasecmp(bind, "border normal", strlen("border normal")) == 0 ||
176  strncasecmp(bind, "border 1pixel", strlen("border 1pixel")) == 0 ||
177  strncasecmp(bind, "border borderless", strlen("border borderless")) == 0 ||
178  strncasecmp(bind, "--no-startup-id", strlen("--no-startup-id")) == 0 ||
179  strncasecmp(bind, "bar", strlen("bar")) == 0) {
180  printf("deciding for version 4 due to this line: %.*s\n", (int)(walk-line), line);
181  return 4;
182  }
183  }
184 
185 next:
186  /* advance to the next line */
187  walk++;
188  line = walk;
189  }
190 
191  return 3;
192 }
193 
194 /*
195  * Calls i3-migrate-config-to-v4 to migrate a configuration file (input
196  * buffer).
197  *
198  * Returns the converted config file or NULL if there was an error (for
199  * example the script could not be found in $PATH or the i3 executable’s
200  * directory).
201  *
202  */
203 static char *migrate_config(char *input, off_t size) {
204  int writepipe[2];
205  int readpipe[2];
206 
207  if (pipe(writepipe) != 0 ||
208  pipe(readpipe) != 0) {
209  warn("migrate_config: Could not create pipes");
210  return NULL;
211  }
212 
213  pid_t pid = fork();
214  if (pid == -1) {
215  warn("Could not fork()");
216  return NULL;
217  }
218 
219  /* child */
220  if (pid == 0) {
221  /* close writing end of writepipe, connect reading side to stdin */
222  close(writepipe[1]);
223  dup2(writepipe[0], 0);
224 
225  /* close reading end of readpipe, connect writing side to stdout */
226  close(readpipe[0]);
227  dup2(readpipe[1], 1);
228 
229  static char *argv[] = {
230  NULL, /* will be replaced by the executable path */
231  NULL
232  };
233  exec_i3_utility("i3-migrate-config-to-v4", argv);
234  }
235 
236  /* parent */
237 
238  /* close reading end of the writepipe (connected to the script’s stdin) */
239  close(writepipe[0]);
240 
241  /* write the whole config file to the pipe, the script will read everything
242  * immediately */
243  int written = 0;
244  int ret;
245  while (written < size) {
246  if ((ret = write(writepipe[1], input + written, size - written)) < 0) {
247  warn("Could not write to pipe");
248  return NULL;
249  }
250  written += ret;
251  }
252  close(writepipe[1]);
253 
254  /* close writing end of the readpipe (connected to the script’s stdout) */
255  close(readpipe[1]);
256 
257  /* read the script’s output */
258  int conv_size = 65535;
259  char *converted = malloc(conv_size);
260  int read_bytes = 0;
261  do {
262  if (read_bytes == conv_size) {
263  conv_size += 65535;
264  converted = realloc(converted, conv_size);
265  }
266  ret = read(readpipe[0], converted + read_bytes, conv_size - read_bytes);
267  if (ret == -1) {
268  warn("Cannot read from pipe");
269  FREE(converted);
270  return NULL;
271  }
272  read_bytes += ret;
273  } while (ret > 0);
274 
275  /* get the returncode */
276  int status;
277  wait(&status);
278  if (!WIFEXITED(status)) {
279  fprintf(stderr, "Child did not terminate normally, using old config file (will lead to broken behaviour)\n");
280  return NULL;
281  }
282 
283  int returncode = WEXITSTATUS(status);
284  if (returncode != 0) {
285  fprintf(stderr, "Migration process exit code was != 0\n");
286  if (returncode == 2) {
287  fprintf(stderr, "could not start the migration script\n");
288  /* TODO: script was not found. tell the user to fix his system or create a v4 config */
289  } else if (returncode == 1) {
290  fprintf(stderr, "This already was a v4 config. Please add the following line to your config file:\n");
291  fprintf(stderr, "# i3 config file (v4)\n");
292  /* TODO: nag the user with a message to include a hint for i3 in his config file */
293  }
294  return NULL;
295  }
296 
297  return converted;
298 }
299 
300 /*
301  * Handler which will be called when we get a SIGCHLD for the nagbar, meaning
302  * it exited (or could not be started, depending on the exit code).
303  *
304  */
305 static void nagbar_exited(EV_P_ ev_child *watcher, int revents) {
306  ev_child_stop(EV_A_ watcher);
307 
308  if (unlink(edit_script_path) != 0)
309  warn("Could not delete temporary i3-nagbar script %s", edit_script_path);
310  if (unlink(pager_script_path) != 0)
311  warn("Could not delete temporary i3-nagbar script %s", pager_script_path);
312 
313  if (!WIFEXITED(watcher->rstatus)) {
314  fprintf(stderr, "ERROR: i3-nagbar did not exit normally.\n");
315  return;
316  }
317 
318  int exitcode = WEXITSTATUS(watcher->rstatus);
319  printf("i3-nagbar process exited with status %d\n", exitcode);
320  if (exitcode == 2) {
321  fprintf(stderr, "ERROR: i3-nagbar could not be found. Is it correctly installed on your system?\n");
322  }
323 
324  configerror_pid = -1;
325 }
326 
327 /* We need ev >= 4 for the following code. Since it is not *that* important (it
328  * only makes sure that there are no i3-nagbar instances left behind) we still
329  * support old systems with libev 3. */
330 #if EV_VERSION_MAJOR >= 4
331 /*
332  * Cleanup handler. Will be called when i3 exits. Kills i3-nagbar with signal
333  * SIGKILL (9) to make sure there are no left-over i3-nagbar processes.
334  *
335  */
336 static void nagbar_cleanup(EV_P_ ev_cleanup *watcher, int revent) {
337  if (configerror_pid != -1) {
338  LOG("Sending SIGKILL (9) to i3-nagbar with PID %d\n", configerror_pid);
339  kill(configerror_pid, SIGKILL);
340  }
341 }
342 #endif
343 
344 /*
345  * Writes the given command as a shell script to path.
346  * Returns true unless something went wrong.
347  *
348  */
349 static bool write_nagbar_script(const char *path, const char *command) {
350  int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IXUSR);
351  if (fd == -1) {
352  warn("Could not create temporary script to store the nagbar command");
353  return false;
354  }
355  write(fd, "#!/bin/sh\n", strlen("#!/bin/sh\n"));
356  write(fd, command, strlen(command));
357  close(fd);
358  return true;
359 }
360 
361 /*
362  * Starts an i3-nagbar process which alerts the user that his configuration
363  * file contains one or more errors. Also offers two buttons: One to launch an
364  * $EDITOR on the config file and another one to launch a $PAGER on the error
365  * logfile.
366  *
367  */
368 static void start_configerror_nagbar(const char *config_path) {
369  if (only_check_config)
370  return;
371 
372  fprintf(stderr, "Starting i3-nagbar due to configuration errors\n");
373 
374  /* We need to create a custom script containing our actual command
375  * since not every terminal emulator which is contained in
376  * i3-sensible-terminal supports -e with multiple arguments (and not
377  * all of them support -e with one quoted argument either).
378  *
379  * NB: The paths need to be unique, that is, don’t assume users close
380  * their nagbars at any point in time (and they still need to work).
381  * */
382  edit_script_path = get_process_filename("nagbar-cfgerror-edit");
383  pager_script_path = get_process_filename("nagbar-cfgerror-pager");
384 
385  configerror_pid = fork();
386  if (configerror_pid == -1) {
387  warn("Could not fork()");
388  return;
389  }
390 
391  /* child */
392  if (configerror_pid == 0) {
393  char *edit_command, *pager_command;
394  sasprintf(&edit_command, "i3-sensible-editor \"%s\" && i3-msg reload\n", config_path);
395  sasprintf(&pager_command, "i3-sensible-pager \"%s\"\n", errorfilename);
396  if (!write_nagbar_script(edit_script_path, edit_command) ||
397  !write_nagbar_script(pager_script_path, pager_command))
398  return;
399 
400  char *editaction,
401  *pageraction;
402  sasprintf(&editaction, "i3-sensible-terminal -e \"%s\"", edit_script_path);
403  sasprintf(&pageraction, "i3-sensible-terminal -e \"%s\"", pager_script_path);
404  char *argv[] = {
405  NULL, /* will be replaced by the executable path */
406  "-t",
407  (context->has_errors ? "error" : "warning"),
408  "-m",
409  (context->has_errors ?
410  "You have an error in your i3 config file!" :
411  "Your config is outdated. Please fix the warnings to make sure everything works."),
412  "-b",
413  "edit config",
414  editaction,
415  (errorfilename ? "-b" : NULL),
416  (context->has_errors ? "show errors" : "show warnings"),
417  pageraction,
418  NULL
419  };
420  exec_i3_utility("i3-nagbar", argv);
421  }
422 
423  /* parent */
424  /* install a child watcher */
425  ev_child *child = smalloc(sizeof(ev_child));
426  ev_child_init(child, &nagbar_exited, configerror_pid, 0);
427  ev_child_start(main_loop, child);
428 
429 /* We need ev >= 4 for the following code. Since it is not *that* important (it
430  * only makes sure that there are no i3-nagbar instances left behind) we still
431  * support old systems with libev 3. */
432 #if EV_VERSION_MAJOR >= 4
433  /* install a cleanup watcher (will be called when i3 exits and i3-nagbar is
434  * still running) */
435  ev_cleanup *cleanup = smalloc(sizeof(ev_cleanup));
436  ev_cleanup_init(cleanup, nagbar_cleanup);
437  ev_cleanup_start(main_loop, cleanup);
438 #endif
439 }
440 
441 /*
442  * Kills the configerror i3-nagbar process, if any.
443  *
444  * Called when reloading/restarting.
445  *
446  * If wait_for_it is set (restarting), this function will waitpid(), otherwise,
447  * ev is assumed to handle it (reloading).
448  *
449  */
450 void kill_configerror_nagbar(bool wait_for_it) {
451  if (configerror_pid == -1)
452  return;
453 
454  if (kill(configerror_pid, SIGTERM) == -1)
455  warn("kill(configerror_nagbar) failed");
456 
457  if (!wait_for_it)
458  return;
459 
460  /* When restarting, we don’t enter the ev main loop anymore and after the
461  * exec(), our old pid is no longer watched. So, ev won’t handle SIGCHLD
462  * for us and we would end up with a <defunct> process. Therefore we
463  * waitpid() here. */
464  waitpid(configerror_pid, NULL, 0);
465 }
466 
467 /*
468  * Checks for duplicate key bindings (the same keycode or keysym is configured
469  * more than once). If a duplicate binding is found, a message is printed to
470  * stderr and the has_errors variable is set to true, which will start
471  * i3-nagbar.
472  *
473  */
474 static void check_for_duplicate_bindings(struct context *context) {
475  Binding *bind, *current;
476  TAILQ_FOREACH(current, bindings, bindings) {
478  /* Abort when we reach the current keybinding, only check the
479  * bindings before */
480  if (bind == current)
481  break;
482 
483  /* Check if one is using keysym while the other is using bindsym.
484  * If so, skip. */
485  /* XXX: It should be checked at a later place (when translating the
486  * keysym to keycodes) if there are any duplicates */
487  if ((bind->symbol == NULL && current->symbol != NULL) ||
488  (bind->symbol != NULL && current->symbol == NULL))
489  continue;
490 
491  /* If bind is NULL, current has to be NULL, too (see above).
492  * If the keycodes differ, it can't be a duplicate. */
493  if (bind->symbol != NULL &&
494  strcasecmp(bind->symbol, current->symbol) != 0)
495  continue;
496 
497  /* Check if the keycodes or modifiers are different. If so, they
498  * can't be duplicate */
499  if (bind->keycode != current->keycode ||
500  bind->mods != current->mods ||
501  bind->release != current->release)
502  continue;
503 
504  context->has_errors = true;
505  if (current->keycode != 0) {
506  ELOG("Duplicate keybinding in config file:\n modmask %d with keycode %d, command \"%s\"\n",
507  current->mods, current->keycode, current->command);
508  } else {
509  ELOG("Duplicate keybinding in config file:\n modmask %d with keysym %s, command \"%s\"\n",
510  current->mods, current->symbol, current->command);
511  }
512  }
513  }
514 }
515 
516 static void migrate_i3bar_exec(struct Autostart *exec) {
517  ELOG("**********************************************************************\n");
518  ELOG("IGNORING exec command: %s\n", exec->command);
519  ELOG("It contains \"i3bar\". Since i3 v4.1, i3bar will be automatically started\n");
520  ELOG("for each 'bar' configuration block in your i3 config. Please remove the exec\n");
521  ELOG("line and add the following to your i3 config:\n");
522  ELOG("\n");
523  ELOG(" bar {\n");
524  ELOG(" status_command i3status\n");
525  ELOG(" }\n");
526  ELOG("**********************************************************************\n");
527 
528  /* Generate a dummy bar configuration */
529  Barconfig *bar_config = scalloc(sizeof(Barconfig));
530  /* The hard-coded ID is not a problem. It does not conflict with the
531  * auto-generated bar IDs and having multiple hard-coded IDs is irrelevant
532  * – they all just contain status_command = i3status */
533  bar_config->id = sstrdup("migrate-bar");
534  bar_config->status_command = sstrdup("i3status");
535  TAILQ_INSERT_TAIL(&barconfigs, bar_config, configs);
536 
537  /* Trigger an i3-nagbar */
538  context->has_warnings = true;
539 }
540 
541 void parse_file(const char *f) {
542  SLIST_HEAD(variables_head, Variable) variables = SLIST_HEAD_INITIALIZER(&variables);
543  int fd, ret, read_bytes = 0;
544  struct stat stbuf;
545  char *buf;
546  FILE *fstr;
547  char buffer[1026], key[512], value[512];
548 
549  if ((fd = open(f, O_RDONLY)) == -1)
550  die("Could not open configuration file: %s\n", strerror(errno));
551 
552  if (fstat(fd, &stbuf) == -1)
553  die("Could not fstat file: %s\n", strerror(errno));
554 
555  buf = scalloc((stbuf.st_size + 1) * sizeof(char));
556  while (read_bytes < stbuf.st_size) {
557  if ((ret = read(fd, buf + read_bytes, (stbuf.st_size - read_bytes))) < 0)
558  die("Could not read(): %s\n", strerror(errno));
559  read_bytes += ret;
560  }
561 
562  if (lseek(fd, 0, SEEK_SET) == (off_t)-1)
563  die("Could not lseek: %s\n", strerror(errno));
564 
565  if ((fstr = fdopen(fd, "r")) == NULL)
566  die("Could not fdopen: %s\n", strerror(errno));
567 
568  while (!feof(fstr)) {
569  if (fgets(buffer, 1024, fstr) == NULL) {
570  if (feof(fstr))
571  break;
572  die("Could not read configuration file\n");
573  }
574 
575  /* sscanf implicitly strips whitespace. Also, we skip comments and empty lines. */
576  if (sscanf(buffer, "%s %[^\n]", key, value) < 1 ||
577  key[0] == '#' || strlen(key) < 3)
578  continue;
579 
580  if (strcasecmp(key, "set") == 0) {
581  if (value[0] != '$') {
582  ELOG("Malformed variable assignment, name has to start with $\n");
583  continue;
584  }
585 
586  /* get key/value for this variable */
587  char *v_key = value, *v_value;
588  if (strstr(value, " ") == NULL && strstr(value, "\t") == NULL) {
589  ELOG("Malformed variable assignment, need a value\n");
590  continue;
591  }
592 
593  if (!(v_value = strstr(value, " ")))
594  v_value = strstr(value, "\t");
595 
596  *(v_value++) = '\0';
597  while (*v_value == '\t' || *v_value == ' ')
598  v_value++;
599 
600  struct Variable *new = scalloc(sizeof(struct Variable));
601  new->key = sstrdup(v_key);
602  new->value = sstrdup(v_value);
603  SLIST_INSERT_HEAD(&variables, new, variables);
604  DLOG("Got new variable %s = %s\n", v_key, v_value);
605  continue;
606  }
607  }
608  fclose(fstr);
609 
610  /* For every custom variable, see how often it occurs in the file and
611  * how much extra bytes it requires when replaced. */
612  struct Variable *current, *nearest;
613  int extra_bytes = 0;
614  /* We need to copy the buffer because we need to invalidate the
615  * variables (otherwise we will count them twice, which is bad when
616  * 'extra' is negative) */
617  char *bufcopy = sstrdup(buf);
618  SLIST_FOREACH(current, &variables, variables) {
619  int extra = (strlen(current->value) - strlen(current->key));
620  char *next;
621  for (next = bufcopy;
622  next < (bufcopy + stbuf.st_size) &&
623  (next = strcasestr(next, current->key)) != NULL;
624  next += strlen(current->key)) {
625  *next = '_';
626  extra_bytes += extra;
627  }
628  }
629  FREE(bufcopy);
630 
631  /* Then, allocate a new buffer and copy the file over to the new one,
632  * but replace occurences of our variables */
633  char *walk = buf, *destwalk;
634  char *new = smalloc((stbuf.st_size + extra_bytes + 1) * sizeof(char));
635  destwalk = new;
636  while (walk < (buf + stbuf.st_size)) {
637  /* Find the next variable */
638  SLIST_FOREACH(current, &variables, variables)
639  current->next_match = strcasestr(walk, current->key);
640  nearest = NULL;
641  int distance = stbuf.st_size;
642  SLIST_FOREACH(current, &variables, variables) {
643  if (current->next_match == NULL)
644  continue;
645  if ((current->next_match - walk) < distance) {
646  distance = (current->next_match - walk);
647  nearest = current;
648  }
649  }
650  if (nearest == NULL) {
651  /* If there are no more variables, we just copy the rest */
652  strncpy(destwalk, walk, (buf + stbuf.st_size) - walk);
653  destwalk += (buf + stbuf.st_size) - walk;
654  *destwalk = '\0';
655  break;
656  } else {
657  /* Copy until the next variable, then copy its value */
658  strncpy(destwalk, walk, distance);
659  strncpy(destwalk + distance, nearest->value, strlen(nearest->value));
660  walk += distance + strlen(nearest->key);
661  destwalk += distance + strlen(nearest->value);
662  }
663  }
664 
665  /* analyze the string to find out whether this is an old config file (3.x)
666  * or a new config file (4.x). If it’s old, we run the converter script. */
667  int version = detect_version(buf);
668  if (version == 3) {
669  /* We need to convert this v3 configuration */
670  char *converted = migrate_config(new, stbuf.st_size);
671  if (converted != NULL) {
672  ELOG("\n");
673  ELOG("****************************************************************\n");
674  ELOG("NOTE: Automatically converted configuration file from v3 to v4.\n");
675  ELOG("\n");
676  ELOG("Please convert your config file to v4. You can use this command:\n");
677  ELOG(" mv %s %s.O\n", f, f);
678  ELOG(" i3-migrate-config-to-v4 %s.O > %s\n", f, f);
679  ELOG("****************************************************************\n");
680  ELOG("\n");
681  free(new);
682  new = converted;
683  } else {
684  printf("\n");
685  printf("**********************************************************************\n");
686  printf("ERROR: Could not convert config file. Maybe i3-migrate-config-to-v4\n");
687  printf("was not correctly installed on your system?\n");
688  printf("**********************************************************************\n");
689  printf("\n");
690  }
691  }
692 
693  /* now lex/parse it */
694  yy_scan_string(new);
695 
696  context = scalloc(sizeof(struct context));
697  context->filename = f;
698 
699  if (yyparse() != 0) {
700  fprintf(stderr, "Could not parse configfile\n");
701  exit(1);
702  }
703 
705 
706  /* XXX: The following code will be removed in i3 v4.3 (three releases from
707  * now, as of 2011-10-22) */
708  /* Check for any exec or exec_always lines starting i3bar. We remove these
709  * and add a bar block instead. Additionally, a i3-nagbar warning (not an
710  * error) will be displayed so that users update their config file. */
711  struct Autostart *exec, *next;
712  for (exec = TAILQ_FIRST(&autostarts); exec; ) {
713  next = TAILQ_NEXT(exec, autostarts);
714  if (strstr(exec->command, "i3bar") != NULL) {
715  migrate_i3bar_exec(exec);
717  }
718  exec = next;
719  }
720 
721  for (exec = TAILQ_FIRST(&autostarts_always); exec; ) {
722  next = TAILQ_NEXT(exec, autostarts_always);
723  if (strstr(exec->command, "i3bar") != NULL) {
724  migrate_i3bar_exec(exec);
726  }
727  exec = next;
728  }
729 
730  if (context->has_errors || context->has_warnings) {
731  ELOG("FYI: You are using i3 version " I3_VERSION "\n");
732  if (version == 3)
733  ELOG("Please convert your configfile first, then fix any remaining errors (see above).\n");
735  }
736 
737  yylex_destroy();
738  FREE(context->line_copy);
739  free(context);
741  free(new);
742  free(buf);
743 
744  while (!SLIST_EMPTY(&variables)) {
745  current = SLIST_FIRST(&variables);
746  FREE(current->key);
747  FREE(current->value);
748  SLIST_REMOVE_HEAD(&variables, variables);
749  FREE(current);
750  }
751 }
752 
753 
754 /* Line 336 of yacc.c */
755 #line 756 "src/cfgparse.tab.c"
756 
757 # ifndef YY_NULL
758 # if defined __cplusplus && 201103L <= __cplusplus
759 # define YY_NULL nullptr
760 # else
761 # define YY_NULL 0
762 # endif
763 # endif
764 
765 /* Enabling verbose error messages. */
766 #ifdef YYERROR_VERBOSE
767 # undef YYERROR_VERBOSE
768 # define YYERROR_VERBOSE 1
769 #else
770 # define YYERROR_VERBOSE 1
771 #endif
772 
773 /* In a future release of Bison, this section will be replaced
774  by #include "cfgparse.tab.h". */
775 #ifndef YY_SRC_CFGPARSE_TAB_H
776 # define YY_SRC_CFGPARSE_TAB_H
777 /* Enabling traces. */
778 #ifndef YYDEBUG
779 # define YYDEBUG 1
780 #endif
781 #if YYDEBUG
782 extern int yydebug;
783 #endif
784 
785 /* Tokens. */
786 #ifndef YYTOKENTYPE
787 # define YYTOKENTYPE
788  /* Put the tokens into the symbol table, so that GDB and other debuggers
789  know about them. */
790  enum yytokentype {
791  NUMBER = 258,
792  WORD = 259,
793  STR = 260,
794  STR_NG = 261,
795  HEXCOLOR = 262,
796  OUTPUT = 263,
797  TOKBINDCODE = 264,
798  TOKTERMINAL = 265,
799  TOKCOMMENT = 266,
800  TOKFONT = 267,
801  TOKBINDSYM = 268,
802  MODIFIER = 269,
803  TOKCONTROL = 270,
804  TOKSHIFT = 271,
810  TOKOUTPUT = 277,
811  TOKASSIGN = 278,
812  TOKSET = 279,
815  TOKEXEC = 282,
818  TOKCOLOR = 285,
819  TOKARROW = 286,
820  TOKMODE = 287,
821  TOK_BAR = 288,
823  TOK_HORIZ = 290,
824  TOK_VERT = 291,
825  TOK_AUTO = 292,
828  TOKNEWFLOAT = 295,
829  TOK_NORMAL = 296,
830  TOK_NONE = 297,
831  TOK_1PIXEL = 298,
833  TOK_BOTH = 300,
840  TOK_DEFAULT = 307,
842  TOK_TABBED = 309,
845  TOK_IGNORE = 312,
864  TOK_BAR_TOP = 331,
878  TOK_RELEASE = 345,
879  TOK_MARK = 346,
880  TOK_CLASS = 347,
883  TOK_ID = 350,
884  TOK_CON_ID = 351,
885  TOK_TITLE = 352,
887  };
888 #endif
889 
890 
891 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
892 typedef union YYSTYPE
893 {
894 /* Line 350 of yacc.c */
895 #line 692 "../i3-4.3/src/cfgparse.y"
896 
897  int number;
898  char *string;
899  uint32_t *single_color;
902  struct Binding *binding;
903 
904 
905 /* Line 350 of yacc.c */
906 #line 907 "src/cfgparse.tab.c"
907 } YYSTYPE;
908 # define YYSTYPE_IS_TRIVIAL 1
909 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
910 # define YYSTYPE_IS_DECLARED 1
911 #endif
912 
913 extern YYSTYPE yylval;
914 
915 #ifdef YYPARSE_PARAM
916 #if defined __STDC__ || defined __cplusplus
917 int yyparse (void *YYPARSE_PARAM);
918 #else
919 int yyparse ();
920 #endif
921 #else /* ! YYPARSE_PARAM */
922 #if defined __STDC__ || defined __cplusplus
923 int yyparse (void);
924 #else
925 int yyparse ();
926 #endif
927 #endif /* ! YYPARSE_PARAM */
928 
929 #endif /* !YY_SRC_CFGPARSE_TAB_H */
930 
931 /* Copy the second part of user declarations. */
932 
933 /* Line 353 of yacc.c */
934 #line 935 "src/cfgparse.tab.c"
935 
936 #ifdef short
937 # undef short
938 #endif
939 
940 #ifdef YYTYPE_UINT8
941 typedef YYTYPE_UINT8 yytype_uint8;
942 #else
943 typedef unsigned char yytype_uint8;
944 #endif
945 
946 #ifdef YYTYPE_INT8
947 typedef YYTYPE_INT8 yytype_int8;
948 #elif (defined __STDC__ || defined __C99__FUNC__ \
949  || defined __cplusplus || defined _MSC_VER)
950 typedef signed char yytype_int8;
951 #else
952 typedef short int yytype_int8;
953 #endif
954 
955 #ifdef YYTYPE_UINT16
956 typedef YYTYPE_UINT16 yytype_uint16;
957 #else
958 typedef unsigned short int yytype_uint16;
959 #endif
960 
961 #ifdef YYTYPE_INT16
962 typedef YYTYPE_INT16 yytype_int16;
963 #else
964 typedef short int yytype_int16;
965 #endif
966 
967 #ifndef YYSIZE_T
968 # ifdef __SIZE_TYPE__
969 # define YYSIZE_T __SIZE_TYPE__
970 # elif defined size_t
971 # define YYSIZE_T size_t
972 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
973  || defined __cplusplus || defined _MSC_VER)
974 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
975 # define YYSIZE_T size_t
976 # else
977 # define YYSIZE_T unsigned int
978 # endif
979 #endif
980 
981 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
982 
983 #ifndef YY_
984 # if defined YYENABLE_NLS && YYENABLE_NLS
985 # if ENABLE_NLS
986 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
987 # define YY_(msgid) dgettext ("bison-runtime", msgid)
988 # endif
989 # endif
990 # ifndef YY_
991 # define YY_(msgid) msgid
992 # endif
993 #endif
994 
995 /* Suppress unused-variable warnings by "using" E. */
996 #if ! defined lint || defined __GNUC__
997 # define YYUSE(e) ((void) (e))
998 #else
999 # define YYUSE(e) /* empty */
1000 #endif
1001 
1002 /* Identity function, used to suppress warnings about constant conditions. */
1003 #ifndef lint
1004 # define YYID(n) (n)
1005 #else
1006 #if (defined __STDC__ || defined __C99__FUNC__ \
1007  || defined __cplusplus || defined _MSC_VER)
1008 static int
1009 YYID (int yyi)
1010 #else
1011 static int
1012 YYID (yyi)
1013  int yyi;
1014 #endif
1015 {
1016  return yyi;
1017 }
1018 #endif
1019 
1020 #if ! defined yyoverflow || YYERROR_VERBOSE
1021 
1022 /* The parser invokes alloca or malloc; define the necessary symbols. */
1023 
1024 # ifdef YYSTACK_USE_ALLOCA
1025 # if YYSTACK_USE_ALLOCA
1026 # ifdef __GNUC__
1027 # define YYSTACK_ALLOC __builtin_alloca
1028 # elif defined __BUILTIN_VA_ARG_INCR
1029 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1030 # elif defined _AIX
1031 # define YYSTACK_ALLOC __alloca
1032 # elif defined _MSC_VER
1033 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1034 # define alloca _alloca
1035 # else
1036 # define YYSTACK_ALLOC alloca
1037 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1038  || defined __cplusplus || defined _MSC_VER)
1039 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1040  /* Use EXIT_SUCCESS as a witness for stdlib.h. */
1041 # ifndef EXIT_SUCCESS
1042 # define EXIT_SUCCESS 0
1043 # endif
1044 # endif
1045 # endif
1046 # endif
1047 # endif
1048 
1049 # ifdef YYSTACK_ALLOC
1050  /* Pacify GCC's `empty if-body' warning. */
1051 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1052 # ifndef YYSTACK_ALLOC_MAXIMUM
1053  /* The OS might guarantee only one guard page at the bottom of the stack,
1054  and a page size can be as small as 4096 bytes. So we cannot safely
1055  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1056  to allow for a few compiler-allocated temporary stack slots. */
1057 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1058 # endif
1059 # else
1060 # define YYSTACK_ALLOC YYMALLOC
1061 # define YYSTACK_FREE YYFREE
1062 # ifndef YYSTACK_ALLOC_MAXIMUM
1063 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1064 # endif
1065 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
1066  && ! ((defined YYMALLOC || defined malloc) \
1067  && (defined YYFREE || defined free)))
1068 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1069 # ifndef EXIT_SUCCESS
1070 # define EXIT_SUCCESS 0
1071 # endif
1072 # endif
1073 # ifndef YYMALLOC
1074 # define YYMALLOC malloc
1075 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1076  || defined __cplusplus || defined _MSC_VER)
1077 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1078 # endif
1079 # endif
1080 # ifndef YYFREE
1081 # define YYFREE free
1082 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1083  || defined __cplusplus || defined _MSC_VER)
1084 void free (void *); /* INFRINGES ON USER NAME SPACE */
1085 # endif
1086 # endif
1087 # endif
1088 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1089 
1090 
1091 #if (! defined yyoverflow \
1092  && (! defined __cplusplus \
1093  || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1094 
1095 /* A type that is properly aligned for any stack member. */
1096 union yyalloc
1097 {
1098  yytype_int16 yyss_alloc;
1100 };
1101 
1102 /* The size of the maximum gap between one aligned stack and the next. */
1103 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1104 
1105 /* The size of an array large to enough to hold all stacks, each with
1106  N elements. */
1107 # define YYSTACK_BYTES(N) \
1108  ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1109  + YYSTACK_GAP_MAXIMUM)
1110 
1111 # define YYCOPY_NEEDED 1
1112 
1113 /* Relocate STACK from its old location to the new one. The
1114  local variables YYSIZE and YYSTACKSIZE give the old and new number of
1115  elements in the stack, and YYPTR gives the new location of the
1116  stack. Advance YYPTR to a properly aligned location for the next
1117  stack. */
1118 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1119  do \
1120  { \
1121  YYSIZE_T yynewbytes; \
1122  YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1123  Stack = &yyptr->Stack_alloc; \
1124  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1125  yyptr += yynewbytes / sizeof (*yyptr); \
1126  } \
1127  while (YYID (0))
1128 
1129 #endif
1130 
1131 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
1132 /* Copy COUNT objects from SRC to DST. The source and destination do
1133  not overlap. */
1134 # ifndef YYCOPY
1135 # if defined __GNUC__ && 1 < __GNUC__
1136 # define YYCOPY(Dst, Src, Count) \
1137  __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
1138 # else
1139 # define YYCOPY(Dst, Src, Count) \
1140  do \
1141  { \
1142  YYSIZE_T yyi; \
1143  for (yyi = 0; yyi < (Count); yyi++) \
1144  (Dst)[yyi] = (Src)[yyi]; \
1145  } \
1146  while (YYID (0))
1147 # endif
1148 # endif
1149 #endif /* !YYCOPY_NEEDED */
1150 
1151 /* YYFINAL -- State number of the termination state. */
1152 #define YYFINAL 2
1153 /* YYLAST -- Last index in YYTABLE. */
1154 #define YYLAST 234
1155 
1156 /* YYNTOKENS -- Number of terminals. */
1157 #define YYNTOKENS 105
1158 /* YYNNTS -- Number of nonterminals. */
1159 #define YYNNTS 83
1160 /* YYNRULES -- Number of rules. */
1161 #define YYNRULES 186
1162 /* YYNRULES -- Number of states. */
1163 #define YYNSTATES 279
1164 
1165 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1166 #define YYUNDEFTOK 2
1167 #define YYMAXUTOK 353
1168 
1169 #define YYTRANSLATE(YYX) \
1170  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1171 
1172 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1173 static const yytype_uint8 yytranslate[] =
1174 {
1175  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1176  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1177  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1178  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1179  2, 2, 2, 104, 2, 2, 2, 2, 2, 2,
1180  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1181  2, 101, 2, 2, 2, 2, 2, 2, 2, 2,
1182  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1183  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184  2, 99, 2, 100, 2, 2, 2, 2, 2, 2,
1185  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1186  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1187  2, 2, 2, 102, 2, 103, 2, 2, 2, 2,
1188  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1189  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1190  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1191  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1192  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1193  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1194  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1195  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1196  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1197  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1198  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1199  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1200  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1201  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1202  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1203  25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1204  35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1205  45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1206  55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1207  65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1208  75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1209  85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1210  95, 96, 97, 98
1211 };
1212 
1213 #if YYDEBUG
1214 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1215  YYRHS. */
1216 static const yytype_uint16 yyprhs[] =
1217 {
1218  0, 0, 3, 4, 7, 10, 12, 14, 16, 18,
1219  20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1220  40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1221  60, 62, 64, 66, 68, 70, 72, 74, 76, 79,
1222  82, 87, 92, 93, 95, 99, 100, 104, 106, 108,
1223  111, 113, 117, 121, 125, 129, 133, 137, 141, 145,
1224  147, 149, 151, 153, 159, 160, 163, 165, 167, 172,
1225  173, 176, 178, 180, 182, 184, 186, 188, 190, 192,
1226  194, 196, 198, 200, 202, 204, 206, 208, 210, 212,
1227  214, 217, 220, 223, 226, 229, 231, 233, 236, 238,
1228  240, 243, 245, 247, 249, 251, 253, 255, 257, 260,
1229  263, 266, 269, 274, 277, 280, 284, 289, 293, 298,
1230  302, 307, 311, 316, 321, 326, 329, 332, 334, 336,
1231  338, 341, 346, 348, 350, 352, 355, 358, 360, 362,
1232  364, 366, 368, 371, 373, 375, 377, 379, 381, 384,
1233  387, 390, 393, 396, 399, 405, 409, 410, 412, 414,
1234  416, 418, 422, 426, 428, 430, 433, 436, 440, 444,
1235  445, 447, 450, 453, 456, 461, 467, 469, 470, 472,
1236  476, 479, 481, 483, 485, 488, 490
1237 };
1238 
1239 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1240 static const yytype_int16 yyrhs[] =
1241 {
1242  106, 0, -1, -1, 106, 1, -1, 106, 107, -1,
1243  110, -1, 115, -1, 123, -1, 126, -1, 150, -1,
1244  151, -1, 152, -1, 153, -1, 155, -1, 157, -1,
1245  158, -1, 161, -1, 163, -1, 164, -1, 165, -1,
1246  166, -1, 167, -1, 168, -1, 169, -1, 172, -1,
1247  174, -1, 175, -1, 176, -1, 177, -1, 181, -1,
1248  182, -1, 179, -1, 180, -1, 108, -1, 186, -1,
1249  11, -1, 5, -1, 111, -1, 9, 112, -1, 13,
1250  113, -1, 114, 184, 3, 109, -1, 114, 184, 122,
1251  109, -1, -1, 90, -1, 59, 116, 109, -1, -1,
1252  117, 119, 118, -1, 99, -1, 100, -1, 119, 120,
1253  -1, 120, -1, 92, 101, 5, -1, 93, 101, 5,
1254  -1, 94, 101, 5, -1, 96, 101, 5, -1, 95,
1255  101, 5, -1, 91, 101, 5, -1, 97, 101, 5,
1256  -1, 98, 101, 5, -1, 20, -1, 3, -1, 4,
1257  -1, 3, -1, 32, 20, 102, 124, 103, -1, -1,
1258  124, 125, -1, 108, -1, 111, -1, 33, 102, 127,
1259  103, -1, -1, 127, 128, -1, 108, -1, 129, -1,
1260  130, -1, 131, -1, 132, -1, 133, -1, 135, -1,
1261  137, -1, 139, -1, 140, -1, 141, -1, 142, -1,
1262  143, -1, 144, -1, 145, -1, 146, -1, 147, -1,
1263  148, -1, 149, -1, 77, 5, -1, 78, 5, -1,
1264  60, 5, -1, 61, 5, -1, 74, 134, -1, 76,
1265  -1, 75, -1, 63, 136, -1, 64, -1, 65, -1,
1266  66, 138, -1, 67, -1, 68, -1, 69, -1, 70,
1267  -1, 71, -1, 72, -1, 73, -1, 79, 5, -1,
1268  80, 160, -1, 81, 160, -1, 62, 5, -1, 82,
1269  102, 127, 103, -1, 83, 7, -1, 84, 7, -1,
1270  85, 7, 7, -1, 85, 7, 7, 7, -1, 86,
1271  7, 7, -1, 86, 7, 7, 7, -1, 87, 7,
1272  7, -1, 87, 7, 7, 7, -1, 88, 7, 7,
1273  -1, 88, 7, 7, 7, -1, 18, 3, 4, 3,
1274  -1, 19, 3, 4, 3, -1, 17, 184, -1, 34,
1275  154, -1, 35, -1, 36, -1, 37, -1, 38, 156,
1276  -1, 38, 55, 55, 3, -1, 52, -1, 53, -1,
1277  54, -1, 39, 159, -1, 40, 159, -1, 41, -1,
1278  42, -1, 43, -1, 3, -1, 4, -1, 44, 162,
1279  -1, 42, -1, 36, -1, 35, -1, 45, -1, 160,
1280  -1, 46, 160, -1, 47, 160, -1, 48, 160, -1,
1281  49, 5, -1, 50, 160, -1, 51, 160, -1, 21,
1282  121, 22, 8, 170, -1, 21, 3, 171, -1, -1,
1283  171, -1, 20, -1, 5, -1, 4, -1, 23, 173,
1284  5, -1, 23, 116, 5, -1, 20, -1, 6, -1,
1285  25, 5, -1, 26, 5, -1, 27, 178, 5, -1,
1286  28, 178, 5, -1, -1, 89, -1, 10, 5, -1,
1287  12, 5, -1, 29, 183, -1, 30, 183, 183, 183,
1288  -1, 30, 183, 183, 183, 183, -1, 7, -1, -1,
1289  185, -1, 184, 104, 185, -1, 184, 104, -1, 14,
1290  -1, 15, -1, 16, -1, 56, 187, -1, 57, -1,
1291  58, -1
1292 };
1293 
1294 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1295 static const yytype_uint16 yyrline[] =
1296 {
1297  0, 829, 829, 830, 831, 835, 836, 837, 838, 839,
1298  840, 841, 842, 843, 844, 845, 846, 847, 848, 849,
1299  850, 851, 852, 853, 854, 855, 856, 857, 858, 859,
1300  860, 861, 862, 863, 864, 868, 872, 876, 883, 884,
1301  888, 903, 918, 919, 923, 938, 939, 946, 954, 961,
1302  962, 966, 972, 978, 984, 999, 1014, 1020, 1026, 1043,
1303  1044, 1048, 1049, 1056, 1079, 1081, 1085, 1086, 1098, 1125,
1304  1127, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139,
1305  1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149,
1306  1153, 1162, 1171, 1182, 1191, 1199, 1200, 1204, 1212, 1213,
1307  1217, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1234, 1243,
1308  1253, 1261, 1270, 1279, 1287, 1295, 1302, 1313, 1320, 1331,
1309  1338, 1348, 1355, 1365, 1375, 1385, 1393, 1401, 1402, 1403,
1310  1407, 1431, 1452, 1453, 1454, 1458, 1466, 1474, 1475, 1476,
1311  1480, 1484, 1496, 1504, 1505, 1506, 1507, 1508, 1512, 1520,
1312  1528, 1536, 1544, 1552, 1560, 1594, 1612, 1613, 1617, 1618,
1313  1619, 1623, 1685, 1701, 1702, 1706, 1713, 1720, 1730, 1740,
1314  1741, 1745, 1753, 1764, 1772, 1780, 1792, 1801, 1802, 1803,
1315  1804, 1808, 1809, 1810, 1814, 1822, 1823
1316 };
1317 #endif
1318 
1319 #if YYDEBUG || YYERROR_VERBOSE || 1
1320 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1321  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1322 static const char *const yytname[] =
1323 {
1324  "$end", "error", "$undefined", "\"<number>\"", "\"<word>\"",
1325  "\"<string>\"", "\"<string (non-greedy)>\"", "\"#<hex>\"",
1326  "\"<RandR output>\"", "TOKBINDCODE", "TOKTERMINAL", "\"<comment>\"",
1327  "\"font\"", "\"bindsym\"", "\"<modifier>\"", "\"control\"", "\"shift\"",
1328  "\"floating_modifier\"", "\"floating_maximum_size\"",
1329  "\"floating_minimum_size\"", "\"<quoted string>\"", "\"workspace\"",
1330  "\"output\"", "\"assign\"", "TOKSET", "\"ipc_socket\"",
1331  "\"restart_state\"", "\"exec\"", "\"exec_always\"", "TOKSINGLECOLOR",
1332  "TOKCOLOR", "\"\\342\\206\\222\"", "\"mode\"", "\"bar\"",
1333  "\"default_orientation\"", "\"horizontal\"", "\"vertical\"", "\"auto\"",
1334  "\"workspace_layout\"", "\"new_window\"", "\"new_float\"", "\"normal\"",
1335  "\"none\"", "\"1pixel\"", "\"hide_edge_borders\"", "\"both\"",
1336  "\"focus_follows_mouse\"", "\"force_focus_wrapping\"",
1337  "\"force_xinerama\"", "\"fake_outputs\"",
1338  "\"workspace_auto_back_and_forth\"", "\"workspace_bar\"", "\"default\"",
1339  "\"stacking\"", "\"tabbed\"", "\"stack-limit\"",
1340  "\"popup_during_fullscreen\"", "\"ignore\"", "\"leave_fullscreen\"",
1341  "\"for_window\"", "\"output (bar)\"", "\"tray_output\"",
1342  "\"socket_path\"", "\"mode (bar)\"", "\"hide\"", "\"dock\"",
1343  "\"modifier (bar)\"", "\"shift (bar)\"", "\"control (bar)\"", "\"Mod1\"",
1344  "\"Mod2\"", "\"Mod3\"", "\"Mod4\"", "\"Mod5\"", "\"position\"",
1345  "\"bottom\"", "\"top\"", "\"status_command\"", "\"i3bar_command\"",
1346  "\"font (bar)\"", "\"workspace_buttons\"", "\"verbose\"", "\"colors\"",
1347  "\"background\"", "\"statusline\"", "\"focused_workspace\"",
1348  "\"active_workspace\"", "\"inactive_workspace\"", "\"urgent_workspace\"",
1349  "\"--no-startup-id\"", "\"--release\"", "\"mark\"", "\"class\"",
1350  "\"instance\"", "\"window_role\"", "\"id\"", "\"con_id\"", "\"title\"",
1351  "\"urgent\"", "'['", "']'", "'='", "'{'", "'}'", "'+'", "$accept",
1352  "lines", "line", "comment", "command", "bindline", "binding", "bindcode",
1353  "bindsym", "optional_release", "for_window", "match", "matchstart",
1354  "matchend", "criteria", "criterion", "qstring_or_number",
1355  "word_or_number", "mode", "modelines", "modeline", "bar", "barlines",
1356  "barline", "bar_status_command", "bar_i3bar_command", "bar_output",
1357  "bar_tray_output", "bar_position", "bar_position_position", "bar_mode",
1358  "bar_mode_mode", "bar_modifier", "bar_modifier_modifier", "bar_font",
1359  "bar_workspace_buttons", "bar_verbose", "bar_socket_path", "bar_colors",
1360  "bar_color_background", "bar_color_statusline",
1361  "bar_color_focused_workspace", "bar_color_active_workspace",
1362  "bar_color_inactive_workspace", "bar_color_urgent_workspace",
1363  "floating_maximum_size", "floating_minimum_size", "floating_modifier",
1364  "orientation", "direction", "workspace_layout", "layout_mode",
1365  "new_window", "new_float", "border_style", "bool", "hide_edge_borders",
1366  "edge_hiding_mode", "focus_follows_mouse", "force_focus_wrapping",
1367  "force_xinerama", "fake_outputs", "workspace_back_and_forth",
1368  "workspace_bar", "workspace", "optional_workspace_name",
1369  "workspace_name", "assign", "window_class", "ipcsocket", "restart_state",
1370  "exec", "exec_always", "optional_no_startup_id", "terminal", "font",
1371  "single_color", "color", "colorpixel", "binding_modifiers",
1372  "binding_modifier", "popup_during_fullscreen", "popup_setting", YY_NULL
1373 };
1374 #endif
1375 
1376 # ifdef YYPRINT
1377 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1378  token YYLEX-NUM. */
1379 static const yytype_uint16 yytoknum[] =
1380 {
1381  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1382  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1383  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1384  285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1385  295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1386  305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1387  315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1388  325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1389  335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1390  345, 346, 347, 348, 349, 350, 351, 352, 353, 91,
1391  93, 61, 123, 125, 43
1392 };
1393 # endif
1394 
1395 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1396 static const yytype_uint8 yyr1[] =
1397 {
1398  0, 105, 106, 106, 106, 107, 107, 107, 107, 107,
1399  107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
1400  107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
1401  107, 107, 107, 107, 107, 108, 109, 110, 111, 111,
1402  112, 113, 114, 114, 115, 116, 116, 117, 118, 119,
1403  119, 120, 120, 120, 120, 120, 120, 120, 120, 121,
1404  121, 122, 122, 123, 124, 124, 125, 125, 126, 127,
1405  127, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1406  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1407  129, 130, 131, 132, 133, 134, 134, 135, 136, 136,
1408  137, 138, 138, 138, 138, 138, 138, 138, 139, 140,
1409  141, 142, 143, 144, 145, 146, 146, 147, 147, 148,
1410  148, 149, 149, 150, 151, 152, 153, 154, 154, 154,
1411  155, 155, 156, 156, 156, 157, 158, 159, 159, 159,
1412  160, 160, 161, 162, 162, 162, 162, 162, 163, 164,
1413  165, 166, 167, 168, 169, 169, 170, 170, 171, 171,
1414  171, 172, 172, 173, 173, 174, 175, 176, 177, 178,
1415  178, 179, 180, 181, 182, 182, 183, 184, 184, 184,
1416  184, 185, 185, 185, 186, 187, 187
1417 };
1418 
1419 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1420 static const yytype_uint8 yyr2[] =
1421 {
1422  0, 2, 0, 2, 2, 1, 1, 1, 1, 1,
1423  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1424  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1425  1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
1426  4, 4, 0, 1, 3, 0, 3, 1, 1, 2,
1427  1, 3, 3, 3, 3, 3, 3, 3, 3, 1,
1428  1, 1, 1, 5, 0, 2, 1, 1, 4, 0,
1429  2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1430  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1431  2, 2, 2, 2, 2, 1, 1, 2, 1, 1,
1432  2, 1, 1, 1, 1, 1, 1, 1, 2, 2,
1433  2, 2, 4, 2, 2, 3, 4, 3, 4, 3,
1434  4, 3, 4, 4, 4, 2, 2, 1, 1, 1,
1435  2, 4, 1, 1, 1, 2, 2, 1, 1, 1,
1436  1, 1, 2, 1, 1, 1, 1, 1, 2, 2,
1437  2, 2, 2, 2, 5, 3, 0, 1, 1, 1,
1438  1, 3, 3, 1, 1, 2, 2, 3, 3, 0,
1439  1, 2, 2, 2, 4, 5, 1, 0, 1, 3,
1440  2, 1, 1, 1, 2, 1, 1
1441 };
1442 
1443 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
1444  Performed when YYTABLE doesn't specify something else to do. Zero
1445  means the default is an error. */
1446 static const yytype_uint8 yydefact[] =
1447 {
1448  2, 0, 1, 3, 42, 0, 35, 0, 42, 177,
1449  0, 0, 0, 45, 0, 0, 169, 169, 0, 0,
1450  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1451  0, 0, 0, 0, 45, 4, 33, 5, 37, 6,
1452  7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1453  17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1454  27, 28, 31, 32, 29, 30, 34, 43, 38, 177,
1455  171, 172, 39, 177, 181, 182, 183, 125, 178, 0,
1456  0, 60, 59, 0, 164, 163, 47, 0, 0, 0,
1457  165, 166, 170, 0, 0, 176, 173, 0, 0, 69,
1458  127, 128, 129, 126, 132, 133, 134, 0, 130, 137,
1459  138, 139, 135, 136, 140, 141, 145, 144, 143, 146,
1460  147, 142, 148, 149, 150, 151, 152, 153, 185, 186,
1461  184, 0, 0, 0, 180, 0, 0, 160, 159, 158,
1462  155, 0, 162, 0, 0, 0, 0, 0, 0, 0,
1463  0, 0, 50, 161, 167, 168, 0, 64, 0, 0,
1464  36, 44, 0, 62, 61, 0, 179, 123, 124, 156,
1465  0, 0, 0, 0, 0, 0, 0, 0, 48, 46,
1466  49, 174, 0, 0, 0, 0, 0, 0, 0, 0,
1467  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1468  0, 68, 71, 70, 72, 73, 74, 75, 76, 77,
1469  78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1470  88, 89, 131, 40, 41, 154, 157, 56, 51, 52,
1471  53, 55, 54, 57, 58, 175, 63, 66, 67, 65,
1472  92, 93, 111, 98, 99, 97, 101, 102, 103, 104,
1473  105, 106, 107, 100, 96, 95, 94, 90, 91, 108,
1474  109, 110, 69, 113, 114, 0, 0, 0, 0, 0,
1475  115, 117, 119, 121, 112, 116, 118, 120, 122
1476 };
1477 
1478 /* YYDEFGOTO[NTERM-NUM]. */
1479 static const yytype_int16 yydefgoto[] =
1480 {
1481  -1, 1, 35, 202, 161, 37, 38, 68, 72, 69,
1482  39, 87, 88, 179, 151, 152, 83, 165, 40, 182,
1483  239, 41, 158, 203, 204, 205, 206, 207, 208, 256,
1484  209, 245, 210, 253, 211, 212, 213, 214, 215, 216,
1485  217, 218, 219, 220, 221, 42, 43, 44, 45, 103,
1486  46, 108, 47, 48, 112, 120, 49, 121, 50, 51,
1487  52, 53, 54, 55, 56, 225, 140, 57, 89, 58,
1488  59, 60, 61, 93, 62, 63, 64, 65, 96, 77,
1489  78, 66, 130
1490 };
1491 
1492 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1493  STATE-NUM. */
1494 #define YYPACT_NINF -140
1495 static const yytype_int16 yypact[] =
1496 {
1497  -140, 161, -140, -140, -77, 20, -140, 22, -77, 46,
1498  48, 60, 8, 4, 63, 74, -9, -9, 77, 77,
1499  79, -4, 30, 0, 35, 35, 14, 44, 44, 44,
1500  95, 44, 44, 16, 2, -140, -140, -140, -140, -140,
1501  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1502  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1503  -140, -140, -140, -140, -140, -140, -140, -140, -140, 46,
1504  -140, -140, -140, 46, -140, -140, -140, -2, -140, 100,
1505  103, 17, -140, 86, -140, -140, -140, 105, -52, 106,
1506  -140, -140, -140, 112, 113, -140, -140, 77, 18, -140,
1507  -140, -140, -140, -140, -140, -140, -140, 66, -140, -140,
1508  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1509  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1510  -140, 117, 1, 5, 46, 120, 121, -140, -140, -140,
1511  -140, 118, -140, 24, 27, 28, 41, 42, 51, 52,
1512  54, -62, -140, -140, -140, -140, 77, -140, 9, 151,
1513  -140, -140, 117, -140, -140, 117, -140, -140, -140, 17,
1514  152, 153, 154, 155, 158, 159, 160, 163, -140, -140,
1515  -140, 77, 3, 170, 171, 172, -7, 78, 6, 178,
1516  180, 187, 44, 44, 94, 190, 191, 195, 196, 197,
1517  199, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1518  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1519  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1520  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1521  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1522  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1523  -140, -140, -140, -140, -140, 206, 207, 208, 209, 53,
1524  211, 212, 214, 215, -140, -140, -140, -140, -140
1525 };
1526 
1527 /* YYPGOTO[NTERM-NUM]. */
1528 static const yytype_int16 yypgoto[] =
1529 {
1530  -140, -140, -140, -1, -139, -140, 43, -140, -140, 216,
1531  -140, 189, -140, -140, -140, 75, -140, -140, -140, -140,
1532  -140, -140, -35, -140, -140, -140, -140, -140, -140, -140,
1533  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1534  -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
1535  -140, -140, -140, -140, 203, -26, -140, -140, -140, -140,
1536  -140, -140, -140, -140, -140, -140, 61, -140, -140, -140,
1537  -140, -140, -140, 217, -140, -140, -140, -140, -12, -54,
1538  97, -140, -140
1539 };
1540 
1541 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1542  positive, shift that token. If negative, reduce the rule which
1543  number is the opposite. If YYTABLE_NINF, syntax error. */
1544 #define YYTABLE_NINF -1
1545 static const yytype_uint16 yytable[] =
1546 {
1547  36, 122, 123, 124, 162, 126, 127, 97, 163, 164,
1548  84, 81, 4, 67, 6, 132, 8, 114, 115, 133,
1549  6, 137, 138, 223, 85, 70, 224, 71, 82, 143,
1550  144, 145, 146, 147, 148, 149, 150, 139, 178, 143,
1551  144, 145, 146, 147, 148, 149, 150, 114, 115, 116,
1552  117, 79, 104, 105, 106, 107, 118, 243, 244, 119,
1553  74, 75, 76, 80, 6, 100, 101, 102, 90, 183,
1554  184, 185, 186, 128, 129, 187, 109, 110, 111, 91,
1555  92, 254, 255, 188, 95, 156, 189, 190, 191, 192,
1556  193, 194, 195, 196, 197, 198, 199, 200, 99, 98,
1557  125, 86, 134, 86, 135, 134, 236, 136, 141, 134,
1558  142, 153, 201, 183, 184, 185, 186, 154, 155, 187,
1559  157, 159, 160, 167, 168, 170, 169, 188, 171, 172,
1560  189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
1561  199, 200, 173, 174, 181, 246, 247, 248, 249, 250,
1562  251, 252, 175, 176, 222, 177, 274, 227, 228, 229,
1563  230, 2, 3, 231, 232, 233, 260, 261, 234, 235,
1564  4, 5, 6, 7, 8, 240, 241, 242, 9, 10,
1565  11, 237, 12, 257, 13, 258, 14, 15, 16, 17,
1566  18, 19, 259, 20, 21, 22, 262, 263, 264, 23,
1567  24, 25, 265, 266, 267, 26, 268, 27, 28, 29,
1568  30, 31, 32, 270, 271, 272, 273, 33, 275, 276,
1569  34, 277, 278, 131, 73, 238, 180, 269, 113, 0,
1570  226, 166, 0, 0, 94
1571 };
1572 
1573 #define yypact_value_is_default(yystate) \
1574  ((yystate) == (-140))
1575 
1576 #define yytable_value_is_error(yytable_value) \
1577  YYID (0)
1578 
1579 static const yytype_int16 yycheck[] =
1580 {
1581  1, 27, 28, 29, 3, 31, 32, 19, 3, 4,
1582  6, 3, 9, 90, 11, 69, 13, 3, 4, 73,
1583  11, 4, 5, 162, 20, 5, 165, 5, 20, 91,
1584  92, 93, 94, 95, 96, 97, 98, 20, 100, 91,
1585  92, 93, 94, 95, 96, 97, 98, 3, 4, 35,
1586  36, 3, 52, 53, 54, 55, 42, 64, 65, 45,
1587  14, 15, 16, 3, 11, 35, 36, 37, 5, 60,
1588  61, 62, 63, 57, 58, 66, 41, 42, 43, 5,
1589  89, 75, 76, 74, 7, 97, 77, 78, 79, 80,
1590  81, 82, 83, 84, 85, 86, 87, 88, 102, 20,
1591  5, 99, 104, 99, 4, 104, 103, 4, 22, 104,
1592  5, 5, 103, 60, 61, 62, 63, 5, 5, 66,
1593  102, 55, 5, 3, 3, 101, 8, 74, 101, 101,
1594  77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1595  87, 88, 101, 101, 156, 67, 68, 69, 70, 71,
1596  72, 73, 101, 101, 3, 101, 103, 5, 5, 5,
1597  5, 0, 1, 5, 5, 5, 192, 193, 5, 181,
1598  9, 10, 11, 12, 13, 5, 5, 5, 17, 18,
1599  19, 182, 21, 5, 23, 5, 25, 26, 27, 28,
1600  29, 30, 5, 32, 33, 34, 102, 7, 7, 38,
1601  39, 40, 7, 7, 7, 44, 7, 46, 47, 48,
1602  49, 50, 51, 7, 7, 7, 7, 56, 7, 7,
1603  59, 7, 7, 34, 8, 182, 151, 262, 25, -1,
1604  169, 134, -1, -1, 17
1605 };
1606 
1607 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1608  symbol of state STATE-NUM. */
1609 static const yytype_uint8 yystos[] =
1610 {
1611  0, 106, 0, 1, 9, 10, 11, 12, 13, 17,
1612  18, 19, 21, 23, 25, 26, 27, 28, 29, 30,
1613  32, 33, 34, 38, 39, 40, 44, 46, 47, 48,
1614  49, 50, 51, 56, 59, 107, 108, 110, 111, 115,
1615  123, 126, 150, 151, 152, 153, 155, 157, 158, 161,
1616  163, 164, 165, 166, 167, 168, 169, 172, 174, 175,
1617  176, 177, 179, 180, 181, 182, 186, 90, 112, 114,
1618  5, 5, 113, 114, 14, 15, 16, 184, 185, 3,
1619  3, 3, 20, 121, 6, 20, 99, 116, 117, 173,
1620  5, 5, 89, 178, 178, 7, 183, 183, 20, 102,
1621  35, 36, 37, 154, 52, 53, 54, 55, 156, 41,
1622  42, 43, 159, 159, 3, 4, 35, 36, 42, 45,
1623  160, 162, 160, 160, 160, 5, 160, 160, 57, 58,
1624  187, 116, 184, 184, 104, 4, 4, 4, 5, 20,
1625  171, 22, 5, 91, 92, 93, 94, 95, 96, 97,
1626  98, 119, 120, 5, 5, 5, 183, 102, 127, 55,
1627  5, 109, 3, 3, 4, 122, 185, 3, 3, 8,
1628  101, 101, 101, 101, 101, 101, 101, 101, 100, 118,
1629  120, 183, 124, 60, 61, 62, 63, 66, 74, 77,
1630  78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1631  88, 103, 108, 128, 129, 130, 131, 132, 133, 135,
1632  137, 139, 140, 141, 142, 143, 144, 145, 146, 147,
1633  148, 149, 3, 109, 109, 170, 171, 5, 5, 5,
1634  5, 5, 5, 5, 5, 183, 103, 108, 111, 125,
1635  5, 5, 5, 64, 65, 136, 67, 68, 69, 70,
1636  71, 72, 73, 138, 75, 76, 134, 5, 5, 5,
1637  160, 160, 102, 7, 7, 7, 7, 7, 7, 127,
1638  7, 7, 7, 7, 103, 7, 7, 7, 7
1639 };
1640 
1641 #define yyerrok (yyerrstatus = 0)
1642 #define yyclearin (yychar = YYEMPTY)
1643 #define YYEMPTY (-2)
1644 #define YYEOF 0
1645 
1646 #define YYACCEPT goto yyacceptlab
1647 #define YYABORT goto yyabortlab
1648 #define YYERROR goto yyerrorlab
1649 
1650 
1651 /* Like YYERROR except do call yyerror. This remains here temporarily
1652  to ease the transition to the new meaning of YYERROR, for GCC.
1653  Once GCC version 2 has supplanted version 1, this can go. However,
1654  YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1655  in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1656  discussed. */
1657 
1658 #define YYFAIL goto yyerrlab
1659 #if defined YYFAIL
1660  /* This is here to suppress warnings from the GCC cpp's
1661  -Wunused-macros. Normally we don't worry about that warning, but
1662  some users do, and we want to make it easy for users to remove
1663  YYFAIL uses, which will produce warnings from Bison 2.5. */
1664 #endif
1665 
1666 #define YYRECOVERING() (!!yyerrstatus)
1667 
1668 #define YYBACKUP(Token, Value) \
1669 do \
1670  if (yychar == YYEMPTY) \
1671  { \
1672  yychar = (Token); \
1673  yylval = (Value); \
1674  YYPOPSTACK (yylen); \
1675  yystate = *yyssp; \
1676  goto yybackup; \
1677  } \
1678  else \
1679  { \
1680  yyerror (YY_("syntax error: cannot back up")); \
1681  YYERROR; \
1682  } \
1683 while (YYID (0))
1684 
1685 
1686 #define YYTERROR 1
1687 #define YYERRCODE 256
1688 
1689 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1690  If N is 0, then set CURRENT to the empty location which ends
1691  the previous symbol: RHS[0] (always defined). */
1692 
1693 #ifndef YYLLOC_DEFAULT
1694 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1695  do \
1696  if (YYID (N)) \
1697  { \
1698  (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1699  (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1700  (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1701  (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1702  } \
1703  else \
1704  { \
1705  (Current).first_line = (Current).last_line = \
1706  YYRHSLOC (Rhs, 0).last_line; \
1707  (Current).first_column = (Current).last_column = \
1708  YYRHSLOC (Rhs, 0).last_column; \
1709  } \
1710  while (YYID (0))
1711 #endif
1712 
1713 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1714 
1715 
1716 
1717 /* This macro is provided for backward compatibility. */
1718 
1719 #ifndef YY_LOCATION_PRINT
1720 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1721 #endif
1722 
1723 
1724 /* YYLEX -- calling `yylex' with the right arguments. */
1725 
1726 #ifdef YYLEX_PARAM
1727 # define YYLEX yylex (YYLEX_PARAM)
1728 #else
1729 # define YYLEX yylex (context)
1730 #endif
1731 
1732 /* Enable debugging if requested. */
1733 #if YYDEBUG
1734 
1735 # ifndef YYFPRINTF
1736 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1737 # define YYFPRINTF fprintf
1738 # endif
1739 
1740 # define YYDPRINTF(Args) \
1741 do { \
1742  if (yydebug) \
1743  YYFPRINTF Args; \
1744 } while (YYID (0))
1745 
1746 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1747 do { \
1748  if (yydebug) \
1749  { \
1750  YYFPRINTF (stderr, "%s ", Title); \
1751  yy_symbol_print (stderr, \
1752  Type, Value); \
1753  YYFPRINTF (stderr, "\n"); \
1754  } \
1755 } while (YYID (0))
1756 
1757 
1758 /*--------------------------------.
1759 | Print this symbol on YYOUTPUT. |
1760 `--------------------------------*/
1761 
1762 /*ARGSUSED*/
1763 #if (defined __STDC__ || defined __C99__FUNC__ \
1764  || defined __cplusplus || defined _MSC_VER)
1765 static void
1766 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1767 #else
1768 static void
1769 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1770  FILE *yyoutput;
1771  int yytype;
1772  YYSTYPE const * const yyvaluep;
1773 #endif
1774 {
1775  FILE *yyo = yyoutput;
1776  YYUSE (yyo);
1777  if (!yyvaluep)
1778  return;
1779 # ifdef YYPRINT
1780  if (yytype < YYNTOKENS)
1781  YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1782 # else
1783  YYUSE (yyoutput);
1784 # endif
1785  switch (yytype)
1786  {
1787  default:
1788  break;
1789  }
1790 }
1791 
1792 
1793 /*--------------------------------.
1794 | Print this symbol on YYOUTPUT. |
1795 `--------------------------------*/
1796 
1797 #if (defined __STDC__ || defined __C99__FUNC__ \
1798  || defined __cplusplus || defined _MSC_VER)
1799 static void
1800 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1801 #else
1802 static void
1803 yy_symbol_print (yyoutput, yytype, yyvaluep)
1804  FILE *yyoutput;
1805  int yytype;
1806  YYSTYPE const * const yyvaluep;
1807 #endif
1808 {
1809  if (yytype < YYNTOKENS)
1810  YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1811  else
1812  YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1813 
1814  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1815  YYFPRINTF (yyoutput, ")");
1816 }
1817 
1818 /*------------------------------------------------------------------.
1819 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1820 | TOP (included). |
1821 `------------------------------------------------------------------*/
1822 
1823 #if (defined __STDC__ || defined __C99__FUNC__ \
1824  || defined __cplusplus || defined _MSC_VER)
1825 static void
1826 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1827 #else
1828 static void
1829 yy_stack_print (yybottom, yytop)
1830  yytype_int16 *yybottom;
1831  yytype_int16 *yytop;
1832 #endif
1833 {
1834  YYFPRINTF (stderr, "Stack now");
1835  for (; yybottom <= yytop; yybottom++)
1836  {
1837  int yybot = *yybottom;
1838  YYFPRINTF (stderr, " %d", yybot);
1839  }
1840  YYFPRINTF (stderr, "\n");
1841 }
1842 
1843 # define YY_STACK_PRINT(Bottom, Top) \
1844 do { \
1845  if (yydebug) \
1846  yy_stack_print ((Bottom), (Top)); \
1847 } while (YYID (0))
1848 
1849 
1850 /*------------------------------------------------.
1851 | Report that the YYRULE is going to be reduced. |
1852 `------------------------------------------------*/
1853 
1854 #if (defined __STDC__ || defined __C99__FUNC__ \
1855  || defined __cplusplus || defined _MSC_VER)
1856 static void
1857 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1858 #else
1859 static void
1860 yy_reduce_print (yyvsp, yyrule)
1861  YYSTYPE *yyvsp;
1862  int yyrule;
1863 #endif
1864 {
1865  int yynrhs = yyr2[yyrule];
1866  int yyi;
1867  unsigned long int yylno = yyrline[yyrule];
1868  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1869  yyrule - 1, yylno);
1870  /* The symbols being reduced. */
1871  for (yyi = 0; yyi < yynrhs; yyi++)
1872  {
1873  YYFPRINTF (stderr, " $%d = ", yyi + 1);
1874  yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1875  &(yyvsp[(yyi + 1) - (yynrhs)])
1876  );
1877  YYFPRINTF (stderr, "\n");
1878  }
1879 }
1880 
1881 # define YY_REDUCE_PRINT(Rule) \
1882 do { \
1883  if (yydebug) \
1884  yy_reduce_print (yyvsp, Rule); \
1885 } while (YYID (0))
1886 
1887 /* Nonzero means print parse trace. It is left uninitialized so that
1888  multiple parsers can coexist. */
1890 #else /* !YYDEBUG */
1891 # define YYDPRINTF(Args)
1892 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1893 # define YY_STACK_PRINT(Bottom, Top)
1894 # define YY_REDUCE_PRINT(Rule)
1895 #endif /* !YYDEBUG */
1896 
1897 
1898 /* YYINITDEPTH -- initial size of the parser's stacks. */
1899 #ifndef YYINITDEPTH
1900 # define YYINITDEPTH 200
1901 #endif
1902 
1903 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1904  if the built-in stack extension method is used).
1905 
1906  Do not make this value too large; the results are undefined if
1907  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1908  evaluated with infinite-precision integer arithmetic. */
1909 
1910 #ifndef YYMAXDEPTH
1911 # define YYMAXDEPTH 10000
1912 #endif
1913 
1914 
1915 #if YYERROR_VERBOSE
1916 
1917 # ifndef yystrlen
1918 # if defined __GLIBC__ && defined _STRING_H
1919 # define yystrlen strlen
1920 # else
1921 /* Return the length of YYSTR. */
1922 #if (defined __STDC__ || defined __C99__FUNC__ \
1923  || defined __cplusplus || defined _MSC_VER)
1924 static YYSIZE_T
1925 yystrlen (const char *yystr)
1926 #else
1927 static YYSIZE_T
1928 yystrlen (yystr)
1929  const char *yystr;
1930 #endif
1931 {
1932  YYSIZE_T yylen;
1933  for (yylen = 0; yystr[yylen]; yylen++)
1934  continue;
1935  return yylen;
1936 }
1937 # endif
1938 # endif
1939 
1940 # ifndef yystpcpy
1941 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1942 # define yystpcpy stpcpy
1943 # else
1944 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1945  YYDEST. */
1946 #if (defined __STDC__ || defined __C99__FUNC__ \
1947  || defined __cplusplus || defined _MSC_VER)
1948 static char *
1949 yystpcpy (char *yydest, const char *yysrc)
1950 #else
1951 static char *
1952 yystpcpy (yydest, yysrc)
1953  char *yydest;
1954  const char *yysrc;
1955 #endif
1956 {
1957  char *yyd = yydest;
1958  const char *yys = yysrc;
1959 
1960  while ((*yyd++ = *yys++) != '\0')
1961  continue;
1962 
1963  return yyd - 1;
1964 }
1965 # endif
1966 # endif
1967 
1968 # ifndef yytnamerr
1969 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1970  quotes and backslashes, so that it's suitable for yyerror. The
1971  heuristic is that double-quoting is unnecessary unless the string
1972  contains an apostrophe, a comma, or backslash (other than
1973  backslash-backslash). YYSTR is taken from yytname. If YYRES is
1974  null, do not copy; instead, return the length of what the result
1975  would have been. */
1976 static YYSIZE_T
1977 yytnamerr (char *yyres, const char *yystr)
1978 {
1979  if (*yystr == '"')
1980  {
1981  YYSIZE_T yyn = 0;
1982  char const *yyp = yystr;
1983 
1984  for (;;)
1985  switch (*++yyp)
1986  {
1987  case '\'':
1988  case ',':
1989  goto do_not_strip_quotes;
1990 
1991  case '\\':
1992  if (*++yyp != '\\')
1993  goto do_not_strip_quotes;
1994  /* Fall through. */
1995  default:
1996  if (yyres)
1997  yyres[yyn] = *yyp;
1998  yyn++;
1999  break;
2000 
2001  case '"':
2002  if (yyres)
2003  yyres[yyn] = '\0';
2004  return yyn;
2005  }
2006  do_not_strip_quotes: ;
2007  }
2008 
2009  if (! yyres)
2010  return yystrlen (yystr);
2011 
2012  return yystpcpy (yyres, yystr) - yyres;
2013 }
2014 # endif
2015 
2016 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
2017  about the unexpected token YYTOKEN for the state stack whose top is
2018  YYSSP.
2019 
2020  Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
2021  not large enough to hold the message. In that case, also set
2022  *YYMSG_ALLOC to the required number of bytes. Return 2 if the
2023  required number of bytes is too large to store. */
2024 static int
2025 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2026  yytype_int16 *yyssp, int yytoken)
2027 {
2028  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
2029  YYSIZE_T yysize = yysize0;
2030  YYSIZE_T yysize1;
2031  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2032  /* Internationalized format string. */
2033  const char *yyformat = YY_NULL;
2034  /* Arguments of yyformat. */
2035  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2036  /* Number of reported tokens (one for the "unexpected", one per
2037  "expected"). */
2038  int yycount = 0;
2039 
2040  /* There are many possibilities here to consider:
2041  - Assume YYFAIL is not used. It's too flawed to consider. See
2042  <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
2043  for details. YYERROR is fine as it does not invoke this
2044  function.
2045  - If this state is a consistent state with a default action, then
2046  the only way this function was invoked is if the default action
2047  is an error action. In that case, don't check for expected
2048  tokens because there are none.
2049  - The only way there can be no lookahead present (in yychar) is if
2050  this state is a consistent state with a default action. Thus,
2051  detecting the absence of a lookahead is sufficient to determine
2052  that there is no unexpected or expected token to report. In that
2053  case, just report a simple "syntax error".
2054  - Don't assume there isn't a lookahead just because this state is a
2055  consistent state with a default action. There might have been a
2056  previous inconsistent state, consistent state with a non-default
2057  action, or user semantic action that manipulated yychar.
2058  - Of course, the expected token list depends on states to have
2059  correct lookahead information, and it depends on the parser not
2060  to perform extra reductions after fetching a lookahead from the
2061  scanner and before detecting a syntax error. Thus, state merging
2062  (from LALR or IELR) and default reductions corrupt the expected
2063  token list. However, the list is correct for canonical LR with
2064  one exception: it will still contain any token that will not be
2065  accepted due to an error action in a later state.
2066  */
2067  if (yytoken != YYEMPTY)
2068  {
2069  int yyn = yypact[*yyssp];
2070  yyarg[yycount++] = yytname[yytoken];
2071  if (!yypact_value_is_default (yyn))
2072  {
2073  /* Start YYX at -YYN if negative to avoid negative indexes in
2074  YYCHECK. In other words, skip the first -YYN actions for
2075  this state because they are default actions. */
2076  int yyxbegin = yyn < 0 ? -yyn : 0;
2077  /* Stay within bounds of both yycheck and yytname. */
2078  int yychecklim = YYLAST - yyn + 1;
2079  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2080  int yyx;
2081 
2082  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2083  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
2084  && !yytable_value_is_error (yytable[yyx + yyn]))
2085  {
2086  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2087  {
2088  yycount = 1;
2089  yysize = yysize0;
2090  break;
2091  }
2092  yyarg[yycount++] = yytname[yyx];
2093  yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
2094  if (! (yysize <= yysize1
2095  && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
2096  return 2;
2097  yysize = yysize1;
2098  }
2099  }
2100  }
2101 
2102  switch (yycount)
2103  {
2104 # define YYCASE_(N, S) \
2105  case N: \
2106  yyformat = S; \
2107  break
2108  YYCASE_(0, YY_("syntax error"));
2109  YYCASE_(1, YY_("syntax error, unexpected %s"));
2110  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
2111  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
2112  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
2113  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
2114 # undef YYCASE_
2115  }
2116 
2117  yysize1 = yysize + yystrlen (yyformat);
2118  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
2119  return 2;
2120  yysize = yysize1;
2121 
2122  if (*yymsg_alloc < yysize)
2123  {
2124  *yymsg_alloc = 2 * yysize;
2125  if (! (yysize <= *yymsg_alloc
2126  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
2127  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
2128  return 1;
2129  }
2130 
2131  /* Avoid sprintf, as that infringes on the user's name space.
2132  Don't have undefined behavior even if the translation
2133  produced a string with the wrong number of "%s"s. */
2134  {
2135  char *yyp = *yymsg;
2136  int yyi = 0;
2137  while ((*yyp = *yyformat) != '\0')
2138  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
2139  {
2140  yyp += yytnamerr (yyp, yyarg[yyi++]);
2141  yyformat += 2;
2142  }
2143  else
2144  {
2145  yyp++;
2146  yyformat++;
2147  }
2148  }
2149  return 0;
2150 }
2151 #endif /* YYERROR_VERBOSE */
2152 
2153 /*-----------------------------------------------.
2154 | Release the memory associated to this symbol. |
2155 `-----------------------------------------------*/
2156 
2157 /*ARGSUSED*/
2158 #if (defined __STDC__ || defined __C99__FUNC__ \
2159  || defined __cplusplus || defined _MSC_VER)
2160 static void
2161 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2162 #else
2163 static void
2164 yydestruct (yymsg, yytype, yyvaluep)
2165  const char *yymsg;
2166  int yytype;
2167  YYSTYPE *yyvaluep;
2168 #endif
2169 {
2170  YYUSE (yyvaluep);
2171 
2172  if (!yymsg)
2173  yymsg = "Deleting";
2174  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2175 
2176  switch (yytype)
2177  {
2178 
2179  default:
2180  break;
2181  }
2182 }
2183 
2184 
2185 
2186 
2187 /* The lookahead symbol. */
2189 
2190 /* The semantic value of the lookahead symbol. */
2192 
2193 /* Number of syntax errors so far. */
2195 
2196 
2197 /*----------.
2198 | yyparse. |
2199 `----------*/
2200 
2201 #ifdef YYPARSE_PARAM
2202 #if (defined __STDC__ || defined __C99__FUNC__ \
2203  || defined __cplusplus || defined _MSC_VER)
2204 int
2205 yyparse (void *YYPARSE_PARAM)
2206 #else
2207 int
2208 yyparse (YYPARSE_PARAM)
2209  void *YYPARSE_PARAM;
2210 #endif
2211 #else /* ! YYPARSE_PARAM */
2212 #if (defined __STDC__ || defined __C99__FUNC__ \
2213  || defined __cplusplus || defined _MSC_VER)
2214 int
2215 yyparse (void)
2216 #else
2217 int
2219 
2220 #endif
2221 #endif
2222 {
2223  int yystate;
2224  /* Number of tokens to shift before error messages enabled. */
2225  int yyerrstatus;
2226 
2227  /* The stacks and their tools:
2228  `yyss': related to states.
2229  `yyvs': related to semantic values.
2230 
2231  Refer to the stacks through separate pointers, to allow yyoverflow
2232  to reallocate them elsewhere. */
2233 
2234  /* The state stack. */
2235  yytype_int16 yyssa[YYINITDEPTH];
2236  yytype_int16 *yyss;
2237  yytype_int16 *yyssp;
2238 
2239  /* The semantic value stack. */
2240  YYSTYPE yyvsa[YYINITDEPTH];
2241  YYSTYPE *yyvs;
2242  YYSTYPE *yyvsp;
2243 
2244  YYSIZE_T yystacksize;
2245 
2246  int yyn;
2247  int yyresult;
2248  /* Lookahead token as an internal (translated) token number. */
2249  int yytoken;
2250  /* The variables used to return semantic value and location from the
2251  action routines. */
2252  YYSTYPE yyval;
2253 
2254 #if YYERROR_VERBOSE
2255  /* Buffer for error messages, and its allocated size. */
2256  char yymsgbuf[128];
2257  char *yymsg = yymsgbuf;
2258  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2259 #endif
2260 
2261 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
2262 
2263  /* The number of symbols on the RHS of the reduced rule.
2264  Keep to zero when no symbol should be popped. */
2265  int yylen = 0;
2266 
2267  yytoken = 0;
2268  yyss = yyssa;
2269  yyvs = yyvsa;
2270  yystacksize = YYINITDEPTH;
2271 
2272  YYDPRINTF ((stderr, "Starting parse\n"));
2273 
2274  yystate = 0;
2275  yyerrstatus = 0;
2276  yynerrs = 0;
2277  yychar = YYEMPTY; /* Cause a token to be read. */
2278 
2279  /* Initialize stack pointers.
2280  Waste one element of value and location stack
2281  so that they stay on the same level as the state stack.
2282  The wasted elements are never initialized. */
2283  yyssp = yyss;
2284  yyvsp = yyvs;
2285  goto yysetstate;
2286 
2287 /*------------------------------------------------------------.
2288 | yynewstate -- Push a new state, which is found in yystate. |
2289 `------------------------------------------------------------*/
2290  yynewstate:
2291  /* In all cases, when you get here, the value and location stacks
2292  have just been pushed. So pushing a state here evens the stacks. */
2293  yyssp++;
2294 
2295  yysetstate:
2296  *yyssp = yystate;
2297 
2298  if (yyss + yystacksize - 1 <= yyssp)
2299  {
2300  /* Get the current used size of the three stacks, in elements. */
2301  YYSIZE_T yysize = yyssp - yyss + 1;
2302 
2303 #ifdef yyoverflow
2304  {
2305  /* Give user a chance to reallocate the stack. Use copies of
2306  these so that the &'s don't force the real ones into
2307  memory. */
2308  YYSTYPE *yyvs1 = yyvs;
2309  yytype_int16 *yyss1 = yyss;
2310 
2311  /* Each stack pointer address is followed by the size of the
2312  data in use in that stack, in bytes. This used to be a
2313  conditional around just the two extra args, but that might
2314  be undefined if yyoverflow is a macro. */
2315  yyoverflow (YY_("memory exhausted"),
2316  &yyss1, yysize * sizeof (*yyssp),
2317  &yyvs1, yysize * sizeof (*yyvsp),
2318  &yystacksize);
2319 
2320  yyss = yyss1;
2321  yyvs = yyvs1;
2322  }
2323 #else /* no yyoverflow */
2324 # ifndef YYSTACK_RELOCATE
2325  goto yyexhaustedlab;
2326 # else
2327  /* Extend the stack our own way. */
2328  if (YYMAXDEPTH <= yystacksize)
2329  goto yyexhaustedlab;
2330  yystacksize *= 2;
2331  if (YYMAXDEPTH < yystacksize)
2332  yystacksize = YYMAXDEPTH;
2333 
2334  {
2335  yytype_int16 *yyss1 = yyss;
2336  union yyalloc *yyptr =
2337  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2338  if (! yyptr)
2339  goto yyexhaustedlab;
2340  YYSTACK_RELOCATE (yyss_alloc, yyss);
2341  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2342 # undef YYSTACK_RELOCATE
2343  if (yyss1 != yyssa)
2344  YYSTACK_FREE (yyss1);
2345  }
2346 # endif
2347 #endif /* no yyoverflow */
2348 
2349  yyssp = yyss + yysize - 1;
2350  yyvsp = yyvs + yysize - 1;
2351 
2352  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2353  (unsigned long int) yystacksize));
2354 
2355  if (yyss + yystacksize - 1 <= yyssp)
2356  YYABORT;
2357  }
2358 
2359  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2360 
2361  if (yystate == YYFINAL)
2362  YYACCEPT;
2363 
2364  goto yybackup;
2365 
2366 /*-----------.
2367 | yybackup. |
2368 `-----------*/
2369 yybackup:
2370 
2371  /* Do appropriate processing given the current state. Read a
2372  lookahead token if we need one and don't already have one. */
2373 
2374  /* First try to decide what to do without reference to lookahead token. */
2375  yyn = yypact[yystate];
2376  if (yypact_value_is_default (yyn))
2377  goto yydefault;
2378 
2379  /* Not known => get a lookahead token if don't already have one. */
2380 
2381  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2382  if (yychar == YYEMPTY)
2383  {
2384  YYDPRINTF ((stderr, "Reading a token: "));
2385  yychar = YYLEX;
2386  }
2387 
2388  if (yychar <= YYEOF)
2389  {
2390  yychar = yytoken = YYEOF;
2391  YYDPRINTF ((stderr, "Now at end of input.\n"));
2392  }
2393  else
2394  {
2395  yytoken = YYTRANSLATE (yychar);
2396  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2397  }
2398 
2399  /* If the proper action on seeing token YYTOKEN is to reduce or to
2400  detect an error, take that action. */
2401  yyn += yytoken;
2402  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2403  goto yydefault;
2404  yyn = yytable[yyn];
2405  if (yyn <= 0)
2406  {
2407  if (yytable_value_is_error (yyn))
2408  goto yyerrlab;
2409  yyn = -yyn;
2410  goto yyreduce;
2411  }
2412 
2413  /* Count tokens shifted since error; after three, turn off error
2414  status. */
2415  if (yyerrstatus)
2416  yyerrstatus--;
2417 
2418  /* Shift the lookahead token. */
2419  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2420 
2421  /* Discard the shifted token. */
2422  yychar = YYEMPTY;
2423 
2424  yystate = yyn;
2425  *++yyvsp = yylval;
2426 
2427  goto yynewstate;
2428 
2429 
2430 /*-----------------------------------------------------------.
2431 | yydefault -- do the default action for the current state. |
2432 `-----------------------------------------------------------*/
2433 yydefault:
2434  yyn = yydefact[yystate];
2435  if (yyn == 0)
2436  goto yyerrlab;
2437  goto yyreduce;
2438 
2439 
2440 /*-----------------------------.
2441 | yyreduce -- Do a reduction. |
2442 `-----------------------------*/
2443 yyreduce:
2444  /* yyn is the number of a rule to reduce with. */
2445  yylen = yyr2[yyn];
2446 
2447  /* If YYLEN is nonzero, implement the default value of the action:
2448  `$$ = $1'.
2449 
2450  Otherwise, the following line sets YYVAL to garbage.
2451  This behavior is undocumented and Bison
2452  users should not rely upon it. Assigning to YYVAL
2453  unconditionally makes the parser a bit smaller, and it avoids a
2454  GCC warning that YYVAL may be used uninitialized. */
2455  yyval = yyvsp[1-yylen];
2456 
2457 
2458  YY_REDUCE_PRINT (yyn);
2459  switch (yyn)
2460  {
2461  case 37:
2462 /* Line 1787 of yacc.c */
2463 #line 877 "../i3-4.3/src/cfgparse.y"
2464  {
2465  TAILQ_INSERT_TAIL(bindings, (yyvsp[(1) - (1)].binding), bindings);
2466  }
2467  break;
2468 
2469  case 38:
2470 /* Line 1787 of yacc.c */
2471 #line 883 "../i3-4.3/src/cfgparse.y"
2472  { (yyval.binding) = (yyvsp[(2) - (2)].binding); }
2473  break;
2474 
2475  case 39:
2476 /* Line 1787 of yacc.c */
2477 #line 884 "../i3-4.3/src/cfgparse.y"
2478  { (yyval.binding) = (yyvsp[(2) - (2)].binding); }
2479  break;
2480 
2481  case 40:
2482 /* Line 1787 of yacc.c */
2483 #line 889 "../i3-4.3/src/cfgparse.y"
2484  {
2485  DLOG("bindcode: release = %d, mod = %d, key = %d, command = %s\n", (yyvsp[(1) - (4)].number), (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].string));
2486  Binding *new = scalloc(sizeof(Binding));
2487 
2488  new->release = (yyvsp[(1) - (4)].number);
2489  new->keycode = (yyvsp[(3) - (4)].number);
2490  new->mods = (yyvsp[(2) - (4)].number);
2491  new->command = (yyvsp[(4) - (4)].string);
2492 
2493  (yyval.binding) = new;
2494  }
2495  break;
2496 
2497  case 41:
2498 /* Line 1787 of yacc.c */
2499 #line 904 "../i3-4.3/src/cfgparse.y"
2500  {
2501  DLOG("bindsym: release = %d, mod = %d, key = %s, command = %s\n", (yyvsp[(1) - (4)].number), (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].string));
2502  Binding *new = scalloc(sizeof(Binding));
2503 
2504  new->release = (yyvsp[(1) - (4)].number);
2505  new->symbol = (yyvsp[(3) - (4)].string);
2506  new->mods = (yyvsp[(2) - (4)].number);
2507  new->command = (yyvsp[(4) - (4)].string);
2508 
2509  (yyval.binding) = new;
2510  }
2511  break;
2512 
2513  case 42:
2514 /* Line 1787 of yacc.c */
2515 #line 918 "../i3-4.3/src/cfgparse.y"
2516  { (yyval.number) = B_UPON_KEYPRESS; }
2517  break;
2518 
2519  case 43:
2520 /* Line 1787 of yacc.c */
2521 #line 919 "../i3-4.3/src/cfgparse.y"
2522  { (yyval.number) = B_UPON_KEYRELEASE; }
2523  break;
2524 
2525  case 44:
2526 /* Line 1787 of yacc.c */
2527 #line 924 "../i3-4.3/src/cfgparse.y"
2528  {
2529  if (match_is_empty(&current_match)) {
2530  ELOG("Match is empty, ignoring this for_window statement\n");
2531  break;
2532  }
2533  printf("\t should execute command %s for the criteria mentioned above\n", (yyvsp[(3) - (3)].string));
2534  Assignment *assignment = scalloc(sizeof(Assignment));
2535  assignment->type = A_COMMAND;
2536  assignment->match = current_match;
2537  assignment->dest.command = (yyvsp[(3) - (3)].string);
2538  TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
2539  }
2540  break;
2541 
2542  case 46:
2543 /* Line 1787 of yacc.c */
2544 #line 940 "../i3-4.3/src/cfgparse.y"
2545  {
2546  printf("match parsed\n");
2547  }
2548  break;
2549 
2550  case 47:
2551 /* Line 1787 of yacc.c */
2552 #line 947 "../i3-4.3/src/cfgparse.y"
2553  {
2554  printf("start\n");
2555  match_init(&current_match);
2556  }
2557  break;
2558 
2559  case 48:
2560 /* Line 1787 of yacc.c */
2561 #line 955 "../i3-4.3/src/cfgparse.y"
2562  {
2563  printf("match specification finished\n");
2564  }
2565  break;
2566 
2567  case 51:
2568 /* Line 1787 of yacc.c */
2569 #line 967 "../i3-4.3/src/cfgparse.y"
2570  {
2571  printf("criteria: class = %s\n", (yyvsp[(3) - (3)].string));
2572  current_match.class = regex_new((yyvsp[(3) - (3)].string));
2573  free((yyvsp[(3) - (3)].string));
2574  }
2575  break;
2576 
2577  case 52:
2578 /* Line 1787 of yacc.c */
2579 #line 973 "../i3-4.3/src/cfgparse.y"
2580  {
2581  printf("criteria: instance = %s\n", (yyvsp[(3) - (3)].string));
2582  current_match.instance = regex_new((yyvsp[(3) - (3)].string));
2583  free((yyvsp[(3) - (3)].string));
2584  }
2585  break;
2586 
2587  case 53:
2588 /* Line 1787 of yacc.c */
2589 #line 979 "../i3-4.3/src/cfgparse.y"
2590  {
2591  printf("criteria: window_role = %s\n", (yyvsp[(3) - (3)].string));
2592  current_match.role = regex_new((yyvsp[(3) - (3)].string));
2593  free((yyvsp[(3) - (3)].string));
2594  }
2595  break;
2596 
2597  case 54:
2598 /* Line 1787 of yacc.c */
2599 #line 985 "../i3-4.3/src/cfgparse.y"
2600  {
2601  printf("criteria: id = %s\n", (yyvsp[(3) - (3)].string));
2602  char *end;
2603  long parsed = strtol((yyvsp[(3) - (3)].string), &end, 10);
2604  if (parsed == LONG_MIN ||
2605  parsed == LONG_MAX ||
2606  parsed < 0 ||
2607  (end && *end != '\0')) {
2608  ELOG("Could not parse con id \"%s\"\n", (yyvsp[(3) - (3)].string));
2609  } else {
2610  current_match.con_id = (Con*)parsed;
2611  printf("id as int = %p\n", current_match.con_id);
2612  }
2613  }
2614  break;
2615 
2616  case 55:
2617 /* Line 1787 of yacc.c */
2618 #line 1000 "../i3-4.3/src/cfgparse.y"
2619  {
2620  printf("criteria: window id = %s\n", (yyvsp[(3) - (3)].string));
2621  char *end;
2622  long parsed = strtol((yyvsp[(3) - (3)].string), &end, 10);
2623  if (parsed == LONG_MIN ||
2624  parsed == LONG_MAX ||
2625  parsed < 0 ||
2626  (end && *end != '\0')) {
2627  ELOG("Could not parse window id \"%s\"\n", (yyvsp[(3) - (3)].string));
2628  } else {
2629  current_match.id = parsed;
2630  printf("window id as int = %d\n", current_match.id);
2631  }
2632  }
2633  break;
2634 
2635  case 56:
2636 /* Line 1787 of yacc.c */
2637 #line 1015 "../i3-4.3/src/cfgparse.y"
2638  {
2639  printf("criteria: mark = %s\n", (yyvsp[(3) - (3)].string));
2640  current_match.mark = regex_new((yyvsp[(3) - (3)].string));
2641  free((yyvsp[(3) - (3)].string));
2642  }
2643  break;
2644 
2645  case 57:
2646 /* Line 1787 of yacc.c */
2647 #line 1021 "../i3-4.3/src/cfgparse.y"
2648  {
2649  printf("criteria: title = %s\n", (yyvsp[(3) - (3)].string));
2650  current_match.title = regex_new((yyvsp[(3) - (3)].string));
2651  free((yyvsp[(3) - (3)].string));
2652  }
2653  break;
2654 
2655  case 58:
2656 /* Line 1787 of yacc.c */
2657 #line 1027 "../i3-4.3/src/cfgparse.y"
2658  {
2659  printf("criteria: urgent = %s\n", (yyvsp[(3) - (3)].string));
2660  if (strcasecmp((yyvsp[(3) - (3)].string), "latest") == 0 ||
2661  strcasecmp((yyvsp[(3) - (3)].string), "newest") == 0 ||
2662  strcasecmp((yyvsp[(3) - (3)].string), "recent") == 0 ||
2663  strcasecmp((yyvsp[(3) - (3)].string), "last") == 0) {
2664  current_match.urgent = U_LATEST;
2665  } else if (strcasecmp((yyvsp[(3) - (3)].string), "oldest") == 0 ||
2666  strcasecmp((yyvsp[(3) - (3)].string), "first") == 0) {
2667  current_match.urgent = U_OLDEST;
2668  }
2669  free((yyvsp[(3) - (3)].string));
2670  }
2671  break;
2672 
2673  case 60:
2674 /* Line 1787 of yacc.c */
2675 #line 1044 "../i3-4.3/src/cfgparse.y"
2676  { sasprintf(&(yyval.string), "%d", (yyvsp[(1) - (1)].number)); }
2677  break;
2678 
2679  case 62:
2680 /* Line 1787 of yacc.c */
2681 #line 1050 "../i3-4.3/src/cfgparse.y"
2682  {
2683  sasprintf(&(yyval.string), "%d", (yyvsp[(1) - (1)].number));
2684  }
2685  break;
2686 
2687  case 63:
2688 /* Line 1787 of yacc.c */
2689 #line 1057 "../i3-4.3/src/cfgparse.y"
2690  {
2691  if (strcasecmp((yyvsp[(2) - (5)].string), "default") == 0) {
2692  printf("You cannot use the name \"default\" for your mode\n");
2693  exit(1);
2694  }
2695  printf("\t now in mode %s\n", (yyvsp[(2) - (5)].string));
2696  printf("\t current bindings = %p\n", current_bindings);
2697  Binding *binding;
2699  printf("got binding on mods %d, keycode %d, symbol %s, command %s\n",
2700  binding->mods, binding->keycode, binding->symbol, binding->command);
2701  }
2702 
2703  struct Mode *mode = scalloc(sizeof(struct Mode));
2704  mode->name = (yyvsp[(2) - (5)].string);
2705  mode->bindings = current_bindings;
2706  current_bindings = NULL;
2707  SLIST_INSERT_HEAD(&modes, mode, modes);
2708  }
2709  break;
2710 
2711  case 67:
2712 /* Line 1787 of yacc.c */
2713 #line 1087 "../i3-4.3/src/cfgparse.y"
2714  {
2715  if (current_bindings == NULL) {
2716  current_bindings = scalloc(sizeof(struct bindings_head));
2718  }
2719 
2720  TAILQ_INSERT_TAIL(current_bindings, (yyvsp[(1) - (1)].binding), bindings);
2721  }
2722  break;
2723 
2724  case 68:
2725 /* Line 1787 of yacc.c */
2726 #line 1099 "../i3-4.3/src/cfgparse.y"
2727  {
2728  printf("\t new bar configuration finished, saving.\n");
2729  /* Generate a unique ID for this bar */
2730  current_bar.id = sstrdup("bar-XXXXXX");
2731  /* This works similar to mktemp in that it replaces the last six X with
2732  * random letters, but without the restriction that the given buffer
2733  * has to contain a valid path name. */
2734  char *x = current_bar.id + strlen("bar-");
2735  while (*x != '\0') {
2736  *(x++) = (rand() % 26) + 'a';
2737  }
2738 
2739  /* If no font was explicitly set, we use the i3 font as default */
2740  if (!current_bar.font && font_pattern)
2741  current_bar.font = sstrdup(font_pattern);
2742 
2743  /* Copy the current (static) structure into a dynamically allocated
2744  * one, then cleanup our static one. */
2745  Barconfig *bar_config = scalloc(sizeof(Barconfig));
2746  memcpy(bar_config, &current_bar, sizeof(Barconfig));
2747  TAILQ_INSERT_TAIL(&barconfigs, bar_config, configs);
2748 
2749  memset(&current_bar, '\0', sizeof(Barconfig));
2750  }
2751  break;
2752 
2753  case 90:
2754 /* Line 1787 of yacc.c */
2755 #line 1154 "../i3-4.3/src/cfgparse.y"
2756  {
2757  DLOG("should add status command %s\n", (yyvsp[(2) - (2)].string));
2758  FREE(current_bar.status_command);
2759  current_bar.status_command = (yyvsp[(2) - (2)].string);
2760  }
2761  break;
2762 
2763  case 91:
2764 /* Line 1787 of yacc.c */
2765 #line 1163 "../i3-4.3/src/cfgparse.y"
2766  {
2767  DLOG("should add i3bar_command %s\n", (yyvsp[(2) - (2)].string));
2768  FREE(current_bar.i3bar_command);
2769  current_bar.i3bar_command = (yyvsp[(2) - (2)].string);
2770  }
2771  break;
2772 
2773  case 92:
2774 /* Line 1787 of yacc.c */
2775 #line 1172 "../i3-4.3/src/cfgparse.y"
2776  {
2777  DLOG("bar output %s\n", (yyvsp[(2) - (2)].string));
2778  int new_outputs = current_bar.num_outputs + 1;
2779  current_bar.outputs = srealloc(current_bar.outputs, sizeof(char*) * new_outputs);
2780  current_bar.outputs[current_bar.num_outputs] = (yyvsp[(2) - (2)].string);
2781  current_bar.num_outputs = new_outputs;
2782  }
2783  break;
2784 
2785  case 93:
2786 /* Line 1787 of yacc.c */
2787 #line 1183 "../i3-4.3/src/cfgparse.y"
2788  {
2789  DLOG("tray %s\n", (yyvsp[(2) - (2)].string));
2790  FREE(current_bar.tray_output);
2791  current_bar.tray_output = (yyvsp[(2) - (2)].string);
2792  }
2793  break;
2794 
2795  case 94:
2796 /* Line 1787 of yacc.c */
2797 #line 1192 "../i3-4.3/src/cfgparse.y"
2798  {
2799  DLOG("position %d\n", (yyvsp[(2) - (2)].number));
2800  current_bar.position = (yyvsp[(2) - (2)].number);
2801  }
2802  break;
2803 
2804  case 95:
2805 /* Line 1787 of yacc.c */
2806 #line 1199 "../i3-4.3/src/cfgparse.y"
2807  { (yyval.number) = P_TOP; }
2808  break;
2809 
2810  case 96:
2811 /* Line 1787 of yacc.c */
2812 #line 1200 "../i3-4.3/src/cfgparse.y"
2813  { (yyval.number) = P_BOTTOM; }
2814  break;
2815 
2816  case 97:
2817 /* Line 1787 of yacc.c */
2818 #line 1205 "../i3-4.3/src/cfgparse.y"
2819  {
2820  DLOG("mode %d\n", (yyvsp[(2) - (2)].number));
2821  current_bar.mode = (yyvsp[(2) - (2)].number);
2822  }
2823  break;
2824 
2825  case 98:
2826 /* Line 1787 of yacc.c */
2827 #line 1212 "../i3-4.3/src/cfgparse.y"
2828  { (yyval.number) = M_HIDE; }
2829  break;
2830 
2831  case 99:
2832 /* Line 1787 of yacc.c */
2833 #line 1213 "../i3-4.3/src/cfgparse.y"
2834  { (yyval.number) = M_DOCK; }
2835  break;
2836 
2837  case 100:
2838 /* Line 1787 of yacc.c */
2839 #line 1218 "../i3-4.3/src/cfgparse.y"
2840  {
2841  DLOG("modifier %d\n", (yyvsp[(2) - (2)].number));
2842  current_bar.modifier = (yyvsp[(2) - (2)].number);
2843  }
2844  break;
2845 
2846  case 101:
2847 /* Line 1787 of yacc.c */
2848 #line 1224 "../i3-4.3/src/cfgparse.y"
2849  { (yyval.number) = M_CONTROL; }
2850  break;
2851 
2852  case 102:
2853 /* Line 1787 of yacc.c */
2854 #line 1225 "../i3-4.3/src/cfgparse.y"
2855  { (yyval.number) = M_SHIFT; }
2856  break;
2857 
2858  case 103:
2859 /* Line 1787 of yacc.c */
2860 #line 1226 "../i3-4.3/src/cfgparse.y"
2861  { (yyval.number) = M_MOD1; }
2862  break;
2863 
2864  case 104:
2865 /* Line 1787 of yacc.c */
2866 #line 1227 "../i3-4.3/src/cfgparse.y"
2867  { (yyval.number) = M_MOD2; }
2868  break;
2869 
2870  case 105:
2871 /* Line 1787 of yacc.c */
2872 #line 1228 "../i3-4.3/src/cfgparse.y"
2873  { (yyval.number) = M_MOD3; }
2874  break;
2875 
2876  case 106:
2877 /* Line 1787 of yacc.c */
2878 #line 1229 "../i3-4.3/src/cfgparse.y"
2879  { (yyval.number) = M_MOD4; }
2880  break;
2881 
2882  case 107:
2883 /* Line 1787 of yacc.c */
2884 #line 1230 "../i3-4.3/src/cfgparse.y"
2885  { (yyval.number) = M_MOD5; }
2886  break;
2887 
2888  case 108:
2889 /* Line 1787 of yacc.c */
2890 #line 1235 "../i3-4.3/src/cfgparse.y"
2891  {
2892  DLOG("font %s\n", (yyvsp[(2) - (2)].string));
2893  FREE(current_bar.font);
2894  current_bar.font = (yyvsp[(2) - (2)].string);
2895  }
2896  break;
2897 
2898  case 109:
2899 /* Line 1787 of yacc.c */
2900 #line 1244 "../i3-4.3/src/cfgparse.y"
2901  {
2902  DLOG("workspace_buttons = %d\n", (yyvsp[(2) - (2)].number));
2903  /* We store this inverted to make the default setting right when
2904  * initializing the struct with zero. */
2905  current_bar.hide_workspace_buttons = !((yyvsp[(2) - (2)].number));
2906  }
2907  break;
2908 
2909  case 110:
2910 /* Line 1787 of yacc.c */
2911 #line 1254 "../i3-4.3/src/cfgparse.y"
2912  {
2913  DLOG("verbose = %d\n", (yyvsp[(2) - (2)].number));
2914  current_bar.verbose = (yyvsp[(2) - (2)].number);
2915  }
2916  break;
2917 
2918  case 111:
2919 /* Line 1787 of yacc.c */
2920 #line 1262 "../i3-4.3/src/cfgparse.y"
2921  {
2922  DLOG("socket_path = %s\n", (yyvsp[(2) - (2)].string));
2923  FREE(current_bar.socket_path);
2924  current_bar.socket_path = (yyvsp[(2) - (2)].string);
2925  }
2926  break;
2927 
2928  case 112:
2929 /* Line 1787 of yacc.c */
2930 #line 1271 "../i3-4.3/src/cfgparse.y"
2931  {
2932  /* At the moment, the TOK_BAR_COLORS token is only to make the config
2933  * friendlier for humans. We might change this in the future if it gets
2934  * more complex. */
2935  }
2936  break;
2937 
2938  case 113:
2939 /* Line 1787 of yacc.c */
2940 #line 1280 "../i3-4.3/src/cfgparse.y"
2941  {
2942  DLOG("background = %s\n", (yyvsp[(2) - (2)].string));
2943  current_bar.colors.background = (yyvsp[(2) - (2)].string);
2944  }
2945  break;
2946 
2947  case 114:
2948 /* Line 1787 of yacc.c */
2949 #line 1288 "../i3-4.3/src/cfgparse.y"
2950  {
2951  DLOG("statusline = %s\n", (yyvsp[(2) - (2)].string));
2952  current_bar.colors.statusline = (yyvsp[(2) - (2)].string);
2953  }
2954  break;
2955 
2956  case 115:
2957 /* Line 1787 of yacc.c */
2958 #line 1296 "../i3-4.3/src/cfgparse.y"
2959  {
2960  /* Old syntax: text / background */
2961  DLOG("focused_ws = %s, %s (old)\n", (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].string));
2962  current_bar.colors.focused_workspace_bg = (yyvsp[(3) - (3)].string);
2963  current_bar.colors.focused_workspace_text = (yyvsp[(2) - (3)].string);
2964  }
2965  break;
2966 
2967  case 116:
2968 /* Line 1787 of yacc.c */
2969 #line 1303 "../i3-4.3/src/cfgparse.y"
2970  {
2971  /* New syntax: border / background / text */
2972  DLOG("focused_ws = %s, %s and %s\n", (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].string));
2973  current_bar.colors.focused_workspace_border = (yyvsp[(2) - (4)].string);
2974  current_bar.colors.focused_workspace_bg = (yyvsp[(3) - (4)].string);
2975  current_bar.colors.focused_workspace_text = (yyvsp[(4) - (4)].string);
2976  }
2977  break;
2978 
2979  case 117:
2980 /* Line 1787 of yacc.c */
2981 #line 1314 "../i3-4.3/src/cfgparse.y"
2982  {
2983  /* Old syntax: text / background */
2984  DLOG("active_ws = %s, %s (old)\n", (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].string));
2985  current_bar.colors.active_workspace_bg = (yyvsp[(3) - (3)].string);
2986  current_bar.colors.active_workspace_text = (yyvsp[(2) - (3)].string);
2987  }
2988  break;
2989 
2990  case 118:
2991 /* Line 1787 of yacc.c */
2992 #line 1321 "../i3-4.3/src/cfgparse.y"
2993  {
2994  /* New syntax: border / background / text */
2995  DLOG("active_ws = %s, %s and %s\n", (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].string));
2996  current_bar.colors.active_workspace_border = (yyvsp[(2) - (4)].string);
2997  current_bar.colors.active_workspace_bg = (yyvsp[(3) - (4)].string);
2998  current_bar.colors.active_workspace_text = (yyvsp[(4) - (4)].string);
2999  }
3000  break;
3001 
3002  case 119:
3003 /* Line 1787 of yacc.c */
3004 #line 1332 "../i3-4.3/src/cfgparse.y"
3005  {
3006  /* Old syntax: text / background */
3007  DLOG("inactive_ws = %s, %s (old)\n", (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].string));
3008  current_bar.colors.inactive_workspace_bg = (yyvsp[(3) - (3)].string);
3009  current_bar.colors.inactive_workspace_text = (yyvsp[(2) - (3)].string);
3010  }
3011  break;
3012 
3013  case 120:
3014 /* Line 1787 of yacc.c */
3015 #line 1339 "../i3-4.3/src/cfgparse.y"
3016  {
3017  DLOG("inactive_ws = %s, %s and %s\n", (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].string));
3018  current_bar.colors.inactive_workspace_border = (yyvsp[(2) - (4)].string);
3019  current_bar.colors.inactive_workspace_bg = (yyvsp[(3) - (4)].string);
3020  current_bar.colors.inactive_workspace_text = (yyvsp[(4) - (4)].string);
3021  }
3022  break;
3023 
3024  case 121:
3025 /* Line 1787 of yacc.c */
3026 #line 1349 "../i3-4.3/src/cfgparse.y"
3027  {
3028  /* Old syntax: text / background */
3029  DLOG("urgent_ws = %s, %s (old)\n", (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].string));
3030  current_bar.colors.urgent_workspace_bg = (yyvsp[(3) - (3)].string);
3031  current_bar.colors.urgent_workspace_text = (yyvsp[(2) - (3)].string);
3032  }
3033  break;
3034 
3035  case 122:
3036 /* Line 1787 of yacc.c */
3037 #line 1356 "../i3-4.3/src/cfgparse.y"
3038  {
3039  DLOG("urgent_ws = %s, %s and %s\n", (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].string));
3040  current_bar.colors.urgent_workspace_border = (yyvsp[(2) - (4)].string);
3041  current_bar.colors.urgent_workspace_bg = (yyvsp[(3) - (4)].string);
3042  current_bar.colors.urgent_workspace_text = (yyvsp[(4) - (4)].string);
3043  }
3044  break;
3045 
3046  case 123:
3047 /* Line 1787 of yacc.c */
3048 #line 1366 "../i3-4.3/src/cfgparse.y"
3049  {
3050  printf("floating_maximum_width = %d\n", (yyvsp[(2) - (4)].number));
3051  printf("floating_maximum_height = %d\n", (yyvsp[(4) - (4)].number));
3052  config.floating_maximum_width = (yyvsp[(2) - (4)].number);
3053  config.floating_maximum_height = (yyvsp[(4) - (4)].number);
3054  }
3055  break;
3056 
3057  case 124:
3058 /* Line 1787 of yacc.c */
3059 #line 1376 "../i3-4.3/src/cfgparse.y"
3060  {
3061  printf("floating_minimum_width = %d\n", (yyvsp[(2) - (4)].number));
3062  printf("floating_minimum_height = %d\n", (yyvsp[(4) - (4)].number));
3063  config.floating_minimum_width = (yyvsp[(2) - (4)].number);
3064  config.floating_minimum_height = (yyvsp[(4) - (4)].number);
3065  }
3066  break;
3067 
3068  case 125:
3069 /* Line 1787 of yacc.c */
3070 #line 1386 "../i3-4.3/src/cfgparse.y"
3071  {
3072  DLOG("floating modifier = %d\n", (yyvsp[(2) - (2)].number));
3073  config.floating_modifier = (yyvsp[(2) - (2)].number);
3074  }
3075  break;
3076 
3077  case 126:
3078 /* Line 1787 of yacc.c */
3079 #line 1394 "../i3-4.3/src/cfgparse.y"
3080  {
3081  DLOG("New containers should start with split direction %d\n", (yyvsp[(2) - (2)].number));
3082  config.default_orientation = (yyvsp[(2) - (2)].number);
3083  }
3084  break;
3085 
3086  case 127:
3087 /* Line 1787 of yacc.c */
3088 #line 1401 "../i3-4.3/src/cfgparse.y"
3089  { (yyval.number) = HORIZ; }
3090  break;
3091 
3092  case 128:
3093 /* Line 1787 of yacc.c */
3094 #line 1402 "../i3-4.3/src/cfgparse.y"
3095  { (yyval.number) = VERT; }
3096  break;
3097 
3098  case 129:
3099 /* Line 1787 of yacc.c */
3100 #line 1403 "../i3-4.3/src/cfgparse.y"
3101  { (yyval.number) = NO_ORIENTATION; }
3102  break;
3103 
3104  case 130:
3105 /* Line 1787 of yacc.c */
3106 #line 1408 "../i3-4.3/src/cfgparse.y"
3107  {
3108  DLOG("new containers will be in mode %d\n", (yyvsp[(2) - (2)].number));
3109  config.default_layout = (yyvsp[(2) - (2)].number);
3110 
3111 #if 0
3112  /* We also need to change the layout of the already existing
3113  * workspaces here. Workspaces may exist at this point because
3114  * of the other directives which are modifying workspaces
3115  * (setting the preferred screen or name). While the workspace
3116  * objects are already created, they have never been used.
3117  * Thus, the user very likely awaits the default container mode
3118  * to trigger in this case, regardless of where it is inside
3119  * his configuration file. */
3120  Workspace *ws;
3121  TAILQ_FOREACH(ws, workspaces, workspaces) {
3122  if (ws->table == NULL)
3123  continue;
3124  switch_layout_mode(global_conn,
3125  ws->table[0][0],
3126  config.container_mode);
3127  }
3128 #endif
3129  }
3130  break;
3131 
3132  case 131:
3133 /* Line 1787 of yacc.c */
3134 #line 1432 "../i3-4.3/src/cfgparse.y"
3135  {
3136  DLOG("stack-limit %d with val %d\n", (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].number));
3137  config.container_stack_limit = (yyvsp[(3) - (4)].number);
3138  config.container_stack_limit_value = (yyvsp[(4) - (4)].number);
3139 
3140 #if 0
3141  /* See the comment above */
3142  Workspace *ws;
3143  TAILQ_FOREACH(ws, workspaces, workspaces) {
3144  if (ws->table == NULL)
3145  continue;
3146  Container *con = ws->table[0][0];
3147  con->stack_limit = config.container_stack_limit;
3148  con->stack_limit_value = config.container_stack_limit_value;
3149  }
3150 #endif
3151  }
3152  break;
3153 
3154  case 132:
3155 /* Line 1787 of yacc.c */
3156 #line 1452 "../i3-4.3/src/cfgparse.y"
3157  { (yyval.number) = L_DEFAULT; }
3158  break;
3159 
3160  case 133:
3161 /* Line 1787 of yacc.c */
3162 #line 1453 "../i3-4.3/src/cfgparse.y"
3163  { (yyval.number) = L_STACKED; }
3164  break;
3165 
3166  case 134:
3167 /* Line 1787 of yacc.c */
3168 #line 1454 "../i3-4.3/src/cfgparse.y"
3169  { (yyval.number) = L_TABBED; }
3170  break;
3171 
3172  case 135:
3173 /* Line 1787 of yacc.c */
3174 #line 1459 "../i3-4.3/src/cfgparse.y"
3175  {
3176  DLOG("new windows should start with border style %d\n", (yyvsp[(2) - (2)].number));
3177  config.default_border = (yyvsp[(2) - (2)].number);
3178  }
3179  break;
3180 
3181  case 136:
3182 /* Line 1787 of yacc.c */
3183 #line 1467 "../i3-4.3/src/cfgparse.y"
3184  {
3185  DLOG("new floating windows should start with border style %d\n", (yyvsp[(2) - (2)].number));
3186  config.default_floating_border = (yyvsp[(2) - (2)].number);
3187  }
3188  break;
3189 
3190  case 137:
3191 /* Line 1787 of yacc.c */
3192 #line 1474 "../i3-4.3/src/cfgparse.y"
3193  { (yyval.number) = BS_NORMAL; }
3194  break;
3195 
3196  case 138:
3197 /* Line 1787 of yacc.c */
3198 #line 1475 "../i3-4.3/src/cfgparse.y"
3199  { (yyval.number) = BS_NONE; }
3200  break;
3201 
3202  case 139:
3203 /* Line 1787 of yacc.c */
3204 #line 1476 "../i3-4.3/src/cfgparse.y"
3205  { (yyval.number) = BS_1PIXEL; }
3206  break;
3207 
3208  case 140:
3209 /* Line 1787 of yacc.c */
3210 #line 1481 "../i3-4.3/src/cfgparse.y"
3211  {
3212  (yyval.number) = ((yyvsp[(1) - (1)].number) == 1);
3213  }
3214  break;
3215 
3216  case 141:
3217 /* Line 1787 of yacc.c */
3218 #line 1485 "../i3-4.3/src/cfgparse.y"
3219  {
3220  DLOG("checking word \"%s\"\n", (yyvsp[(1) - (1)].string));
3221  (yyval.number) = (strcasecmp((yyvsp[(1) - (1)].string), "yes") == 0 ||
3222  strcasecmp((yyvsp[(1) - (1)].string), "true") == 0 ||
3223  strcasecmp((yyvsp[(1) - (1)].string), "on") == 0 ||
3224  strcasecmp((yyvsp[(1) - (1)].string), "enable") == 0 ||
3225  strcasecmp((yyvsp[(1) - (1)].string), "active") == 0);
3226  }
3227  break;
3228 
3229  case 142:
3230 /* Line 1787 of yacc.c */
3231 #line 1497 "../i3-4.3/src/cfgparse.y"
3232  {
3233  DLOG("hide edge borders = %d\n", (yyvsp[(2) - (2)].number));
3234  config.hide_edge_borders = (yyvsp[(2) - (2)].number);
3235  }
3236  break;
3237 
3238  case 143:
3239 /* Line 1787 of yacc.c */
3240 #line 1504 "../i3-4.3/src/cfgparse.y"
3241  { (yyval.number) = ADJ_NONE; }
3242  break;
3243 
3244  case 144:
3245 /* Line 1787 of yacc.c */
3246 #line 1505 "../i3-4.3/src/cfgparse.y"
3248  break;
3249 
3250  case 145:
3251 /* Line 1787 of yacc.c */
3252 #line 1506 "../i3-4.3/src/cfgparse.y"
3254  break;
3255 
3256  case 146:
3257 /* Line 1787 of yacc.c */
3258 #line 1507 "../i3-4.3/src/cfgparse.y"
3260  break;
3261 
3262  case 147:
3263 /* Line 1787 of yacc.c */
3264 #line 1508 "../i3-4.3/src/cfgparse.y"
3265  { (yyval.number) = ((yyvsp[(1) - (1)].number) ? ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE : ADJ_NONE); }
3266  break;
3267 
3268  case 148:
3269 /* Line 1787 of yacc.c */
3270 #line 1513 "../i3-4.3/src/cfgparse.y"
3271  {
3272  DLOG("focus follows mouse = %d\n", (yyvsp[(2) - (2)].number));
3273  config.disable_focus_follows_mouse = !((yyvsp[(2) - (2)].number));
3274  }
3275  break;
3276 
3277  case 149:
3278 /* Line 1787 of yacc.c */
3279 #line 1521 "../i3-4.3/src/cfgparse.y"
3280  {
3281  DLOG("force focus wrapping = %d\n", (yyvsp[(2) - (2)].number));
3282  config.force_focus_wrapping = (yyvsp[(2) - (2)].number);
3283  }
3284  break;
3285 
3286  case 150:
3287 /* Line 1787 of yacc.c */
3288 #line 1529 "../i3-4.3/src/cfgparse.y"
3289  {
3290  DLOG("force xinerama = %d\n", (yyvsp[(2) - (2)].number));
3291  config.force_xinerama = (yyvsp[(2) - (2)].number);
3292  }
3293  break;
3294 
3295  case 151:
3296 /* Line 1787 of yacc.c */
3297 #line 1537 "../i3-4.3/src/cfgparse.y"
3298  {
3299  DLOG("fake outputs = %s\n", (yyvsp[(2) - (2)].string));
3300  config.fake_outputs = (yyvsp[(2) - (2)].string);
3301  }
3302  break;
3303 
3304  case 152:
3305 /* Line 1787 of yacc.c */
3306 #line 1545 "../i3-4.3/src/cfgparse.y"
3307  {
3308  DLOG("automatic workspace back-and-forth = %d\n", (yyvsp[(2) - (2)].number));
3309  config.workspace_auto_back_and_forth = (yyvsp[(2) - (2)].number);
3310  }
3311  break;
3312 
3313  case 153:
3314 /* Line 1787 of yacc.c */
3315 #line 1553 "../i3-4.3/src/cfgparse.y"
3316  {
3317  DLOG("workspace bar = %d\n", (yyvsp[(2) - (2)].number));
3318  config.disable_workspace_bar = !((yyvsp[(2) - (2)].number));
3319  }
3320  break;
3321 
3322  case 154:
3323 /* Line 1787 of yacc.c */
3324 #line 1561 "../i3-4.3/src/cfgparse.y"
3325  {
3326  char *ws_name = (yyvsp[(2) - (5)].string);
3327 
3328  if ((yyvsp[(5) - (5)].string) != NULL) {
3329  ELOG("The old (v3) syntax workspace <number> output <output> <name> is deprecated.\n");
3330  ELOG("Please use the new syntax: workspace \"<workspace>\" output <output>\n");
3331  ELOG("In your case, the following should work:\n");
3332  ELOG(" workspace \"%s\" output %s\n", (yyvsp[(5) - (5)].string), (yyvsp[(4) - (5)].string));
3333  ws_name = (yyvsp[(5) - (5)].string);
3334  context->has_warnings = true;
3335  }
3336 
3337  DLOG("Assigning workspace \"%s\" to output \"%s\"\n", ws_name, (yyvsp[(4) - (5)].string));
3338  /* Check for earlier assignments of the same workspace so that we
3339  * don’t have assignments of a single workspace to different
3340  * outputs */
3341  struct Workspace_Assignment *assignment;
3342  bool duplicate = false;
3344  if (strcasecmp(assignment->name, ws_name) == 0) {
3345  ELOG("You have a duplicate workspace assignment for workspace \"%s\"\n",
3346  ws_name);
3347  assignment->output = (yyvsp[(4) - (5)].string);
3348  duplicate = true;
3349  }
3350  }
3351  if (!duplicate) {
3352  assignment = scalloc(sizeof(struct Workspace_Assignment));
3353  assignment->name = ws_name;
3354  assignment->output = (yyvsp[(4) - (5)].string);
3356  }
3357  }
3358  break;
3359 
3360  case 155:
3361 /* Line 1787 of yacc.c */
3362 #line 1595 "../i3-4.3/src/cfgparse.y"
3363  {
3364  int ws_num = (yyvsp[(2) - (3)].number);
3365  if (ws_num < 1) {
3366  DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
3367  } else {
3368  DLOG("workspace name to: %s\n", (yyvsp[(3) - (3)].string));
3369 #if 0
3370  if ((yyvsp[(3) - (3)].string) != NULL) {
3371  workspace_set_name(workspace_get(ws_num - 1), (yyvsp[(3) - (3)].string));
3372  free((yyvsp[(3) - (3)].string));
3373  }
3374 #endif
3375  }
3376  }
3377  break;
3378 
3379  case 156:
3380 /* Line 1787 of yacc.c */
3381 #line 1612 "../i3-4.3/src/cfgparse.y"
3382  { (yyval.string) = NULL; }
3383  break;
3384 
3385  case 157:
3386 /* Line 1787 of yacc.c */
3387 #line 1613 "../i3-4.3/src/cfgparse.y"
3388  { (yyval.string) = (yyvsp[(1) - (1)].string); }
3389  break;
3390 
3391  case 158:
3392 /* Line 1787 of yacc.c */
3393 #line 1617 "../i3-4.3/src/cfgparse.y"
3394  { (yyval.string) = (yyvsp[(1) - (1)].string); }
3395  break;
3396 
3397  case 159:
3398 /* Line 1787 of yacc.c */
3399 #line 1618 "../i3-4.3/src/cfgparse.y"
3400  { (yyval.string) = (yyvsp[(1) - (1)].string); }
3401  break;
3402 
3403  case 160:
3404 /* Line 1787 of yacc.c */
3405 #line 1619 "../i3-4.3/src/cfgparse.y"
3406  { (yyval.string) = (yyvsp[(1) - (1)].string); }
3407  break;
3408 
3409  case 161:
3410 /* Line 1787 of yacc.c */
3411 #line 1624 "../i3-4.3/src/cfgparse.y"
3412  {
3413  /* This is the old, deprecated form of assignments. It’s provided for
3414  * compatibility in version (4.1, 4.2, 4.3) and will be removed
3415  * afterwards. It triggers an i3-nagbar warning starting from 4.1. */
3416  ELOG("You are using the old assign syntax (without criteria). "
3417  "Please see the User's Guide for the new syntax and fix "
3418  "your config file.\n");
3419  context->has_warnings = true;
3420  printf("assignment of %s to *%s*\n", (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].string));
3421  char *workspace = (yyvsp[(3) - (3)].string);
3422  char *criteria = (yyvsp[(2) - (3)].string);
3423 
3424  Assignment *assignment = scalloc(sizeof(Assignment));
3425  Match *match = &(assignment->match);
3426  match_init(match);
3427 
3428  char *separator = NULL;
3429  if ((separator = strchr(criteria, '/')) != NULL) {
3430  *(separator++) = '\0';
3431  char *pattern;
3432  sasprintf(&pattern, "(?i)%s", separator);
3433  match->title = regex_new(pattern);
3434  free(pattern);
3435  printf(" title = %s\n", separator);
3436  }
3437  if (*criteria != '\0') {
3438  char *pattern;
3439  sasprintf(&pattern, "(?i)%s", criteria);
3440  match->class = regex_new(pattern);
3441  free(pattern);
3442  printf(" class = %s\n", criteria);
3443  }
3444  free(criteria);
3445 
3446  /* Compatibility with older versions: If the assignment target starts
3447  * with ~, we create the equivalent of:
3448  *
3449  * for_window [class="foo"] floating enable
3450  */
3451  if (*workspace == '~') {
3452  workspace++;
3453  if (*workspace == '\0') {
3454  /* This assignment was *only* for floating */
3455  assignment->type = A_COMMAND;
3456  assignment->dest.command = sstrdup("floating enable");
3457  TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
3458  break;
3459  } else {
3460  /* Create a new assignment and continue afterwards */
3461  Assignment *floating = scalloc(sizeof(Assignment));
3462  match_copy(&(floating->match), match);
3463  floating->type = A_COMMAND;
3464  floating->dest.command = sstrdup("floating enable");
3466  }
3467  }
3468 
3469  assignment->type = A_TO_WORKSPACE;
3470  assignment->dest.workspace = workspace;
3471  TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
3472  }
3473  break;
3474 
3475  case 162:
3476 /* Line 1787 of yacc.c */
3477 #line 1686 "../i3-4.3/src/cfgparse.y"
3478  {
3479  if (match_is_empty(&current_match)) {
3480  ELOG("Match is empty, ignoring this assignment\n");
3481  break;
3482  }
3483  printf("new assignment, using above criteria, to workspace %s\n", (yyvsp[(3) - (3)].string));
3484  Assignment *assignment = scalloc(sizeof(Assignment));
3485  assignment->match = current_match;
3486  assignment->type = A_TO_WORKSPACE;
3487  assignment->dest.workspace = (yyvsp[(3) - (3)].string);
3488  TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
3489  }
3490  break;
3491 
3492  case 165:
3493 /* Line 1787 of yacc.c */
3494 #line 1707 "../i3-4.3/src/cfgparse.y"
3495  {
3496  config.ipc_socket_path = (yyvsp[(2) - (2)].string);
3497  }
3498  break;
3499 
3500  case 166:
3501 /* Line 1787 of yacc.c */
3502 #line 1714 "../i3-4.3/src/cfgparse.y"
3503  {
3504  config.restart_state_path = (yyvsp[(2) - (2)].string);
3505  }
3506  break;
3507 
3508  case 167:
3509 /* Line 1787 of yacc.c */
3510 #line 1721 "../i3-4.3/src/cfgparse.y"
3511  {
3512  struct Autostart *new = smalloc(sizeof(struct Autostart));
3513  new->command = (yyvsp[(3) - (3)].string);
3514  new->no_startup_id = (yyvsp[(2) - (3)].number);
3516  }
3517  break;
3518 
3519  case 168:
3520 /* Line 1787 of yacc.c */
3521 #line 1731 "../i3-4.3/src/cfgparse.y"
3522  {
3523  struct Autostart *new = smalloc(sizeof(struct Autostart));
3524  new->command = (yyvsp[(3) - (3)].string);
3525  new->no_startup_id = (yyvsp[(2) - (3)].number);
3527  }
3528  break;
3529 
3530  case 169:
3531 /* Line 1787 of yacc.c */
3532 #line 1740 "../i3-4.3/src/cfgparse.y"
3533  { (yyval.number) = false; }
3534  break;
3535 
3536  case 170:
3537 /* Line 1787 of yacc.c */
3538 #line 1741 "../i3-4.3/src/cfgparse.y"
3539  { (yyval.number) = true; }
3540  break;
3541 
3542  case 171:
3543 /* Line 1787 of yacc.c */
3544 #line 1746 "../i3-4.3/src/cfgparse.y"
3545  {
3546  ELOG("The terminal option is DEPRECATED and has no effect. "
3547  "Please remove it from your configuration file.\n");
3548  }
3549  break;
3550 
3551  case 172:
3552 /* Line 1787 of yacc.c */
3553 #line 1754 "../i3-4.3/src/cfgparse.y"
3554  {
3555  config.font = load_font((yyvsp[(2) - (2)].string), true);
3556  set_font(&config.font);
3557  printf("font %s\n", (yyvsp[(2) - (2)].string));
3558  FREE(font_pattern);
3559  font_pattern = (yyvsp[(2) - (2)].string);
3560  }
3561  break;
3562 
3563  case 173:
3564 /* Line 1787 of yacc.c */
3565 #line 1765 "../i3-4.3/src/cfgparse.y"
3566  {
3567  uint32_t *dest = (yyvsp[(1) - (2)].single_color);
3568  *dest = (yyvsp[(2) - (2)].number);
3569  }
3570  break;
3571 
3572  case 174:
3573 /* Line 1787 of yacc.c */
3574 #line 1773 "../i3-4.3/src/cfgparse.y"
3575  {
3576  struct Colortriple *dest = (yyvsp[(1) - (4)].color);
3577 
3578  dest->border = (yyvsp[(2) - (4)].number);
3579  dest->background = (yyvsp[(3) - (4)].number);
3580  dest->text = (yyvsp[(4) - (4)].number);
3581  }
3582  break;
3583 
3584  case 175:
3585 /* Line 1787 of yacc.c */
3586 #line 1781 "../i3-4.3/src/cfgparse.y"
3587  {
3588  struct Colortriple *dest = (yyvsp[(1) - (5)].color);
3589 
3590  dest->border = (yyvsp[(2) - (5)].number);
3591  dest->background = (yyvsp[(3) - (5)].number);
3592  dest->text = (yyvsp[(4) - (5)].number);
3593  dest->indicator = (yyvsp[(5) - (5)].number);
3594  }
3595  break;
3596 
3597  case 176:
3598 /* Line 1787 of yacc.c */
3599 #line 1793 "../i3-4.3/src/cfgparse.y"
3600  {
3601  (yyval.number) = get_colorpixel((yyvsp[(1) - (1)].string));
3602  free((yyvsp[(1) - (1)].string));
3603  }
3604  break;
3605 
3606  case 177:
3607 /* Line 1787 of yacc.c */
3608 #line 1801 "../i3-4.3/src/cfgparse.y"
3609  { (yyval.number) = 0; }
3610  break;
3611 
3612  case 179:
3613 /* Line 1787 of yacc.c */
3614 #line 1803 "../i3-4.3/src/cfgparse.y"
3615  { (yyval.number) = (yyvsp[(1) - (3)].number) | (yyvsp[(3) - (3)].number); }
3616  break;
3617 
3618  case 180:
3619 /* Line 1787 of yacc.c */
3620 #line 1804 "../i3-4.3/src/cfgparse.y"
3621  { (yyval.number) = (yyvsp[(1) - (2)].number); }
3622  break;
3623 
3624  case 181:
3625 /* Line 1787 of yacc.c */
3626 #line 1808 "../i3-4.3/src/cfgparse.y"
3627  { (yyval.number) = (yyvsp[(1) - (1)].number); }
3628  break;
3629 
3630  case 182:
3631 /* Line 1787 of yacc.c */
3632 #line 1809 "../i3-4.3/src/cfgparse.y"
3633  { (yyval.number) = BIND_CONTROL; }
3634  break;
3635 
3636  case 183:
3637 /* Line 1787 of yacc.c */
3638 #line 1810 "../i3-4.3/src/cfgparse.y"
3639  { (yyval.number) = BIND_SHIFT; }
3640  break;
3641 
3642  case 184:
3643 /* Line 1787 of yacc.c */
3644 #line 1815 "../i3-4.3/src/cfgparse.y"
3645  {
3646  DLOG("popup_during_fullscreen setting: %d\n", (yyvsp[(2) - (2)].number));
3647  config.popup_during_fullscreen = (yyvsp[(2) - (2)].number);
3648  }
3649  break;
3650 
3651  case 185:
3652 /* Line 1787 of yacc.c */
3653 #line 1822 "../i3-4.3/src/cfgparse.y"
3654  { (yyval.number) = PDF_IGNORE; }
3655  break;
3656 
3657  case 186:
3658 /* Line 1787 of yacc.c */
3659 #line 1823 "../i3-4.3/src/cfgparse.y"
3660  { (yyval.number) = PDF_LEAVE_FULLSCREEN; }
3661  break;
3662 
3663 
3664 /* Line 1787 of yacc.c */
3665 #line 3666 "src/cfgparse.tab.c"
3666  default: break;
3667  }
3668  /* User semantic actions sometimes alter yychar, and that requires
3669  that yytoken be updated with the new translation. We take the
3670  approach of translating immediately before every use of yytoken.
3671  One alternative is translating here after every semantic action,
3672  but that translation would be missed if the semantic action invokes
3673  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
3674  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
3675  incorrect destructor might then be invoked immediately. In the
3676  case of YYERROR or YYBACKUP, subsequent parser actions might lead
3677  to an incorrect destructor call or verbose syntax error message
3678  before the lookahead is translated. */
3679  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
3680 
3681  YYPOPSTACK (yylen);
3682  yylen = 0;
3683  YY_STACK_PRINT (yyss, yyssp);
3684 
3685  *++yyvsp = yyval;
3686 
3687  /* Now `shift' the result of the reduction. Determine what state
3688  that goes to, based on the state we popped back to and the rule
3689  number reduced by. */
3690 
3691  yyn = yyr1[yyn];
3692 
3693  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
3694  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3695  yystate = yytable[yystate];
3696  else
3697  yystate = yydefgoto[yyn - YYNTOKENS];
3698 
3699  goto yynewstate;
3700 
3701 
3702 /*------------------------------------.
3703 | yyerrlab -- here on detecting error |
3704 `------------------------------------*/
3705 yyerrlab:
3706  /* Make sure we have latest lookahead translation. See comments at
3707  user semantic actions for why this is necessary. */
3708  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
3709 
3710  /* If not already recovering from an error, report this error. */
3711  if (!yyerrstatus)
3712  {
3713  ++yynerrs;
3714 #if ! YYERROR_VERBOSE
3715  yyerror (YY_("syntax error"));
3716 #else
3717 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3718  yyssp, yytoken)
3719  {
3720  char const *yymsgp = YY_("syntax error");
3721  int yysyntax_error_status;
3722  yysyntax_error_status = YYSYNTAX_ERROR;
3723  if (yysyntax_error_status == 0)
3724  yymsgp = yymsg;
3725  else if (yysyntax_error_status == 1)
3726  {
3727  if (yymsg != yymsgbuf)
3728  YYSTACK_FREE (yymsg);
3729  yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
3730  if (!yymsg)
3731  {
3732  yymsg = yymsgbuf;
3733  yymsg_alloc = sizeof yymsgbuf;
3734  yysyntax_error_status = 2;
3735  }
3736  else
3737  {
3738  yysyntax_error_status = YYSYNTAX_ERROR;
3739  yymsgp = yymsg;
3740  }
3741  }
3742  yyerror (yymsgp);
3743  if (yysyntax_error_status == 2)
3744  goto yyexhaustedlab;
3745  }
3746 # undef YYSYNTAX_ERROR
3747 #endif
3748  }
3749 
3750 
3751 
3752  if (yyerrstatus == 3)
3753  {
3754  /* If just tried and failed to reuse lookahead token after an
3755  error, discard it. */
3756 
3757  if (yychar <= YYEOF)
3758  {
3759  /* Return failure if at end of input. */
3760  if (yychar == YYEOF)
3761  YYABORT;
3762  }
3763  else
3764  {
3765  yydestruct ("Error: discarding",
3766  yytoken, &yylval);
3767  yychar = YYEMPTY;
3768  }
3769  }
3770 
3771  /* Else will try to reuse lookahead token after shifting the error
3772  token. */
3773  goto yyerrlab1;
3774 
3775 
3776 /*---------------------------------------------------.
3777 | yyerrorlab -- error raised explicitly by YYERROR. |
3778 `---------------------------------------------------*/
3779 yyerrorlab:
3780 
3781  /* Pacify compilers like GCC when the user code never invokes
3782  YYERROR and the label yyerrorlab therefore never appears in user
3783  code. */
3784  if (/*CONSTCOND*/ 0)
3785  goto yyerrorlab;
3786 
3787  /* Do not reclaim the symbols of the rule which action triggered
3788  this YYERROR. */
3789  YYPOPSTACK (yylen);
3790  yylen = 0;
3791  YY_STACK_PRINT (yyss, yyssp);
3792  yystate = *yyssp;
3793  goto yyerrlab1;
3794 
3795 
3796 /*-------------------------------------------------------------.
3797 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3798 `-------------------------------------------------------------*/
3799 yyerrlab1:
3800  yyerrstatus = 3; /* Each real token shifted decrements this. */
3801 
3802  for (;;)
3803  {
3804  yyn = yypact[yystate];
3805  if (!yypact_value_is_default (yyn))
3806  {
3807  yyn += YYTERROR;
3808  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3809  {
3810  yyn = yytable[yyn];
3811  if (0 < yyn)
3812  break;
3813  }
3814  }
3815 
3816  /* Pop the current state because it cannot handle the error token. */
3817  if (yyssp == yyss)
3818  YYABORT;
3819 
3820 
3821  yydestruct ("Error: popping",
3822  yystos[yystate], yyvsp);
3823  YYPOPSTACK (1);
3824  yystate = *yyssp;
3825  YY_STACK_PRINT (yyss, yyssp);
3826  }
3827 
3828  *++yyvsp = yylval;
3829 
3830 
3831  /* Shift the error token. */
3832  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3833 
3834  yystate = yyn;
3835  goto yynewstate;
3836 
3837 
3838 /*-------------------------------------.
3839 | yyacceptlab -- YYACCEPT comes here. |
3840 `-------------------------------------*/
3841 yyacceptlab:
3842  yyresult = 0;
3843  goto yyreturn;
3844 
3845 /*-----------------------------------.
3846 | yyabortlab -- YYABORT comes here. |
3847 `-----------------------------------*/
3848 yyabortlab:
3849  yyresult = 1;
3850  goto yyreturn;
3851 
3852 #if !defined yyoverflow || YYERROR_VERBOSE
3853 /*-------------------------------------------------.
3854 | yyexhaustedlab -- memory exhaustion comes here. |
3855 `-------------------------------------------------*/
3856 yyexhaustedlab:
3857  yyerror (YY_("memory exhausted"));
3858  yyresult = 2;
3859  /* Fall through. */
3860 #endif
3861 
3862 yyreturn:
3863  if (yychar != YYEMPTY)
3864  {
3865  /* Make sure we have latest lookahead translation. See comments at
3866  user semantic actions for why this is necessary. */
3867  yytoken = YYTRANSLATE (yychar);
3868  yydestruct ("Cleanup: discarding lookahead",
3869  yytoken, &yylval);
3870  }
3871  /* Do not reclaim the symbols of the rule which action triggered
3872  this YYABORT or YYACCEPT. */
3873  YYPOPSTACK (yylen);
3874  YY_STACK_PRINT (yyss, yyssp);
3875  while (yyssp != yyss)
3876  {
3877  yydestruct ("Cleanup: popping",
3878  yystos[*yyssp], yyvsp);
3879  YYPOPSTACK (1);
3880  }
3881 #ifndef yyoverflow
3882  if (yyss != yyssa)
3883  YYSTACK_FREE (yyss);
3884 #endif
3885 #if YYERROR_VERBOSE
3886  if (yymsg != yymsgbuf)
3887  YYSTACK_FREE (yymsg);
3888 #endif
3889  /* Make sure YYID is used. */
3890  return YYID (yyresult);
3891 }
3892 
3893 
3894