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