i3
|
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=8:expandtab 00074 * 00075 */ 00076 #include <stdio.h> 00077 #include <string.h> 00078 #include <xcb/xcb.h> 00079 #include <sys/types.h> 00080 #include <sys/stat.h> 00081 #include <unistd.h> 00082 #include <fcntl.h> 00083 #include <stdlib.h> 00084 #include <errno.h> 00085 00086 #include "data.h" 00087 #include "config.h" 00088 #include "i3.h" 00089 #include "util.h" 00090 #include "queue.h" 00091 #include "table.h" 00092 #include "workspace.h" 00093 #include "xcb.h" 00094 #include "log.h" 00095 00096 typedef struct yy_buffer_state *YY_BUFFER_STATE; 00097 extern int yylex(struct context *context); 00098 extern int yyparse(void); 00099 extern FILE *yyin; 00100 YY_BUFFER_STATE yy_scan_string(const char *); 00101 00102 static struct bindings_head *current_bindings; 00103 static struct context *context; 00104 00105 /* We don’t need yydebug for now, as we got decent error messages using 00106 * yyerror(). Should you ever want to extend the parser, it might be handy 00107 * to just comment it in again, so it stays here. */ 00108 //int yydebug = 1; 00109 00110 void yyerror(const char *error_message) { 00111 ELOG("\n"); 00112 ELOG("CONFIG: %s\n", error_message); 00113 ELOG("CONFIG: in file \"%s\", line %d:\n", 00114 context->filename, context->line_number); 00115 ELOG("CONFIG: %s\n", context->line_copy); 00116 ELOG("CONFIG: "); 00117 for (int c = 1; c <= context->last_column; c++) 00118 if (c >= context->first_column) 00119 printf("^"); 00120 else printf(" "); 00121 printf("\n"); 00122 ELOG("\n"); 00123 } 00124 00125 int yywrap() { 00126 return 1; 00127 } 00128 00129 void parse_file(const char *f) { 00130 SLIST_HEAD(variables_head, Variable) variables = SLIST_HEAD_INITIALIZER(&variables); 00131 int fd, ret, read_bytes = 0; 00132 struct stat stbuf; 00133 char *buf; 00134 FILE *fstr; 00135 char buffer[1026], key[512], value[512]; 00136 00137 if ((fd = open(f, O_RDONLY)) == -1) 00138 die("Could not open configuration file: %s\n", strerror(errno)); 00139 00140 if (fstat(fd, &stbuf) == -1) 00141 die("Could not fstat file: %s\n", strerror(errno)); 00142 00143 buf = scalloc((stbuf.st_size + 1) * sizeof(char)); 00144 while (read_bytes < stbuf.st_size) { 00145 if ((ret = read(fd, buf + read_bytes, (stbuf.st_size - read_bytes))) < 0) 00146 die("Could not read(): %s\n", strerror(errno)); 00147 read_bytes += ret; 00148 } 00149 00150 if (lseek(fd, 0, SEEK_SET) == (off_t)-1) 00151 die("Could not lseek: %s\n", strerror(errno)); 00152 00153 if ((fstr = fdopen(fd, "r")) == NULL) 00154 die("Could not fdopen: %s\n", strerror(errno)); 00155 00156 while (!feof(fstr)) { 00157 if (fgets(buffer, 1024, fstr) == NULL) { 00158 if (feof(fstr)) 00159 break; 00160 die("Could not read configuration file\n"); 00161 } 00162 00163 /* sscanf implicitly strips whitespace. Also, we skip comments and empty lines. */ 00164 if (sscanf(buffer, "%s %[^\n]", key, value) < 1 || 00165 key[0] == '#' || strlen(key) < 3) 00166 continue; 00167 00168 if (strcasecmp(key, "set") == 0) { 00169 if (value[0] != '$') 00170 die("Malformed variable assignment, name has to start with $\n"); 00171 00172 /* get key/value for this variable */ 00173 char *v_key = value, *v_value; 00174 if ((v_value = strstr(value, " ")) == NULL) 00175 die("Malformed variable assignment, need a value\n"); 00176 00177 *(v_value++) = '\0'; 00178 00179 struct Variable *new = scalloc(sizeof(struct Variable)); 00180 new->key = sstrdup(v_key); 00181 new->value = sstrdup(v_value); 00182 SLIST_INSERT_HEAD(&variables, new, variables); 00183 DLOG("Got new variable %s = %s\n", v_key, v_value); 00184 continue; 00185 } 00186 } 00187 00188 /* For every custom variable, see how often it occurs in the file and 00189 * how much extra bytes it requires when replaced. */ 00190 struct Variable *current, *nearest; 00191 int extra_bytes = 0; 00192 /* We need to copy the buffer because we need to invalidate the 00193 * variables (otherwise we will count them twice, which is bad when 00194 * 'extra' is negative) */ 00195 char *bufcopy = sstrdup(buf); 00196 SLIST_FOREACH(current, &variables, variables) { 00197 int extra = (strlen(current->value) - strlen(current->key)); 00198 char *next; 00199 for (next = bufcopy; 00200 (next = strcasestr(bufcopy + (next - bufcopy), current->key)) != NULL; 00201 next += strlen(current->key)) { 00202 *next = '_'; 00203 extra_bytes += extra; 00204 } 00205 } 00206 FREE(bufcopy); 00207 00208 /* Then, allocate a new buffer and copy the file over to the new one, 00209 * but replace occurences of our variables */ 00210 char *walk = buf, *destwalk; 00211 char *new = smalloc((stbuf.st_size + extra_bytes + 1) * sizeof(char)); 00212 destwalk = new; 00213 while (walk < (buf + stbuf.st_size)) { 00214 /* Find the next variable */ 00215 SLIST_FOREACH(current, &variables, variables) 00216 current->next_match = strcasestr(walk, current->key); 00217 nearest = NULL; 00218 int distance = stbuf.st_size; 00219 SLIST_FOREACH(current, &variables, variables) { 00220 if (current->next_match == NULL) 00221 continue; 00222 if ((current->next_match - walk) < distance) { 00223 distance = (current->next_match - walk); 00224 nearest = current; 00225 } 00226 } 00227 if (nearest == NULL) { 00228 /* If there are no more variables, we just copy the rest */ 00229 strncpy(destwalk, walk, (buf + stbuf.st_size) - walk); 00230 destwalk += (buf + stbuf.st_size) - walk; 00231 *destwalk = '\0'; 00232 break; 00233 } else { 00234 /* Copy until the next variable, then copy its value */ 00235 strncpy(destwalk, walk, distance); 00236 strncpy(destwalk + distance, nearest->value, strlen(nearest->value)); 00237 walk += distance + strlen(nearest->key); 00238 destwalk += distance + strlen(nearest->value); 00239 } 00240 } 00241 00242 yy_scan_string(new); 00243 00244 context = scalloc(sizeof(struct context)); 00245 context->filename = f; 00246 00247 if (yyparse() != 0) { 00248 fprintf(stderr, "Could not parse configfile\n"); 00249 exit(1); 00250 } 00251 00252 FREE(context->line_copy); 00253 free(context); 00254 free(new); 00255 free(buf); 00256 00257 while (!SLIST_EMPTY(&variables)) { 00258 current = SLIST_FIRST(&variables); 00259 FREE(current->key); 00260 FREE(current->value); 00261 SLIST_REMOVE_HEAD(&variables, variables); 00262 FREE(current); 00263 } 00264 fclose(fstr); 00265 close(fd); 00266 } 00267 00268 00269 00270 /* Line 189 of yacc.c */ 00271 #line 272 "src/cfgparse.tab.c" 00272 00273 /* Enabling traces. */ 00274 #ifndef YYDEBUG 00275 # define YYDEBUG 1 00276 #endif 00277 00278 /* Enabling verbose error messages. */ 00279 #ifdef YYERROR_VERBOSE 00280 # undef YYERROR_VERBOSE 00281 # define YYERROR_VERBOSE 1 00282 #else 00283 # define YYERROR_VERBOSE 1 00284 #endif 00285 00286 /* Enabling the token table. */ 00287 #ifndef YYTOKEN_TABLE 00288 # define YYTOKEN_TABLE 0 00289 #endif 00290 00291 00292 /* Tokens. */ 00293 #ifndef YYTOKENTYPE 00294 # define YYTOKENTYPE 00295 /* Put the tokens into the symbol table, so that GDB and other debuggers 00296 know about them. */ 00297 enum yytokentype { 00298 NUMBER = 258, 00299 WORD = 259, 00300 STR = 260, 00301 STR_NG = 261, 00302 HEX = 262, 00303 OUTPUT = 263, 00304 TOKBIND = 264, 00305 TOKTERMINAL = 265, 00306 TOKCOMMENT = 266, 00307 TOKFONT = 267, 00308 TOKBINDSYM = 268, 00309 MODIFIER = 269, 00310 TOKCONTROL = 270, 00311 TOKSHIFT = 271, 00312 WHITESPACE = 272, 00313 TOKFLOATING_MODIFIER = 273, 00314 QUOTEDSTRING = 274, 00315 TOKWORKSPACE = 275, 00316 TOKOUTPUT = 276, 00317 TOKASSIGN = 277, 00318 TOKSET = 278, 00319 TOKIPCSOCKET = 279, 00320 TOKEXEC = 280, 00321 TOKSINGLECOLOR = 281, 00322 TOKCOLOR = 282, 00323 TOKARROW = 283, 00324 TOKMODE = 284, 00325 TOKNEWCONTAINER = 285, 00326 TOKNEWWINDOW = 286, 00327 TOKFOCUSFOLLOWSMOUSE = 287, 00328 TOKWORKSPACEBAR = 288, 00329 TOKCONTAINERMODE = 289, 00330 TOKSTACKLIMIT = 290 00331 }; 00332 #endif 00333 00334 00335 00336 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00337 typedef union YYSTYPE 00338 { 00339 00340 /* Line 214 of yacc.c */ 00341 #line 204 "src/cfgparse.y" 00342 00343 int number; 00344 char *string; 00345 uint32_t *single_color; 00346 struct Colortriple *color; 00347 struct Assignment *assignment; 00348 struct Binding *binding; 00349 00350 00351 00352 /* Line 214 of yacc.c */ 00353 #line 354 "src/cfgparse.tab.c" 00354 } YYSTYPE; 00355 # define YYSTYPE_IS_TRIVIAL 1 00356 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00357 # define YYSTYPE_IS_DECLARED 1 00358 #endif 00359 00360 00361 /* Copy the second part of user declarations. */ 00362 00363 00364 /* Line 264 of yacc.c */ 00365 #line 366 "src/cfgparse.tab.c" 00366 00367 #ifdef short 00368 # undef short 00369 #endif 00370 00371 #ifdef YYTYPE_UINT8 00372 typedef YYTYPE_UINT8 yytype_uint8; 00373 #else 00374 typedef unsigned char yytype_uint8; 00375 #endif 00376 00377 #ifdef YYTYPE_INT8 00378 typedef YYTYPE_INT8 yytype_int8; 00379 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00380 || defined __cplusplus || defined _MSC_VER) 00381 typedef signed char yytype_int8; 00382 #else 00383 typedef short int yytype_int8; 00384 #endif 00385 00386 #ifdef YYTYPE_UINT16 00387 typedef YYTYPE_UINT16 yytype_uint16; 00388 #else 00389 typedef unsigned short int yytype_uint16; 00390 #endif 00391 00392 #ifdef YYTYPE_INT16 00393 typedef YYTYPE_INT16 yytype_int16; 00394 #else 00395 typedef short int yytype_int16; 00396 #endif 00397 00398 #ifndef YYSIZE_T 00399 # ifdef __SIZE_TYPE__ 00400 # define YYSIZE_T __SIZE_TYPE__ 00401 # elif defined size_t 00402 # define YYSIZE_T size_t 00403 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00404 || defined __cplusplus || defined _MSC_VER) 00405 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00406 # define YYSIZE_T size_t 00407 # else 00408 # define YYSIZE_T unsigned int 00409 # endif 00410 #endif 00411 00412 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00413 00414 #ifndef YY_ 00415 # if defined YYENABLE_NLS && YYENABLE_NLS 00416 # if ENABLE_NLS 00417 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00418 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00419 # endif 00420 # endif 00421 # ifndef YY_ 00422 # define YY_(msgid) msgid 00423 # endif 00424 #endif 00425 00426 /* Suppress unused-variable warnings by "using" E. */ 00427 #if ! defined lint || defined __GNUC__ 00428 # define YYUSE(e) ((void) (e)) 00429 #else 00430 # define YYUSE(e) /* empty */ 00431 #endif 00432 00433 /* Identity function, used to suppress warnings about constant conditions. */ 00434 #ifndef lint 00435 # define YYID(n) (n) 00436 #else 00437 #if (defined __STDC__ || defined __C99__FUNC__ \ 00438 || defined __cplusplus || defined _MSC_VER) 00439 static int 00440 YYID (int yyi) 00441 #else 00442 static int 00443 YYID (yyi) 00444 int yyi; 00445 #endif 00446 { 00447 return yyi; 00448 } 00449 #endif 00450 00451 #if ! defined yyoverflow || YYERROR_VERBOSE 00452 00453 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00454 00455 # ifdef YYSTACK_USE_ALLOCA 00456 # if YYSTACK_USE_ALLOCA 00457 # ifdef __GNUC__ 00458 # define YYSTACK_ALLOC __builtin_alloca 00459 # elif defined __BUILTIN_VA_ARG_INCR 00460 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00461 # elif defined _AIX 00462 # define YYSTACK_ALLOC __alloca 00463 # elif defined _MSC_VER 00464 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00465 # define alloca _alloca 00466 # else 00467 # define YYSTACK_ALLOC alloca 00468 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00469 || defined __cplusplus || defined _MSC_VER) 00470 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00471 # ifndef _STDLIB_H 00472 # define _STDLIB_H 1 00473 # endif 00474 # endif 00475 # endif 00476 # endif 00477 # endif 00478 00479 # ifdef YYSTACK_ALLOC 00480 /* Pacify GCC's `empty if-body' warning. */ 00481 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00482 # ifndef YYSTACK_ALLOC_MAXIMUM 00483 /* The OS might guarantee only one guard page at the bottom of the stack, 00484 and a page size can be as small as 4096 bytes. So we cannot safely 00485 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00486 to allow for a few compiler-allocated temporary stack slots. */ 00487 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00488 # endif 00489 # else 00490 # define YYSTACK_ALLOC YYMALLOC 00491 # define YYSTACK_FREE YYFREE 00492 # ifndef YYSTACK_ALLOC_MAXIMUM 00493 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00494 # endif 00495 # if (defined __cplusplus && ! defined _STDLIB_H \ 00496 && ! ((defined YYMALLOC || defined malloc) \ 00497 && (defined YYFREE || defined free))) 00498 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00499 # ifndef _STDLIB_H 00500 # define _STDLIB_H 1 00501 # endif 00502 # endif 00503 # ifndef YYMALLOC 00504 # define YYMALLOC malloc 00505 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00506 || defined __cplusplus || defined _MSC_VER) 00507 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00508 # endif 00509 # endif 00510 # ifndef YYFREE 00511 # define YYFREE free 00512 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00513 || defined __cplusplus || defined _MSC_VER) 00514 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00515 # endif 00516 # endif 00517 # endif 00518 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00519 00520 00521 #if (! defined yyoverflow \ 00522 && (! defined __cplusplus \ 00523 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00524 00525 /* A type that is properly aligned for any stack member. */ 00526 union yyalloc 00527 { 00528 yytype_int16 yyss_alloc; 00529 YYSTYPE yyvs_alloc; 00530 }; 00531 00532 /* The size of the maximum gap between one aligned stack and the next. */ 00533 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00534 00535 /* The size of an array large to enough to hold all stacks, each with 00536 N elements. */ 00537 # define YYSTACK_BYTES(N) \ 00538 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00539 + YYSTACK_GAP_MAXIMUM) 00540 00541 /* Copy COUNT objects from FROM to TO. The source and destination do 00542 not overlap. */ 00543 # ifndef YYCOPY 00544 # if defined __GNUC__ && 1 < __GNUC__ 00545 # define YYCOPY(To, From, Count) \ 00546 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00547 # else 00548 # define YYCOPY(To, From, Count) \ 00549 do \ 00550 { \ 00551 YYSIZE_T yyi; \ 00552 for (yyi = 0; yyi < (Count); yyi++) \ 00553 (To)[yyi] = (From)[yyi]; \ 00554 } \ 00555 while (YYID (0)) 00556 # endif 00557 # endif 00558 00559 /* Relocate STACK from its old location to the new one. The 00560 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00561 elements in the stack, and YYPTR gives the new location of the 00562 stack. Advance YYPTR to a properly aligned location for the next 00563 stack. */ 00564 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00565 do \ 00566 { \ 00567 YYSIZE_T yynewbytes; \ 00568 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00569 Stack = &yyptr->Stack_alloc; \ 00570 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00571 yyptr += yynewbytes / sizeof (*yyptr); \ 00572 } \ 00573 while (YYID (0)) 00574 00575 #endif 00576 00577 /* YYFINAL -- State number of the termination state. */ 00578 #define YYFINAL 2 00579 /* YYLAST -- Last index in YYTABLE. */ 00580 #define YYLAST 123 00581 00582 /* YYNTOKENS -- Number of terminals. */ 00583 #define YYNTOKENS 41 00584 /* YYNNTS -- Number of nonterminals. */ 00585 #define YYNNTS 35 00586 /* YYNRULES -- Number of rules. */ 00587 #define YYNRULES 73 00588 /* YYNRULES -- Number of states. */ 00589 #define YYNSTATES 132 00590 00591 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00592 #define YYUNDEFTOK 2 00593 #define YYMAXUTOK 290 00594 00595 #define YYTRANSLATE(YYX) \ 00596 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00597 00598 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00599 static const yytype_uint8 yytranslate[] = 00600 { 00601 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00604 2, 2, 2, 2, 2, 39, 2, 2, 2, 2, 00605 2, 2, 2, 40, 2, 2, 2, 2, 2, 2, 00606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00613 2, 2, 2, 36, 2, 37, 38, 2, 2, 2, 00614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00626 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00627 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00628 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 00629 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 00630 35 00631 }; 00632 00633 #if YYDEBUG 00634 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00635 YYRHS. */ 00636 static const yytype_uint8 yyprhs[] = 00637 { 00638 0, 0, 3, 4, 8, 11, 14, 16, 18, 20, 00639 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 00640 42, 44, 46, 48, 50, 52, 56, 60, 65, 70, 00641 72, 74, 82, 83, 86, 88, 90, 92, 96, 100, 00642 108, 112, 114, 116, 120, 124, 133, 139, 140, 143, 00643 145, 147, 149, 156, 158, 160, 163, 165, 167, 168, 00644 171, 175, 179, 183, 187, 191, 199, 202, 203, 205, 00645 209, 212, 214, 216 00646 }; 00647 00648 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00649 static const yytype_int8 yyrhs[] = 00650 { 00651 42, 0, -1, -1, 42, 17, 43, -1, 42, 1, 00652 -1, 42, 43, -1, 46, -1, 51, -1, 54, -1, 00653 55, -1, 56, -1, 58, -1, 59, -1, 60, -1, 00654 63, -1, 67, -1, 68, -1, 71, -1, 72, -1, 00655 69, -1, 70, -1, 44, -1, 11, -1, 5, -1, 00656 47, -1, 9, 17, 48, -1, 13, 17, 49, -1, 00657 74, 3, 17, 45, -1, 74, 50, 17, 45, -1, 00658 4, -1, 3, -1, 29, 17, 19, 17, 36, 52, 00659 37, -1, -1, 52, 53, -1, 17, -1, 44, -1, 00660 47, -1, 18, 17, 74, -1, 30, 17, 34, -1, 00661 30, 17, 35, 17, 35, 17, 3, -1, 31, 17, 00662 4, -1, 3, -1, 4, -1, 32, 17, 57, -1, 00663 33, 17, 57, -1, 20, 17, 3, 17, 21, 17, 00664 8, 61, -1, 20, 17, 3, 17, 62, -1, -1, 00665 17, 62, -1, 19, -1, 5, -1, 4, -1, 22, 00666 17, 65, 17, 66, 64, -1, 3, -1, 38, -1, 00667 38, 3, -1, 19, -1, 6, -1, -1, 28, 17, 00668 -1, 24, 17, 5, -1, 25, 17, 5, -1, 10, 00669 17, 5, -1, 12, 17, 5, -1, 26, 17, 73, 00670 -1, 27, 17, 73, 17, 73, 17, 73, -1, 39, 00671 7, -1, -1, 75, -1, 74, 40, 75, -1, 74, 00672 40, -1, 14, -1, 15, -1, 16, -1 00673 }; 00674 00675 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00676 static const yytype_uint16 yyrline[] = 00677 { 00678 0, 249, 249, 250, 251, 252, 256, 257, 258, 259, 00679 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 00680 270, 271, 275, 279, 283, 290, 291, 295, 309, 323, 00681 324, 331, 354, 356, 360, 361, 362, 374, 382, 404, 00682 423, 431, 435, 447, 455, 463, 477, 493, 494, 498, 00683 499, 500, 504, 522, 529, 535, 545, 546, 549, 551, 00684 555, 562, 571, 579, 587, 595, 606, 618, 619, 620, 00685 621, 625, 626, 627 00686 }; 00687 #endif 00688 00689 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00690 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00691 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00692 static const char *const yytname[] = 00693 { 00694 "$end", "error", "$undefined", "\"<number>\"", "\"<word>\"", 00695 "\"<string>\"", "\"<string (non-greedy)>\"", "\"<hex>\"", 00696 "\"<RandR output>\"", "TOKBIND", "TOKTERMINAL", "\"<comment>\"", 00697 "\"font\"", "\"bindsym\"", "\"<modifier>\"", "\"control\"", "\"shift\"", 00698 "\"<whitespace>\"", "\"floating_modifier\"", "\"<quoted string>\"", 00699 "\"workspace\"", "\"output\"", "\"assign\"", "TOKSET", "\"ipc_socket\"", 00700 "\"exec\"", "TOKSINGLECOLOR", "TOKCOLOR", "\"\\342\\206\\222\"", 00701 "\"mode\"", "\"new_container\"", "\"new_window\"", 00702 "\"focus_follows_mouse\"", "\"workspace_bar\"", 00703 "\"default/stacking/tabbed\"", "\"stack-limit\"", "'{'", "'}'", "'~'", 00704 "'#'", "'+'", "$accept", "lines", "line", "comment", "command", 00705 "bindline", "binding", "bind", "bindsym", "word_or_number", "mode", 00706 "modelines", "modeline", "floating_modifier", "new_container", 00707 "new_window", "bool", "focus_follows_mouse", "workspace_bar", 00708 "workspace", "optional_workspace_name", "workspace_name", "assign", 00709 "assign_target", "window_class", "optional_arrow", "ipcsocket", "exec", 00710 "terminal", "font", "single_color", "color", "colorpixel", 00711 "binding_modifiers", "binding_modifier", 0 00712 }; 00713 #endif 00714 00715 # ifdef YYPRINT 00716 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00717 token YYLEX-NUM. */ 00718 static const yytype_uint16 yytoknum[] = 00719 { 00720 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00721 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 00722 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 00723 285, 286, 287, 288, 289, 290, 123, 125, 126, 35, 00724 43 00725 }; 00726 # endif 00727 00728 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00729 static const yytype_uint8 yyr1[] = 00730 { 00731 0, 41, 42, 42, 42, 42, 43, 43, 43, 43, 00732 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 00733 43, 43, 44, 45, 46, 47, 47, 48, 49, 50, 00734 50, 51, 52, 52, 53, 53, 53, 54, 55, 55, 00735 56, 57, 57, 58, 59, 60, 60, 61, 61, 62, 00736 62, 62, 63, 64, 64, 64, 65, 65, 66, 66, 00737 67, 68, 69, 70, 71, 72, 73, 74, 74, 74, 00738 74, 75, 75, 75 00739 }; 00740 00741 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00742 static const yytype_uint8 yyr2[] = 00743 { 00744 0, 2, 0, 3, 2, 2, 1, 1, 1, 1, 00745 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00746 1, 1, 1, 1, 1, 3, 3, 4, 4, 1, 00747 1, 7, 0, 2, 1, 1, 1, 3, 3, 7, 00748 3, 1, 1, 3, 3, 8, 5, 0, 2, 1, 00749 1, 1, 6, 1, 1, 2, 1, 1, 0, 2, 00750 3, 3, 3, 3, 3, 7, 2, 0, 1, 3, 00751 2, 1, 1, 1 00752 }; 00753 00754 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 00755 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 00756 means the default is an error. */ 00757 static const yytype_uint8 yydefact[] = 00758 { 00759 2, 0, 1, 4, 0, 0, 22, 0, 0, 0, 00760 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00761 0, 0, 5, 21, 6, 24, 7, 8, 9, 10, 00762 11, 12, 13, 14, 15, 16, 19, 20, 17, 18, 00763 67, 0, 0, 67, 3, 67, 0, 0, 0, 0, 00764 0, 0, 0, 0, 0, 0, 0, 71, 72, 73, 00765 25, 0, 68, 62, 63, 26, 0, 37, 0, 57, 00766 56, 0, 60, 61, 0, 64, 0, 0, 38, 0, 00767 40, 41, 42, 43, 44, 0, 70, 30, 29, 0, 00768 0, 58, 66, 0, 0, 0, 0, 69, 0, 51, 00769 50, 49, 0, 46, 0, 0, 0, 32, 0, 23, 00770 27, 28, 0, 59, 53, 54, 52, 0, 0, 0, 00771 47, 55, 65, 34, 31, 35, 36, 33, 39, 0, 00772 45, 48 00773 }; 00774 00775 /* YYDEFGOTO[NTERM-NUM]. */ 00776 static const yytype_int16 yydefgoto[] = 00777 { 00778 -1, 1, 22, 23, 110, 24, 25, 60, 65, 89, 00779 26, 118, 127, 27, 28, 29, 83, 30, 31, 32, 00780 130, 103, 33, 116, 71, 105, 34, 35, 36, 37, 00781 38, 39, 75, 61, 62 00782 }; 00783 00784 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00785 STATE-NUM. */ 00786 #define YYPACT_NINF -52 00787 static const yytype_int8 yypact[] = 00788 { 00789 -52, 43, -52, -52, -5, -1, -52, 9, 11, 68, 00790 15, 17, 18, 19, 20, 24, 28, 29, 30, 31, 00791 32, 33, -52, -52, -52, -52, -52, -52, -52, -52, 00792 -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 00793 3, 46, 52, 3, -52, 3, 55, 2, 54, 57, 00794 -33, -33, 45, -11, 67, 27, 27, -52, -52, -52, 00795 -52, 0, -52, -52, -52, -52, -2, 42, 66, -52, 00796 -52, 70, -52, -52, 77, -52, 72, 74, -52, 79, 00797 -52, -52, -52, -52, -52, 85, 3, -52, -52, 86, 00798 6, 76, -52, -33, 49, 71, 100, -52, 100, -52, 00799 -52, -52, 90, -52, 91, 1, 92, -52, 93, -52, 00800 -52, -52, 103, -52, -52, 109, -52, -33, -4, 110, 00801 97, -52, -52, -52, -52, -52, -52, -52, -52, 10, 00802 -52, -52 00803 }; 00804 00805 /* YYPGOTO[NTERM-NUM]. */ 00806 static const yytype_int8 yypgoto[] = 00807 { 00808 -52, -52, 106, 4, 21, -52, 5, -52, -52, -52, 00809 -52, -52, -52, -52, -52, -52, 60, -52, -52, -52, 00810 -52, -12, -52, -52, -52, -52, -52, -52, -52, -52, 00811 -52, -52, -51, -23, 34 00812 }; 00813 00814 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00815 positive, shift that token. If negative, reduce the rule which 00816 number is the opposite. If zero, do what YYDEFACT says. 00817 If YYTABLE_NINF, syntax error. */ 00818 #define YYTABLE_NINF -1 00819 static const yytype_uint8 yytable[] = 00820 { 00821 76, 87, 88, 85, 114, 4, 74, 6, 69, 8, 00822 99, 100, 40, 123, 99, 100, 41, 57, 58, 59, 00823 66, 70, 67, 78, 79, 101, 42, 102, 43, 101, 00824 81, 82, 45, 124, 46, 47, 48, 49, 86, 115, 00825 86, 50, 106, 2, 3, 51, 52, 53, 54, 55, 00826 56, 63, 4, 5, 6, 7, 8, 64, 68, 72, 00827 9, 10, 73, 11, 77, 12, 122, 13, 14, 15, 00828 16, 80, 17, 18, 19, 20, 21, 4, 5, 6, 00829 7, 8, 86, 90, 92, 107, 10, 91, 11, 93, 00830 12, 94, 13, 14, 15, 16, 95, 17, 18, 19, 00831 20, 21, 96, 98, 104, 109, 108, 112, 113, 117, 00832 119, 120, 121, 128, 129, 44, 84, 131, 0, 111, 00833 97, 0, 125, 126 00834 }; 00835 00836 static const yytype_int16 yycheck[] = 00837 { 00838 51, 3, 4, 3, 3, 9, 39, 11, 6, 13, 00839 4, 5, 17, 17, 4, 5, 17, 14, 15, 16, 00840 43, 19, 45, 34, 35, 19, 17, 21, 17, 19, 00841 3, 4, 17, 37, 17, 17, 17, 17, 40, 38, 00842 40, 17, 93, 0, 1, 17, 17, 17, 17, 17, 00843 17, 5, 9, 10, 11, 12, 13, 5, 3, 5, 00844 17, 18, 5, 20, 19, 22, 117, 24, 25, 26, 00845 27, 4, 29, 30, 31, 32, 33, 9, 10, 11, 00846 12, 13, 40, 17, 7, 36, 18, 17, 20, 17, 00847 22, 17, 24, 25, 26, 27, 17, 29, 30, 31, 00848 32, 33, 17, 17, 28, 5, 35, 17, 17, 17, 00849 17, 8, 3, 3, 17, 9, 56, 129, -1, 98, 00850 86, -1, 118, 118 00851 }; 00852 00853 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00854 symbol of state STATE-NUM. */ 00855 static const yytype_uint8 yystos[] = 00856 { 00857 0, 42, 0, 1, 9, 10, 11, 12, 13, 17, 00858 18, 20, 22, 24, 25, 26, 27, 29, 30, 31, 00859 32, 33, 43, 44, 46, 47, 51, 54, 55, 56, 00860 58, 59, 60, 63, 67, 68, 69, 70, 71, 72, 00861 17, 17, 17, 17, 43, 17, 17, 17, 17, 17, 00862 17, 17, 17, 17, 17, 17, 17, 14, 15, 16, 00863 48, 74, 75, 5, 5, 49, 74, 74, 3, 6, 00864 19, 65, 5, 5, 39, 73, 73, 19, 34, 35, 00865 4, 3, 4, 57, 57, 3, 40, 3, 4, 50, 00866 17, 17, 7, 17, 17, 17, 17, 75, 17, 4, 00867 5, 19, 21, 62, 28, 66, 73, 36, 35, 5, 00868 45, 45, 17, 17, 3, 38, 64, 17, 52, 17, 00869 8, 3, 73, 17, 37, 44, 47, 53, 3, 17, 00870 61, 62 00871 }; 00872 00873 #define yyerrok (yyerrstatus = 0) 00874 #define yyclearin (yychar = YYEMPTY) 00875 #define YYEMPTY (-2) 00876 #define YYEOF 0 00877 00878 #define YYACCEPT goto yyacceptlab 00879 #define YYABORT goto yyabortlab 00880 #define YYERROR goto yyerrorlab 00881 00882 00883 /* Like YYERROR except do call yyerror. This remains here temporarily 00884 to ease the transition to the new meaning of YYERROR, for GCC. 00885 Once GCC version 2 has supplanted version 1, this can go. However, 00886 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 00887 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 00888 discussed. */ 00889 00890 #define YYFAIL goto yyerrlab 00891 #if defined YYFAIL 00892 /* This is here to suppress warnings from the GCC cpp's 00893 -Wunused-macros. Normally we don't worry about that warning, but 00894 some users do, and we want to make it easy for users to remove 00895 YYFAIL uses, which will produce warnings from Bison 2.5. */ 00896 #endif 00897 00898 #define YYRECOVERING() (!!yyerrstatus) 00899 00900 #define YYBACKUP(Token, Value) \ 00901 do \ 00902 if (yychar == YYEMPTY && yylen == 1) \ 00903 { \ 00904 yychar = (Token); \ 00905 yylval = (Value); \ 00906 yytoken = YYTRANSLATE (yychar); \ 00907 YYPOPSTACK (1); \ 00908 goto yybackup; \ 00909 } \ 00910 else \ 00911 { \ 00912 yyerror (YY_("syntax error: cannot back up")); \ 00913 YYERROR; \ 00914 } \ 00915 while (YYID (0)) 00916 00917 00918 #define YYTERROR 1 00919 #define YYERRCODE 256 00920 00921 00922 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00923 If N is 0, then set CURRENT to the empty location which ends 00924 the previous symbol: RHS[0] (always defined). */ 00925 00926 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00927 #ifndef YYLLOC_DEFAULT 00928 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00929 do \ 00930 if (YYID (N)) \ 00931 { \ 00932 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 00933 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 00934 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 00935 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 00936 } \ 00937 else \ 00938 { \ 00939 (Current).first_line = (Current).last_line = \ 00940 YYRHSLOC (Rhs, 0).last_line; \ 00941 (Current).first_column = (Current).last_column = \ 00942 YYRHSLOC (Rhs, 0).last_column; \ 00943 } \ 00944 while (YYID (0)) 00945 #endif 00946 00947 00948 /* YY_LOCATION_PRINT -- Print the location on the stream. 00949 This macro was not mandated originally: define only if we know 00950 we won't break user code: when these are the locations we know. */ 00951 00952 #ifndef YY_LOCATION_PRINT 00953 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 00954 # define YY_LOCATION_PRINT(File, Loc) \ 00955 fprintf (File, "%d.%d-%d.%d", \ 00956 (Loc).first_line, (Loc).first_column, \ 00957 (Loc).last_line, (Loc).last_column) 00958 # else 00959 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 00960 # endif 00961 #endif 00962 00963 00964 /* YYLEX -- calling `yylex' with the right arguments. */ 00965 00966 #ifdef YYLEX_PARAM 00967 # define YYLEX yylex (YYLEX_PARAM) 00968 #else 00969 # define YYLEX yylex (context) 00970 #endif 00971 00972 /* Enable debugging if requested. */ 00973 #if YYDEBUG 00974 00975 # ifndef YYFPRINTF 00976 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 00977 # define YYFPRINTF fprintf 00978 # endif 00979 00980 # define YYDPRINTF(Args) \ 00981 do { \ 00982 if (yydebug) \ 00983 YYFPRINTF Args; \ 00984 } while (YYID (0)) 00985 00986 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 00987 do { \ 00988 if (yydebug) \ 00989 { \ 00990 YYFPRINTF (stderr, "%s ", Title); \ 00991 yy_symbol_print (stderr, \ 00992 Type, Value); \ 00993 YYFPRINTF (stderr, "\n"); \ 00994 } \ 00995 } while (YYID (0)) 00996 00997 00998 /*--------------------------------. 00999 | Print this symbol on YYOUTPUT. | 01000 `--------------------------------*/ 01001 01002 /*ARGSUSED*/ 01003 #if (defined __STDC__ || defined __C99__FUNC__ \ 01004 || defined __cplusplus || defined _MSC_VER) 01005 static void 01006 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01007 #else 01008 static void 01009 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 01010 FILE *yyoutput; 01011 int yytype; 01012 YYSTYPE const * const yyvaluep; 01013 #endif 01014 { 01015 if (!yyvaluep) 01016 return; 01017 # ifdef YYPRINT 01018 if (yytype < YYNTOKENS) 01019 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 01020 # else 01021 YYUSE (yyoutput); 01022 # endif 01023 switch (yytype) 01024 { 01025 default: 01026 break; 01027 } 01028 } 01029 01030 01031 /*--------------------------------. 01032 | Print this symbol on YYOUTPUT. | 01033 `--------------------------------*/ 01034 01035 #if (defined __STDC__ || defined __C99__FUNC__ \ 01036 || defined __cplusplus || defined _MSC_VER) 01037 static void 01038 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01039 #else 01040 static void 01041 yy_symbol_print (yyoutput, yytype, yyvaluep) 01042 FILE *yyoutput; 01043 int yytype; 01044 YYSTYPE const * const yyvaluep; 01045 #endif 01046 { 01047 if (yytype < YYNTOKENS) 01048 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 01049 else 01050 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 01051 01052 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 01053 YYFPRINTF (yyoutput, ")"); 01054 } 01055 01056 /*------------------------------------------------------------------. 01057 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 01058 | TOP (included). | 01059 `------------------------------------------------------------------*/ 01060 01061 #if (defined __STDC__ || defined __C99__FUNC__ \ 01062 || defined __cplusplus || defined _MSC_VER) 01063 static void 01064 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 01065 #else 01066 static void 01067 yy_stack_print (yybottom, yytop) 01068 yytype_int16 *yybottom; 01069 yytype_int16 *yytop; 01070 #endif 01071 { 01072 YYFPRINTF (stderr, "Stack now"); 01073 for (; yybottom <= yytop; yybottom++) 01074 { 01075 int yybot = *yybottom; 01076 YYFPRINTF (stderr, " %d", yybot); 01077 } 01078 YYFPRINTF (stderr, "\n"); 01079 } 01080 01081 # define YY_STACK_PRINT(Bottom, Top) \ 01082 do { \ 01083 if (yydebug) \ 01084 yy_stack_print ((Bottom), (Top)); \ 01085 } while (YYID (0)) 01086 01087 01088 /*------------------------------------------------. 01089 | Report that the YYRULE is going to be reduced. | 01090 `------------------------------------------------*/ 01091 01092 #if (defined __STDC__ || defined __C99__FUNC__ \ 01093 || defined __cplusplus || defined _MSC_VER) 01094 static void 01095 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 01096 #else 01097 static void 01098 yy_reduce_print (yyvsp, yyrule) 01099 YYSTYPE *yyvsp; 01100 int yyrule; 01101 #endif 01102 { 01103 int yynrhs = yyr2[yyrule]; 01104 int yyi; 01105 unsigned long int yylno = yyrline[yyrule]; 01106 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 01107 yyrule - 1, yylno); 01108 /* The symbols being reduced. */ 01109 for (yyi = 0; yyi < yynrhs; yyi++) 01110 { 01111 YYFPRINTF (stderr, " $%d = ", yyi + 1); 01112 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 01113 &(yyvsp[(yyi + 1) - (yynrhs)]) 01114 ); 01115 YYFPRINTF (stderr, "\n"); 01116 } 01117 } 01118 01119 # define YY_REDUCE_PRINT(Rule) \ 01120 do { \ 01121 if (yydebug) \ 01122 yy_reduce_print (yyvsp, Rule); \ 01123 } while (YYID (0)) 01124 01125 /* Nonzero means print parse trace. It is left uninitialized so that 01126 multiple parsers can coexist. */ 01127 int yydebug; 01128 #else /* !YYDEBUG */ 01129 # define YYDPRINTF(Args) 01130 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 01131 # define YY_STACK_PRINT(Bottom, Top) 01132 # define YY_REDUCE_PRINT(Rule) 01133 #endif /* !YYDEBUG */ 01134 01135 01136 /* YYINITDEPTH -- initial size of the parser's stacks. */ 01137 #ifndef YYINITDEPTH 01138 # define YYINITDEPTH 200 01139 #endif 01140 01141 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 01142 if the built-in stack extension method is used). 01143 01144 Do not make this value too large; the results are undefined if 01145 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 01146 evaluated with infinite-precision integer arithmetic. */ 01147 01148 #ifndef YYMAXDEPTH 01149 # define YYMAXDEPTH 10000 01150 #endif 01151 01152 01153 01154 #if YYERROR_VERBOSE 01155 01156 # ifndef yystrlen 01157 # if defined __GLIBC__ && defined _STRING_H 01158 # define yystrlen strlen 01159 # else 01160 /* Return the length of YYSTR. */ 01161 #if (defined __STDC__ || defined __C99__FUNC__ \ 01162 || defined __cplusplus || defined _MSC_VER) 01163 static YYSIZE_T 01164 yystrlen (const char *yystr) 01165 #else 01166 static YYSIZE_T 01167 yystrlen (yystr) 01168 const char *yystr; 01169 #endif 01170 { 01171 YYSIZE_T yylen; 01172 for (yylen = 0; yystr[yylen]; yylen++) 01173 continue; 01174 return yylen; 01175 } 01176 # endif 01177 # endif 01178 01179 # ifndef yystpcpy 01180 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 01181 # define yystpcpy stpcpy 01182 # else 01183 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 01184 YYDEST. */ 01185 #if (defined __STDC__ || defined __C99__FUNC__ \ 01186 || defined __cplusplus || defined _MSC_VER) 01187 static char * 01188 yystpcpy (char *yydest, const char *yysrc) 01189 #else 01190 static char * 01191 yystpcpy (yydest, yysrc) 01192 char *yydest; 01193 const char *yysrc; 01194 #endif 01195 { 01196 char *yyd = yydest; 01197 const char *yys = yysrc; 01198 01199 while ((*yyd++ = *yys++) != '\0') 01200 continue; 01201 01202 return yyd - 1; 01203 } 01204 # endif 01205 # endif 01206 01207 # ifndef yytnamerr 01208 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01209 quotes and backslashes, so that it's suitable for yyerror. The 01210 heuristic is that double-quoting is unnecessary unless the string 01211 contains an apostrophe, a comma, or backslash (other than 01212 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01213 null, do not copy; instead, return the length of what the result 01214 would have been. */ 01215 static YYSIZE_T 01216 yytnamerr (char *yyres, const char *yystr) 01217 { 01218 if (*yystr == '"') 01219 { 01220 YYSIZE_T yyn = 0; 01221 char const *yyp = yystr; 01222 01223 for (;;) 01224 switch (*++yyp) 01225 { 01226 case '\'': 01227 case ',': 01228 goto do_not_strip_quotes; 01229 01230 case '\\': 01231 if (*++yyp != '\\') 01232 goto do_not_strip_quotes; 01233 /* Fall through. */ 01234 default: 01235 if (yyres) 01236 yyres[yyn] = *yyp; 01237 yyn++; 01238 break; 01239 01240 case '"': 01241 if (yyres) 01242 yyres[yyn] = '\0'; 01243 return yyn; 01244 } 01245 do_not_strip_quotes: ; 01246 } 01247 01248 if (! yyres) 01249 return yystrlen (yystr); 01250 01251 return yystpcpy (yyres, yystr) - yyres; 01252 } 01253 # endif 01254 01255 /* Copy into YYRESULT an error message about the unexpected token 01256 YYCHAR while in state YYSTATE. Return the number of bytes copied, 01257 including the terminating null byte. If YYRESULT is null, do not 01258 copy anything; just return the number of bytes that would be 01259 copied. As a special case, return 0 if an ordinary "syntax error" 01260 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 01261 size calculation. */ 01262 static YYSIZE_T 01263 yysyntax_error (char *yyresult, int yystate, int yychar) 01264 { 01265 int yyn = yypact[yystate]; 01266 01267 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 01268 return 0; 01269 else 01270 { 01271 int yytype = YYTRANSLATE (yychar); 01272 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 01273 YYSIZE_T yysize = yysize0; 01274 YYSIZE_T yysize1; 01275 int yysize_overflow = 0; 01276 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01277 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01278 int yyx; 01279 01280 # if 0 01281 /* This is so xgettext sees the translatable formats that are 01282 constructed on the fly. */ 01283 YY_("syntax error, unexpected %s"); 01284 YY_("syntax error, unexpected %s, expecting %s"); 01285 YY_("syntax error, unexpected %s, expecting %s or %s"); 01286 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 01287 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 01288 # endif 01289 char *yyfmt; 01290 char const *yyf; 01291 static char const yyunexpected[] = "syntax error, unexpected %s"; 01292 static char const yyexpecting[] = ", expecting %s"; 01293 static char const yyor[] = " or %s"; 01294 char yyformat[sizeof yyunexpected 01295 + sizeof yyexpecting - 1 01296 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 01297 * (sizeof yyor - 1))]; 01298 char const *yyprefix = yyexpecting; 01299 01300 /* Start YYX at -YYN if negative to avoid negative indexes in 01301 YYCHECK. */ 01302 int yyxbegin = yyn < 0 ? -yyn : 0; 01303 01304 /* Stay within bounds of both yycheck and yytname. */ 01305 int yychecklim = YYLAST - yyn + 1; 01306 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01307 int yycount = 1; 01308 01309 yyarg[0] = yytname[yytype]; 01310 yyfmt = yystpcpy (yyformat, yyunexpected); 01311 01312 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01313 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 01314 { 01315 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01316 { 01317 yycount = 1; 01318 yysize = yysize0; 01319 yyformat[sizeof yyunexpected - 1] = '\0'; 01320 break; 01321 } 01322 yyarg[yycount++] = yytname[yyx]; 01323 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01324 yysize_overflow |= (yysize1 < yysize); 01325 yysize = yysize1; 01326 yyfmt = yystpcpy (yyfmt, yyprefix); 01327 yyprefix = yyor; 01328 } 01329 01330 yyf = YY_(yyformat); 01331 yysize1 = yysize + yystrlen (yyf); 01332 yysize_overflow |= (yysize1 < yysize); 01333 yysize = yysize1; 01334 01335 if (yysize_overflow) 01336 return YYSIZE_MAXIMUM; 01337 01338 if (yyresult) 01339 { 01340 /* Avoid sprintf, as that infringes on the user's name space. 01341 Don't have undefined behavior even if the translation 01342 produced a string with the wrong number of "%s"s. */ 01343 char *yyp = yyresult; 01344 int yyi = 0; 01345 while ((*yyp = *yyf) != '\0') 01346 { 01347 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 01348 { 01349 yyp += yytnamerr (yyp, yyarg[yyi++]); 01350 yyf += 2; 01351 } 01352 else 01353 { 01354 yyp++; 01355 yyf++; 01356 } 01357 } 01358 } 01359 return yysize; 01360 } 01361 } 01362 #endif /* YYERROR_VERBOSE */ 01363 01364 01365 /*-----------------------------------------------. 01366 | Release the memory associated to this symbol. | 01367 `-----------------------------------------------*/ 01368 01369 /*ARGSUSED*/ 01370 #if (defined __STDC__ || defined __C99__FUNC__ \ 01371 || defined __cplusplus || defined _MSC_VER) 01372 static void 01373 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01374 #else 01375 static void 01376 yydestruct (yymsg, yytype, yyvaluep) 01377 const char *yymsg; 01378 int yytype; 01379 YYSTYPE *yyvaluep; 01380 #endif 01381 { 01382 YYUSE (yyvaluep); 01383 01384 if (!yymsg) 01385 yymsg = "Deleting"; 01386 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01387 01388 switch (yytype) 01389 { 01390 01391 default: 01392 break; 01393 } 01394 } 01395 01396 /* Prevent warnings from -Wmissing-prototypes. */ 01397 #ifdef YYPARSE_PARAM 01398 #if defined __STDC__ || defined __cplusplus 01399 int yyparse (void *YYPARSE_PARAM); 01400 #else 01401 int yyparse (); 01402 #endif 01403 #else /* ! YYPARSE_PARAM */ 01404 #if defined __STDC__ || defined __cplusplus 01405 int yyparse (void); 01406 #else 01407 int yyparse (); 01408 #endif 01409 #endif /* ! YYPARSE_PARAM */ 01410 01411 01412 /* The lookahead symbol. */ 01413 int yychar; 01414 01415 /* The semantic value of the lookahead symbol. */ 01416 YYSTYPE yylval; 01417 01418 /* Number of syntax errors so far. */ 01419 int yynerrs; 01420 01421 01422 01423 /*-------------------------. 01424 | yyparse or yypush_parse. | 01425 `-------------------------*/ 01426 01427 #ifdef YYPARSE_PARAM 01428 #if (defined __STDC__ || defined __C99__FUNC__ \ 01429 || defined __cplusplus || defined _MSC_VER) 01430 int 01431 yyparse (void *YYPARSE_PARAM) 01432 #else 01433 int 01434 yyparse (YYPARSE_PARAM) 01435 void *YYPARSE_PARAM; 01436 #endif 01437 #else /* ! YYPARSE_PARAM */ 01438 #if (defined __STDC__ || defined __C99__FUNC__ \ 01439 || defined __cplusplus || defined _MSC_VER) 01440 int 01441 yyparse (void) 01442 #else 01443 int 01444 yyparse () 01445 01446 #endif 01447 #endif 01448 { 01449 01450 01451 int yystate; 01452 /* Number of tokens to shift before error messages enabled. */ 01453 int yyerrstatus; 01454 01455 /* The stacks and their tools: 01456 `yyss': related to states. 01457 `yyvs': related to semantic values. 01458 01459 Refer to the stacks thru separate pointers, to allow yyoverflow 01460 to reallocate them elsewhere. */ 01461 01462 /* The state stack. */ 01463 yytype_int16 yyssa[YYINITDEPTH]; 01464 yytype_int16 *yyss; 01465 yytype_int16 *yyssp; 01466 01467 /* The semantic value stack. */ 01468 YYSTYPE yyvsa[YYINITDEPTH]; 01469 YYSTYPE *yyvs; 01470 YYSTYPE *yyvsp; 01471 01472 YYSIZE_T yystacksize; 01473 01474 int yyn; 01475 int yyresult; 01476 /* Lookahead token as an internal (translated) token number. */ 01477 int yytoken; 01478 /* The variables used to return semantic value and location from the 01479 action routines. */ 01480 YYSTYPE yyval; 01481 01482 #if YYERROR_VERBOSE 01483 /* Buffer for error messages, and its allocated size. */ 01484 char yymsgbuf[128]; 01485 char *yymsg = yymsgbuf; 01486 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01487 #endif 01488 01489 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01490 01491 /* The number of symbols on the RHS of the reduced rule. 01492 Keep to zero when no symbol should be popped. */ 01493 int yylen = 0; 01494 01495 yytoken = 0; 01496 yyss = yyssa; 01497 yyvs = yyvsa; 01498 yystacksize = YYINITDEPTH; 01499 01500 YYDPRINTF ((stderr, "Starting parse\n")); 01501 01502 yystate = 0; 01503 yyerrstatus = 0; 01504 yynerrs = 0; 01505 yychar = YYEMPTY; /* Cause a token to be read. */ 01506 01507 /* Initialize stack pointers. 01508 Waste one element of value and location stack 01509 so that they stay on the same level as the state stack. 01510 The wasted elements are never initialized. */ 01511 yyssp = yyss; 01512 yyvsp = yyvs; 01513 01514 goto yysetstate; 01515 01516 /*------------------------------------------------------------. 01517 | yynewstate -- Push a new state, which is found in yystate. | 01518 `------------------------------------------------------------*/ 01519 yynewstate: 01520 /* In all cases, when you get here, the value and location stacks 01521 have just been pushed. So pushing a state here evens the stacks. */ 01522 yyssp++; 01523 01524 yysetstate: 01525 *yyssp = yystate; 01526 01527 if (yyss + yystacksize - 1 <= yyssp) 01528 { 01529 /* Get the current used size of the three stacks, in elements. */ 01530 YYSIZE_T yysize = yyssp - yyss + 1; 01531 01532 #ifdef yyoverflow 01533 { 01534 /* Give user a chance to reallocate the stack. Use copies of 01535 these so that the &'s don't force the real ones into 01536 memory. */ 01537 YYSTYPE *yyvs1 = yyvs; 01538 yytype_int16 *yyss1 = yyss; 01539 01540 /* Each stack pointer address is followed by the size of the 01541 data in use in that stack, in bytes. This used to be a 01542 conditional around just the two extra args, but that might 01543 be undefined if yyoverflow is a macro. */ 01544 yyoverflow (YY_("memory exhausted"), 01545 &yyss1, yysize * sizeof (*yyssp), 01546 &yyvs1, yysize * sizeof (*yyvsp), 01547 &yystacksize); 01548 01549 yyss = yyss1; 01550 yyvs = yyvs1; 01551 } 01552 #else /* no yyoverflow */ 01553 # ifndef YYSTACK_RELOCATE 01554 goto yyexhaustedlab; 01555 # else 01556 /* Extend the stack our own way. */ 01557 if (YYMAXDEPTH <= yystacksize) 01558 goto yyexhaustedlab; 01559 yystacksize *= 2; 01560 if (YYMAXDEPTH < yystacksize) 01561 yystacksize = YYMAXDEPTH; 01562 01563 { 01564 yytype_int16 *yyss1 = yyss; 01565 union yyalloc *yyptr = 01566 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01567 if (! yyptr) 01568 goto yyexhaustedlab; 01569 YYSTACK_RELOCATE (yyss_alloc, yyss); 01570 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01571 # undef YYSTACK_RELOCATE 01572 if (yyss1 != yyssa) 01573 YYSTACK_FREE (yyss1); 01574 } 01575 # endif 01576 #endif /* no yyoverflow */ 01577 01578 yyssp = yyss + yysize - 1; 01579 yyvsp = yyvs + yysize - 1; 01580 01581 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01582 (unsigned long int) yystacksize)); 01583 01584 if (yyss + yystacksize - 1 <= yyssp) 01585 YYABORT; 01586 } 01587 01588 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01589 01590 if (yystate == YYFINAL) 01591 YYACCEPT; 01592 01593 goto yybackup; 01594 01595 /*-----------. 01596 | yybackup. | 01597 `-----------*/ 01598 yybackup: 01599 01600 /* Do appropriate processing given the current state. Read a 01601 lookahead token if we need one and don't already have one. */ 01602 01603 /* First try to decide what to do without reference to lookahead token. */ 01604 yyn = yypact[yystate]; 01605 if (yyn == YYPACT_NINF) 01606 goto yydefault; 01607 01608 /* Not known => get a lookahead token if don't already have one. */ 01609 01610 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01611 if (yychar == YYEMPTY) 01612 { 01613 YYDPRINTF ((stderr, "Reading a token: ")); 01614 yychar = YYLEX; 01615 } 01616 01617 if (yychar <= YYEOF) 01618 { 01619 yychar = yytoken = YYEOF; 01620 YYDPRINTF ((stderr, "Now at end of input.\n")); 01621 } 01622 else 01623 { 01624 yytoken = YYTRANSLATE (yychar); 01625 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01626 } 01627 01628 /* If the proper action on seeing token YYTOKEN is to reduce or to 01629 detect an error, take that action. */ 01630 yyn += yytoken; 01631 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01632 goto yydefault; 01633 yyn = yytable[yyn]; 01634 if (yyn <= 0) 01635 { 01636 if (yyn == 0 || yyn == YYTABLE_NINF) 01637 goto yyerrlab; 01638 yyn = -yyn; 01639 goto yyreduce; 01640 } 01641 01642 /* Count tokens shifted since error; after three, turn off error 01643 status. */ 01644 if (yyerrstatus) 01645 yyerrstatus--; 01646 01647 /* Shift the lookahead token. */ 01648 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01649 01650 /* Discard the shifted token. */ 01651 yychar = YYEMPTY; 01652 01653 yystate = yyn; 01654 *++yyvsp = yylval; 01655 01656 goto yynewstate; 01657 01658 01659 /*-----------------------------------------------------------. 01660 | yydefault -- do the default action for the current state. | 01661 `-----------------------------------------------------------*/ 01662 yydefault: 01663 yyn = yydefact[yystate]; 01664 if (yyn == 0) 01665 goto yyerrlab; 01666 goto yyreduce; 01667 01668 01669 /*-----------------------------. 01670 | yyreduce -- Do a reduction. | 01671 `-----------------------------*/ 01672 yyreduce: 01673 /* yyn is the number of a rule to reduce with. */ 01674 yylen = yyr2[yyn]; 01675 01676 /* If YYLEN is nonzero, implement the default value of the action: 01677 `$$ = $1'. 01678 01679 Otherwise, the following line sets YYVAL to garbage. 01680 This behavior is undocumented and Bison 01681 users should not rely upon it. Assigning to YYVAL 01682 unconditionally makes the parser a bit smaller, and it avoids a 01683 GCC warning that YYVAL may be used uninitialized. */ 01684 yyval = yyvsp[1-yylen]; 01685 01686 01687 YY_REDUCE_PRINT (yyn); 01688 switch (yyn) 01689 { 01690 case 24: 01691 01692 /* Line 1464 of yacc.c */ 01693 #line 284 "src/cfgparse.y" 01694 { 01695 TAILQ_INSERT_TAIL(bindings, (yyvsp[(1) - (1)].binding), bindings); 01696 ;} 01697 break; 01698 01699 case 25: 01700 01701 /* Line 1464 of yacc.c */ 01702 #line 290 "src/cfgparse.y" 01703 { (yyval.binding) = (yyvsp[(3) - (3)].binding); ;} 01704 break; 01705 01706 case 26: 01707 01708 /* Line 1464 of yacc.c */ 01709 #line 291 "src/cfgparse.y" 01710 { (yyval.binding) = (yyvsp[(3) - (3)].binding); ;} 01711 break; 01712 01713 case 27: 01714 01715 /* Line 1464 of yacc.c */ 01716 #line 296 "src/cfgparse.y" 01717 { 01718 printf("\tFound binding mod%d with key %d and command %s\n", (yyvsp[(1) - (4)].number), (yyvsp[(2) - (4)].number), (yyvsp[(4) - (4)].string)); 01719 Binding *new = scalloc(sizeof(Binding)); 01720 01721 new->keycode = (yyvsp[(2) - (4)].number); 01722 new->mods = (yyvsp[(1) - (4)].number); 01723 new->command = (yyvsp[(4) - (4)].string); 01724 01725 (yyval.binding) = new; 01726 ;} 01727 break; 01728 01729 case 28: 01730 01731 /* Line 1464 of yacc.c */ 01732 #line 310 "src/cfgparse.y" 01733 { 01734 printf("\tFound symbolic mod%d with key %s and command %s\n", (yyvsp[(1) - (4)].number), (yyvsp[(2) - (4)].string), (yyvsp[(4) - (4)].string)); 01735 Binding *new = scalloc(sizeof(Binding)); 01736 01737 new->symbol = (yyvsp[(2) - (4)].string); 01738 new->mods = (yyvsp[(1) - (4)].number); 01739 new->command = (yyvsp[(4) - (4)].string); 01740 01741 (yyval.binding) = new; 01742 ;} 01743 break; 01744 01745 case 30: 01746 01747 /* Line 1464 of yacc.c */ 01748 #line 325 "src/cfgparse.y" 01749 { 01750 asprintf(&(yyval.string), "%d", (yyvsp[(1) - (1)].number)); 01751 ;} 01752 break; 01753 01754 case 31: 01755 01756 /* Line 1464 of yacc.c */ 01757 #line 332 "src/cfgparse.y" 01758 { 01759 if (strcasecmp((yyvsp[(3) - (7)].string), "default") == 0) { 01760 printf("You cannot use the name \"default\" for your mode\n"); 01761 exit(1); 01762 } 01763 printf("\t now in mode %s\n", (yyvsp[(3) - (7)].string)); 01764 printf("\t current bindings = %p\n", current_bindings); 01765 Binding *binding; 01766 TAILQ_FOREACH(binding, current_bindings, bindings) { 01767 printf("got binding on mods %d, keycode %d, symbol %s, command %s\n", 01768 binding->mods, binding->keycode, binding->symbol, binding->command); 01769 } 01770 01771 struct Mode *mode = scalloc(sizeof(struct Mode)); 01772 mode->name = (yyvsp[(3) - (7)].string); 01773 mode->bindings = current_bindings; 01774 current_bindings = NULL; 01775 SLIST_INSERT_HEAD(&modes, mode, modes); 01776 ;} 01777 break; 01778 01779 case 36: 01780 01781 /* Line 1464 of yacc.c */ 01782 #line 363 "src/cfgparse.y" 01783 { 01784 if (current_bindings == NULL) { 01785 current_bindings = scalloc(sizeof(struct bindings_head)); 01786 TAILQ_INIT(current_bindings); 01787 } 01788 01789 TAILQ_INSERT_TAIL(current_bindings, (yyvsp[(1) - (1)].binding), bindings); 01790 ;} 01791 break; 01792 01793 case 37: 01794 01795 /* Line 1464 of yacc.c */ 01796 #line 375 "src/cfgparse.y" 01797 { 01798 DLOG("floating modifier = %d\n", (yyvsp[(3) - (3)].number)); 01799 config.floating_modifier = (yyvsp[(3) - (3)].number); 01800 ;} 01801 break; 01802 01803 case 38: 01804 01805 /* Line 1464 of yacc.c */ 01806 #line 383 "src/cfgparse.y" 01807 { 01808 DLOG("new containers will be in mode %d\n", (yyvsp[(3) - (3)].number)); 01809 config.container_mode = (yyvsp[(3) - (3)].number); 01810 01811 /* We also need to change the layout of the already existing 01812 * workspaces here. Workspaces may exist at this point because 01813 * of the other directives which are modifying workspaces 01814 * (setting the preferred screen or name). While the workspace 01815 * objects are already created, they have never been used. 01816 * Thus, the user very likely awaits the default container mode 01817 * to trigger in this case, regardless of where it is inside 01818 * his configuration file. */ 01819 Workspace *ws; 01820 TAILQ_FOREACH(ws, workspaces, workspaces) { 01821 if (ws->table == NULL) 01822 continue; 01823 switch_layout_mode(global_conn, 01824 ws->table[0][0], 01825 config.container_mode); 01826 } 01827 ;} 01828 break; 01829 01830 case 39: 01831 01832 /* Line 1464 of yacc.c */ 01833 #line 405 "src/cfgparse.y" 01834 { 01835 DLOG("stack-limit %d with val %d\n", (yyvsp[(5) - (7)].number), (yyvsp[(7) - (7)].number)); 01836 config.container_stack_limit = (yyvsp[(5) - (7)].number); 01837 config.container_stack_limit_value = (yyvsp[(7) - (7)].number); 01838 01839 /* See the comment above */ 01840 Workspace *ws; 01841 TAILQ_FOREACH(ws, workspaces, workspaces) { 01842 if (ws->table == NULL) 01843 continue; 01844 Container *con = ws->table[0][0]; 01845 con->stack_limit = config.container_stack_limit; 01846 con->stack_limit_value = config.container_stack_limit_value; 01847 } 01848 ;} 01849 break; 01850 01851 case 40: 01852 01853 /* Line 1464 of yacc.c */ 01854 #line 424 "src/cfgparse.y" 01855 { 01856 DLOG("new windows should start in mode %s\n", (yyvsp[(3) - (3)].string)); 01857 config.default_border = sstrdup((yyvsp[(3) - (3)].string)); 01858 ;} 01859 break; 01860 01861 case 41: 01862 01863 /* Line 1464 of yacc.c */ 01864 #line 432 "src/cfgparse.y" 01865 { 01866 (yyval.number) = ((yyvsp[(1) - (1)].number) == 1); 01867 ;} 01868 break; 01869 01870 case 42: 01871 01872 /* Line 1464 of yacc.c */ 01873 #line 436 "src/cfgparse.y" 01874 { 01875 DLOG("checking word \"%s\"\n", (yyvsp[(1) - (1)].string)); 01876 (yyval.number) = (strcasecmp((yyvsp[(1) - (1)].string), "yes") == 0 || 01877 strcasecmp((yyvsp[(1) - (1)].string), "true") == 0 || 01878 strcasecmp((yyvsp[(1) - (1)].string), "on") == 0 || 01879 strcasecmp((yyvsp[(1) - (1)].string), "enable") == 0 || 01880 strcasecmp((yyvsp[(1) - (1)].string), "active") == 0); 01881 ;} 01882 break; 01883 01884 case 43: 01885 01886 /* Line 1464 of yacc.c */ 01887 #line 448 "src/cfgparse.y" 01888 { 01889 DLOG("focus follows mouse = %d\n", (yyvsp[(3) - (3)].number)); 01890 config.disable_focus_follows_mouse = !((yyvsp[(3) - (3)].number)); 01891 ;} 01892 break; 01893 01894 case 44: 01895 01896 /* Line 1464 of yacc.c */ 01897 #line 456 "src/cfgparse.y" 01898 { 01899 DLOG("workspace bar = %d\n", (yyvsp[(3) - (3)].number)); 01900 config.disable_workspace_bar = !((yyvsp[(3) - (3)].number)); 01901 ;} 01902 break; 01903 01904 case 45: 01905 01906 /* Line 1464 of yacc.c */ 01907 #line 464 "src/cfgparse.y" 01908 { 01909 int ws_num = (yyvsp[(3) - (8)].number); 01910 if (ws_num < 1) { 01911 DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num); 01912 } else { 01913 Workspace *ws = workspace_get(ws_num - 1); 01914 ws->preferred_output = (yyvsp[(7) - (8)].string); 01915 if ((yyvsp[(8) - (8)].string) != NULL) { 01916 workspace_set_name(ws, (yyvsp[(8) - (8)].string)); 01917 free((yyvsp[(8) - (8)].string)); 01918 } 01919 } 01920 ;} 01921 break; 01922 01923 case 46: 01924 01925 /* Line 1464 of yacc.c */ 01926 #line 478 "src/cfgparse.y" 01927 { 01928 int ws_num = (yyvsp[(3) - (5)].number); 01929 if (ws_num < 1) { 01930 DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num); 01931 } else { 01932 DLOG("workspace name to: %s\n", (yyvsp[(5) - (5)].string)); 01933 if ((yyvsp[(5) - (5)].string) != NULL) { 01934 workspace_set_name(workspace_get(ws_num - 1), (yyvsp[(5) - (5)].string)); 01935 free((yyvsp[(5) - (5)].string)); 01936 } 01937 } 01938 ;} 01939 break; 01940 01941 case 47: 01942 01943 /* Line 1464 of yacc.c */ 01944 #line 493 "src/cfgparse.y" 01945 { (yyval.string) = NULL; ;} 01946 break; 01947 01948 case 48: 01949 01950 /* Line 1464 of yacc.c */ 01951 #line 494 "src/cfgparse.y" 01952 { (yyval.string) = (yyvsp[(2) - (2)].string); ;} 01953 break; 01954 01955 case 49: 01956 01957 /* Line 1464 of yacc.c */ 01958 #line 498 "src/cfgparse.y" 01959 { (yyval.string) = (yyvsp[(1) - (1)].string); ;} 01960 break; 01961 01962 case 50: 01963 01964 /* Line 1464 of yacc.c */ 01965 #line 499 "src/cfgparse.y" 01966 { (yyval.string) = (yyvsp[(1) - (1)].string); ;} 01967 break; 01968 01969 case 51: 01970 01971 /* Line 1464 of yacc.c */ 01972 #line 500 "src/cfgparse.y" 01973 { (yyval.string) = (yyvsp[(1) - (1)].string); ;} 01974 break; 01975 01976 case 52: 01977 01978 /* Line 1464 of yacc.c */ 01979 #line 505 "src/cfgparse.y" 01980 { 01981 DLOG("assignment of %s\n", (yyvsp[(3) - (6)].string)); 01982 01983 struct Assignment *new = (yyvsp[(6) - (6)].assignment); 01984 if (new->floating != ASSIGN_FLOATING_ONLY && new->workspace < 1) { 01985 DLOG("Invalid client assignment, workspace number %d out of range\n", new->workspace); 01986 free(new); 01987 } else { 01988 DLOG(" to %d\n", new->workspace); 01989 DLOG(" floating = %d\n", new->floating); 01990 new->windowclass_title = (yyvsp[(3) - (6)].string); 01991 TAILQ_INSERT_TAIL(&assignments, new, assignments); 01992 } 01993 ;} 01994 break; 01995 01996 case 53: 01997 01998 /* Line 1464 of yacc.c */ 01999 #line 523 "src/cfgparse.y" 02000 { 02001 struct Assignment *new = scalloc(sizeof(struct Assignment)); 02002 new->workspace = (yyvsp[(1) - (1)].number); 02003 new->floating = ASSIGN_FLOATING_NO; 02004 (yyval.assignment) = new; 02005 ;} 02006 break; 02007 02008 case 54: 02009 02010 /* Line 1464 of yacc.c */ 02011 #line 530 "src/cfgparse.y" 02012 { 02013 struct Assignment *new = scalloc(sizeof(struct Assignment)); 02014 new->floating = ASSIGN_FLOATING_ONLY; 02015 (yyval.assignment) = new; 02016 ;} 02017 break; 02018 02019 case 55: 02020 02021 /* Line 1464 of yacc.c */ 02022 #line 536 "src/cfgparse.y" 02023 { 02024 struct Assignment *new = scalloc(sizeof(struct Assignment)); 02025 new->workspace = (yyvsp[(2) - (2)].number); 02026 new->floating = ASSIGN_FLOATING; 02027 (yyval.assignment) = new; 02028 ;} 02029 break; 02030 02031 case 60: 02032 02033 /* Line 1464 of yacc.c */ 02034 #line 556 "src/cfgparse.y" 02035 { 02036 config.ipc_socket_path = (yyvsp[(3) - (3)].string); 02037 ;} 02038 break; 02039 02040 case 61: 02041 02042 /* Line 1464 of yacc.c */ 02043 #line 563 "src/cfgparse.y" 02044 { 02045 struct Autostart *new = smalloc(sizeof(struct Autostart)); 02046 new->command = (yyvsp[(3) - (3)].string); 02047 TAILQ_INSERT_TAIL(&autostarts, new, autostarts); 02048 ;} 02049 break; 02050 02051 case 62: 02052 02053 /* Line 1464 of yacc.c */ 02054 #line 572 "src/cfgparse.y" 02055 { 02056 ELOG("The terminal option is DEPRECATED and has no effect. " 02057 "Please remove it from your configuration file.\n"); 02058 ;} 02059 break; 02060 02061 case 63: 02062 02063 /* Line 1464 of yacc.c */ 02064 #line 580 "src/cfgparse.y" 02065 { 02066 config.font = (yyvsp[(3) - (3)].string); 02067 printf("font %s\n", config.font); 02068 ;} 02069 break; 02070 02071 case 64: 02072 02073 /* Line 1464 of yacc.c */ 02074 #line 588 "src/cfgparse.y" 02075 { 02076 uint32_t *dest = (yyvsp[(1) - (3)].single_color); 02077 *dest = (yyvsp[(3) - (3)].number); 02078 ;} 02079 break; 02080 02081 case 65: 02082 02083 /* Line 1464 of yacc.c */ 02084 #line 596 "src/cfgparse.y" 02085 { 02086 struct Colortriple *dest = (yyvsp[(1) - (7)].color); 02087 02088 dest->border = (yyvsp[(3) - (7)].number); 02089 dest->background = (yyvsp[(5) - (7)].number); 02090 dest->text = (yyvsp[(7) - (7)].number); 02091 ;} 02092 break; 02093 02094 case 66: 02095 02096 /* Line 1464 of yacc.c */ 02097 #line 607 "src/cfgparse.y" 02098 { 02099 char *hex; 02100 if (asprintf(&hex, "#%s", (yyvsp[(2) - (2)].string)) == -1) 02101 die("asprintf()"); 02102 (yyval.number) = get_colorpixel(global_conn, hex); 02103 free(hex); 02104 ;} 02105 break; 02106 02107 case 67: 02108 02109 /* Line 1464 of yacc.c */ 02110 #line 618 "src/cfgparse.y" 02111 { (yyval.number) = 0; ;} 02112 break; 02113 02114 case 69: 02115 02116 /* Line 1464 of yacc.c */ 02117 #line 620 "src/cfgparse.y" 02118 { (yyval.number) = (yyvsp[(1) - (3)].number) | (yyvsp[(3) - (3)].number); ;} 02119 break; 02120 02121 case 70: 02122 02123 /* Line 1464 of yacc.c */ 02124 #line 621 "src/cfgparse.y" 02125 { (yyval.number) = (yyvsp[(1) - (2)].number); ;} 02126 break; 02127 02128 case 71: 02129 02130 /* Line 1464 of yacc.c */ 02131 #line 625 "src/cfgparse.y" 02132 { (yyval.number) = (yyvsp[(1) - (1)].number); ;} 02133 break; 02134 02135 case 72: 02136 02137 /* Line 1464 of yacc.c */ 02138 #line 626 "src/cfgparse.y" 02139 { (yyval.number) = BIND_CONTROL; ;} 02140 break; 02141 02142 case 73: 02143 02144 /* Line 1464 of yacc.c */ 02145 #line 627 "src/cfgparse.y" 02146 { (yyval.number) = BIND_SHIFT; ;} 02147 break; 02148 02149 02150 02151 /* Line 1464 of yacc.c */ 02152 #line 2153 "src/cfgparse.tab.c" 02153 default: break; 02154 } 02155 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 02156 02157 YYPOPSTACK (yylen); 02158 yylen = 0; 02159 YY_STACK_PRINT (yyss, yyssp); 02160 02161 *++yyvsp = yyval; 02162 02163 /* Now `shift' the result of the reduction. Determine what state 02164 that goes to, based on the state we popped back to and the rule 02165 number reduced by. */ 02166 02167 yyn = yyr1[yyn]; 02168 02169 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 02170 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 02171 yystate = yytable[yystate]; 02172 else 02173 yystate = yydefgoto[yyn - YYNTOKENS]; 02174 02175 goto yynewstate; 02176 02177 02178 /*------------------------------------. 02179 | yyerrlab -- here on detecting error | 02180 `------------------------------------*/ 02181 yyerrlab: 02182 /* If not already recovering from an error, report this error. */ 02183 if (!yyerrstatus) 02184 { 02185 ++yynerrs; 02186 #if ! YYERROR_VERBOSE 02187 yyerror (YY_("syntax error")); 02188 #else 02189 { 02190 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 02191 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 02192 { 02193 YYSIZE_T yyalloc = 2 * yysize; 02194 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 02195 yyalloc = YYSTACK_ALLOC_MAXIMUM; 02196 if (yymsg != yymsgbuf) 02197 YYSTACK_FREE (yymsg); 02198 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 02199 if (yymsg) 02200 yymsg_alloc = yyalloc; 02201 else 02202 { 02203 yymsg = yymsgbuf; 02204 yymsg_alloc = sizeof yymsgbuf; 02205 } 02206 } 02207 02208 if (0 < yysize && yysize <= yymsg_alloc) 02209 { 02210 (void) yysyntax_error (yymsg, yystate, yychar); 02211 yyerror (yymsg); 02212 } 02213 else 02214 { 02215 yyerror (YY_("syntax error")); 02216 if (yysize != 0) 02217 goto yyexhaustedlab; 02218 } 02219 } 02220 #endif 02221 } 02222 02223 02224 02225 if (yyerrstatus == 3) 02226 { 02227 /* If just tried and failed to reuse lookahead token after an 02228 error, discard it. */ 02229 02230 if (yychar <= YYEOF) 02231 { 02232 /* Return failure if at end of input. */ 02233 if (yychar == YYEOF) 02234 YYABORT; 02235 } 02236 else 02237 { 02238 yydestruct ("Error: discarding", 02239 yytoken, &yylval); 02240 yychar = YYEMPTY; 02241 } 02242 } 02243 02244 /* Else will try to reuse lookahead token after shifting the error 02245 token. */ 02246 goto yyerrlab1; 02247 02248 02249 /*---------------------------------------------------. 02250 | yyerrorlab -- error raised explicitly by YYERROR. | 02251 `---------------------------------------------------*/ 02252 yyerrorlab: 02253 02254 /* Pacify compilers like GCC when the user code never invokes 02255 YYERROR and the label yyerrorlab therefore never appears in user 02256 code. */ 02257 if (/*CONSTCOND*/ 0) 02258 goto yyerrorlab; 02259 02260 /* Do not reclaim the symbols of the rule which action triggered 02261 this YYERROR. */ 02262 YYPOPSTACK (yylen); 02263 yylen = 0; 02264 YY_STACK_PRINT (yyss, yyssp); 02265 yystate = *yyssp; 02266 goto yyerrlab1; 02267 02268 02269 /*-------------------------------------------------------------. 02270 | yyerrlab1 -- common code for both syntax error and YYERROR. | 02271 `-------------------------------------------------------------*/ 02272 yyerrlab1: 02273 yyerrstatus = 3; /* Each real token shifted decrements this. */ 02274 02275 for (;;) 02276 { 02277 yyn = yypact[yystate]; 02278 if (yyn != YYPACT_NINF) 02279 { 02280 yyn += YYTERROR; 02281 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 02282 { 02283 yyn = yytable[yyn]; 02284 if (0 < yyn) 02285 break; 02286 } 02287 } 02288 02289 /* Pop the current state because it cannot handle the error token. */ 02290 if (yyssp == yyss) 02291 YYABORT; 02292 02293 02294 yydestruct ("Error: popping", 02295 yystos[yystate], yyvsp); 02296 YYPOPSTACK (1); 02297 yystate = *yyssp; 02298 YY_STACK_PRINT (yyss, yyssp); 02299 } 02300 02301 *++yyvsp = yylval; 02302 02303 02304 /* Shift the error token. */ 02305 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 02306 02307 yystate = yyn; 02308 goto yynewstate; 02309 02310 02311 /*-------------------------------------. 02312 | yyacceptlab -- YYACCEPT comes here. | 02313 `-------------------------------------*/ 02314 yyacceptlab: 02315 yyresult = 0; 02316 goto yyreturn; 02317 02318 /*-----------------------------------. 02319 | yyabortlab -- YYABORT comes here. | 02320 `-----------------------------------*/ 02321 yyabortlab: 02322 yyresult = 1; 02323 goto yyreturn; 02324 02325 #if !defined(yyoverflow) || YYERROR_VERBOSE 02326 /*-------------------------------------------------. 02327 | yyexhaustedlab -- memory exhaustion comes here. | 02328 `-------------------------------------------------*/ 02329 yyexhaustedlab: 02330 yyerror (YY_("memory exhausted")); 02331 yyresult = 2; 02332 /* Fall through. */ 02333 #endif 02334 02335 yyreturn: 02336 if (yychar != YYEMPTY) 02337 yydestruct ("Cleanup: discarding lookahead", 02338 yytoken, &yylval); 02339 /* Do not reclaim the symbols of the rule which action triggered 02340 this YYABORT or YYACCEPT. */ 02341 YYPOPSTACK (yylen); 02342 YY_STACK_PRINT (yyss, yyssp); 02343 while (yyssp != yyss) 02344 { 02345 yydestruct ("Cleanup: popping", 02346 yystos[*yyssp], yyvsp); 02347 YYPOPSTACK (1); 02348 } 02349 #ifndef yyoverflow 02350 if (yyss != yyssa) 02351 YYSTACK_FREE (yyss); 02352 #endif 02353 #if YYERROR_VERBOSE 02354 if (yymsg != yymsgbuf) 02355 YYSTACK_FREE (yymsg); 02356 #endif 02357 /* Make sure YYID is used. */ 02358 return YYID (yyresult); 02359 } 02360 02361 02362