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