i3
src/cmdparse.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 /* Substitute the variable and function names.  */
00066 #define yyparse         cmdyyparse
00067 #define yylex           cmdyylex
00068 #define yyerror         cmdyyerror
00069 #define yylval          cmdyylval
00070 #define yychar          cmdyychar
00071 #define yydebug         cmdyydebug
00072 #define yynerrs         cmdyynerrs
00073 
00074 
00075 /* Copy the first part of user declarations.  */
00076 
00077 /* Line 189 of yacc.c  */
00078 #line 1 "src/cmdparse.y"
00079 
00080 /*
00081  * vim:ts=4:sw=4:expandtab
00082  *
00083  * i3 - an improved dynamic tiling window manager
00084  * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
00085  *
00086  * cmdparse.y: the parser for commands you send to i3 (or bind on keys)
00087  *
00088 
00089  */
00090 #include <sys/types.h>
00091 #include <sys/stat.h>
00092 #include <unistd.h>
00093 #include <fcntl.h>
00094 #include <limits.h>
00095 
00096 #include "all.h"
00097 
00103 #define HANDLE_EMPTY_MATCH do { \
00104     if (match_is_empty(&current_match)) { \
00105         owindow *ow = smalloc(sizeof(owindow)); \
00106         ow->con = focused; \
00107         TAILQ_INIT(&owindows); \
00108         TAILQ_INSERT_TAIL(&owindows, ow, owindows); \
00109     } \
00110 } while (0)
00111 
00112 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00113 extern int cmdyylex(struct context *context);
00114 extern int cmdyyparse(void);
00115 extern int cmdyylex_destroy(void);
00116 extern FILE *cmdyyin;
00117 YY_BUFFER_STATE cmdyy_scan_string(const char *);
00118 
00119 static struct context *context;
00120 static Match current_match;
00121 
00122 /*
00123  * Helper data structure for an operation window (window on which the operation
00124  * will be performed). Used to build the TAILQ owindows.
00125  *
00126  */
00127 typedef struct owindow {
00128     Con *con;
00129     TAILQ_ENTRY(owindow) owindows;
00130 } owindow;
00131 static TAILQ_HEAD(owindows_head, owindow) owindows;
00132 
00133 /* Holds the JSON which will be returned via IPC or NULL for the default return
00134  * message */
00135 static char *json_output;
00136 
00137 /* We don’t need yydebug for now, as we got decent error messages using
00138  * yyerror(). Should you ever want to extend the parser, it might be handy
00139  * to just comment it in again, so it stays here. */
00140 //int cmdyydebug = 1;
00141 
00142 void cmdyyerror(const char *error_message) {
00143     ELOG("\n");
00144     ELOG("CMD: %s\n", error_message);
00145     ELOG("CMD: in command:\n");
00146     ELOG("CMD:   %s\n", context->line_copy);
00147     ELOG("CMD:   ");
00148     for (int c = 1; c <= context->last_column; c++)
00149         if (c >= context->first_column)
00150                 printf("^");
00151         else printf(" ");
00152     printf("\n");
00153     ELOG("\n");
00154     context->compact_error = sstrdup(error_message);
00155 }
00156 
00157 int cmdyywrap() {
00158     return 1;
00159 }
00160 
00161 char *parse_cmd(const char *new) {
00162     LOG("COMMAND: *%s*\n", new);
00163     cmdyy_scan_string(new);
00164 
00165     match_init(&current_match);
00166     context = scalloc(sizeof(struct context));
00167     context->filename = "cmd";
00168     FREE(json_output);
00169     if (cmdyyparse() != 0) {
00170         fprintf(stderr, "Could not parse command\n");
00171         asprintf(&json_output, "{\"success\":false, \"error\":\"%s at position %d\"}",
00172                  context->compact_error, context->first_column);
00173         FREE(context->line_copy);
00174         FREE(context->compact_error);
00175         free(context);
00176         return json_output;
00177     }
00178     printf("done, json output = %s\n", json_output);
00179 
00180     cmdyylex_destroy();
00181     FREE(context->line_copy);
00182     FREE(context->compact_error);
00183     free(context);
00184     return json_output;
00185 }
00186 
00187 
00188 
00189 /* Line 189 of yacc.c  */
00190 #line 191 "src/cmdparse.tab.c"
00191 
00192 /* Enabling traces.  */
00193 #ifndef YYDEBUG
00194 # define YYDEBUG 1
00195 #endif
00196 
00197 /* Enabling verbose error messages.  */
00198 #ifdef YYERROR_VERBOSE
00199 # undef YYERROR_VERBOSE
00200 # define YYERROR_VERBOSE 1
00201 #else
00202 # define YYERROR_VERBOSE 1
00203 #endif
00204 
00205 /* Enabling the token table.  */
00206 #ifndef YYTOKEN_TABLE
00207 # define YYTOKEN_TABLE 0
00208 #endif
00209 
00210 
00211 /* Tokens.  */
00212 #ifndef YYTOKENTYPE
00213 # define YYTOKENTYPE
00214    /* Put the tokens into the symbol table, so that GDB and other debuggers
00215       know about them.  */
00216    enum yytokentype {
00217      TOK_EXEC = 258,
00218      TOK_EXIT = 259,
00219      TOK_RELOAD = 260,
00220      TOK_RESTART = 261,
00221      TOK_KILL = 262,
00222      TOK_WINDOW = 263,
00223      TOK_CLIENT = 264,
00224      TOK_FULLSCREEN = 265,
00225      TOK_GLOBAL = 266,
00226      TOK_LAYOUT = 267,
00227      TOK_DEFAULT = 268,
00228      TOK_STACKED = 269,
00229      TOK_TABBED = 270,
00230      TOK_BORDER = 271,
00231      TOK_NORMAL = 272,
00232      TOK_NONE = 273,
00233      TOK_1PIXEL = 274,
00234      TOK_MODE = 275,
00235      TOK_TILING = 276,
00236      TOK_FLOATING = 277,
00237      TOK_MODE_TOGGLE = 278,
00238      TOK_ENABLE = 279,
00239      TOK_DISABLE = 280,
00240      TOK_WORKSPACE = 281,
00241      TOK_TOGGLE = 282,
00242      TOK_FOCUS = 283,
00243      TOK_MOVE = 284,
00244      TOK_OPEN = 285,
00245      TOK_NEXT = 286,
00246      TOK_PREV = 287,
00247      TOK_SPLIT = 288,
00248      TOK_HORIZONTAL = 289,
00249      TOK_VERTICAL = 290,
00250      TOK_UP = 291,
00251      TOK_DOWN = 292,
00252      TOK_LEFT = 293,
00253      TOK_RIGHT = 294,
00254      TOK_PARENT = 295,
00255      TOK_CHILD = 296,
00256      TOK_APPEND_LAYOUT = 297,
00257      TOK_MARK = 298,
00258      TOK_RESIZE = 299,
00259      TOK_GROW = 300,
00260      TOK_SHRINK = 301,
00261      TOK_PX = 302,
00262      TOK_OR = 303,
00263      TOK_PPT = 304,
00264      TOK_NOP = 305,
00265      TOK_CLASS = 306,
00266      TOK_ID = 307,
00267      TOK_CON_ID = 308,
00268      TOK_TITLE = 309,
00269      STR = 310,
00270      NUMBER = 311
00271    };
00272 #endif
00273 
00274 
00275 
00276 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00277 typedef union YYSTYPE
00278 {
00279 
00280 /* Line 214 of yacc.c  */
00281 #line 114 "src/cmdparse.y"
00282 
00283     char *string;
00284     char chr;
00285     int number;
00286 
00287 
00288 
00289 /* Line 214 of yacc.c  */
00290 #line 291 "src/cmdparse.tab.c"
00291 } YYSTYPE;
00292 # define YYSTYPE_IS_TRIVIAL 1
00293 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00294 # define YYSTYPE_IS_DECLARED 1
00295 #endif
00296 
00297 
00298 /* Copy the second part of user declarations.  */
00299 
00300 
00301 /* Line 264 of yacc.c  */
00302 #line 303 "src/cmdparse.tab.c"
00303 
00304 #ifdef short
00305 # undef short
00306 #endif
00307 
00308 #ifdef YYTYPE_UINT8
00309 typedef YYTYPE_UINT8 yytype_uint8;
00310 #else
00311 typedef unsigned char yytype_uint8;
00312 #endif
00313 
00314 #ifdef YYTYPE_INT8
00315 typedef YYTYPE_INT8 yytype_int8;
00316 #elif (defined __STDC__ || defined __C99__FUNC__ \
00317      || defined __cplusplus || defined _MSC_VER)
00318 typedef signed char yytype_int8;
00319 #else
00320 typedef short int yytype_int8;
00321 #endif
00322 
00323 #ifdef YYTYPE_UINT16
00324 typedef YYTYPE_UINT16 yytype_uint16;
00325 #else
00326 typedef unsigned short int yytype_uint16;
00327 #endif
00328 
00329 #ifdef YYTYPE_INT16
00330 typedef YYTYPE_INT16 yytype_int16;
00331 #else
00332 typedef short int yytype_int16;
00333 #endif
00334 
00335 #ifndef YYSIZE_T
00336 # ifdef __SIZE_TYPE__
00337 #  define YYSIZE_T __SIZE_TYPE__
00338 # elif defined size_t
00339 #  define YYSIZE_T size_t
00340 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00341      || defined __cplusplus || defined _MSC_VER)
00342 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00343 #  define YYSIZE_T size_t
00344 # else
00345 #  define YYSIZE_T unsigned int
00346 # endif
00347 #endif
00348 
00349 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00350 
00351 #ifndef YY_
00352 # if defined YYENABLE_NLS && YYENABLE_NLS
00353 #  if ENABLE_NLS
00354 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00355 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
00356 #  endif
00357 # endif
00358 # ifndef YY_
00359 #  define YY_(msgid) msgid
00360 # endif
00361 #endif
00362 
00363 /* Suppress unused-variable warnings by "using" E.  */
00364 #if ! defined lint || defined __GNUC__
00365 # define YYUSE(e) ((void) (e))
00366 #else
00367 # define YYUSE(e) /* empty */
00368 #endif
00369 
00370 /* Identity function, used to suppress warnings about constant conditions.  */
00371 #ifndef lint
00372 # define YYID(n) (n)
00373 #else
00374 #if (defined __STDC__ || defined __C99__FUNC__ \
00375      || defined __cplusplus || defined _MSC_VER)
00376 static int
00377 YYID (int yyi)
00378 #else
00379 static int
00380 YYID (yyi)
00381     int yyi;
00382 #endif
00383 {
00384   return yyi;
00385 }
00386 #endif
00387 
00388 #if ! defined yyoverflow || YYERROR_VERBOSE
00389 
00390 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00391 
00392 # ifdef YYSTACK_USE_ALLOCA
00393 #  if YYSTACK_USE_ALLOCA
00394 #   ifdef __GNUC__
00395 #    define YYSTACK_ALLOC __builtin_alloca
00396 #   elif defined __BUILTIN_VA_ARG_INCR
00397 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00398 #   elif defined _AIX
00399 #    define YYSTACK_ALLOC __alloca
00400 #   elif defined _MSC_VER
00401 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
00402 #    define alloca _alloca
00403 #   else
00404 #    define YYSTACK_ALLOC alloca
00405 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00406      || defined __cplusplus || defined _MSC_VER)
00407 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00408 #     ifndef _STDLIB_H
00409 #      define _STDLIB_H 1
00410 #     endif
00411 #    endif
00412 #   endif
00413 #  endif
00414 # endif
00415 
00416 # ifdef YYSTACK_ALLOC
00417    /* Pacify GCC's `empty if-body' warning.  */
00418 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
00419 #  ifndef YYSTACK_ALLOC_MAXIMUM
00420     /* The OS might guarantee only one guard page at the bottom of the stack,
00421        and a page size can be as small as 4096 bytes.  So we cannot safely
00422        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
00423        to allow for a few compiler-allocated temporary stack slots.  */
00424 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
00425 #  endif
00426 # else
00427 #  define YYSTACK_ALLOC YYMALLOC
00428 #  define YYSTACK_FREE YYFREE
00429 #  ifndef YYSTACK_ALLOC_MAXIMUM
00430 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00431 #  endif
00432 #  if (defined __cplusplus && ! defined _STDLIB_H \
00433        && ! ((defined YYMALLOC || defined malloc) \
00434              && (defined YYFREE || defined free)))
00435 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00436 #   ifndef _STDLIB_H
00437 #    define _STDLIB_H 1
00438 #   endif
00439 #  endif
00440 #  ifndef YYMALLOC
00441 #   define YYMALLOC malloc
00442 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00443      || defined __cplusplus || defined _MSC_VER)
00444 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
00445 #   endif
00446 #  endif
00447 #  ifndef YYFREE
00448 #   define YYFREE free
00449 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00450      || defined __cplusplus || defined _MSC_VER)
00451 void free (void *); /* INFRINGES ON USER NAME SPACE */
00452 #   endif
00453 #  endif
00454 # endif
00455 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
00456 
00457 
00458 #if (! defined yyoverflow \
00459      && (! defined __cplusplus \
00460          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00461 
00462 /* A type that is properly aligned for any stack member.  */
00463 union yyalloc
00464 {
00465   yytype_int16 yyss_alloc;
00466   YYSTYPE yyvs_alloc;
00467 };
00468 
00469 /* The size of the maximum gap between one aligned stack and the next.  */
00470 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00471 
00472 /* The size of an array large to enough to hold all stacks, each with
00473    N elements.  */
00474 # define YYSTACK_BYTES(N) \
00475      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00476       + YYSTACK_GAP_MAXIMUM)
00477 
00478 /* Copy COUNT objects from FROM to TO.  The source and destination do
00479    not overlap.  */
00480 # ifndef YYCOPY
00481 #  if defined __GNUC__ && 1 < __GNUC__
00482 #   define YYCOPY(To, From, Count) \
00483       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00484 #  else
00485 #   define YYCOPY(To, From, Count)              \
00486       do                                        \
00487         {                                       \
00488           YYSIZE_T yyi;                         \
00489           for (yyi = 0; yyi < (Count); yyi++)   \
00490             (To)[yyi] = (From)[yyi];            \
00491         }                                       \
00492       while (YYID (0))
00493 #  endif
00494 # endif
00495 
00496 /* Relocate STACK from its old location to the new one.  The
00497    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00498    elements in the stack, and YYPTR gives the new location of the
00499    stack.  Advance YYPTR to a properly aligned location for the next
00500    stack.  */
00501 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
00502     do                                                                  \
00503       {                                                                 \
00504         YYSIZE_T yynewbytes;                                            \
00505         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
00506         Stack = &yyptr->Stack_alloc;                                    \
00507         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00508         yyptr += yynewbytes / sizeof (*yyptr);                          \
00509       }                                                                 \
00510     while (YYID (0))
00511 
00512 #endif
00513 
00514 /* YYFINAL -- State number of the termination state.  */
00515 #define YYFINAL  6
00516 /* YYLAST -- Last index in YYTABLE.  */
00517 #define YYLAST   99
00518 
00519 /* YYNTOKENS -- Number of terminals.  */
00520 #define YYNTOKENS  64
00521 /* YYNNTS -- Number of nonterminals.  */
00522 #define YYNNTS  41
00523 /* YYNRULES -- Number of rules.  */
00524 #define YYNRULES  95
00525 /* YYNRULES -- Number of states.  */
00526 #define YYNSTATES  128
00527 
00528 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00529 #define YYUNDEFTOK  2
00530 #define YYMAXUTOK   311
00531 
00532 #define YYTRANSLATE(YYX)                                                \
00533   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00534 
00535 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00536 static const yytype_uint8 yytranslate[] =
00537 {
00538        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00539        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00540        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00541        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00542        2,     2,     2,     2,    61,     2,     2,     2,     2,     2,
00543        2,     2,     2,     2,     2,     2,     2,     2,     2,    57,
00544        2,    60,     2,     2,     2,     2,     2,     2,     2,     2,
00545        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00546        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00547        2,    58,     2,    59,     2,     2,     2,     2,     2,     2,
00548        2,     2,     2,     2,    62,     2,     2,     2,     2,     2,
00549        2,     2,     2,     2,     2,     2,     2,     2,    63,     2,
00550        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00551        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00552        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00553        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00554        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00555        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00556        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00557        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00558        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00559        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00560        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00561        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00562        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00563        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00564        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
00565       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
00566       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
00567       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
00568       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
00569       55,    56
00570 };
00571 
00572 #if YYDEBUG
00573 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00574    YYRHS.  */
00575 static const yytype_uint8 yyprhs[] =
00576 {
00577        0,     0,     3,     7,     9,    12,    13,    17,    19,    21,
00578       24,    26,    30,    34,    38,    42,    46,    48,    52,    54,
00579       56,    58,    60,    62,    64,    66,    68,    70,    72,    74,
00580       76,    78,    80,    82,    84,    86,    88,    90,    93,    95,
00581       97,    99,   101,   104,   107,   110,   112,   114,   116,   118,
00582      120,   123,   124,   126,   128,   131,   134,   137,   139,   142,
00583      143,   145,   148,   150,   152,   154,   156,   159,   161,   163,
00584      165,   168,   170,   172,   174,   176,   179,   183,   186,   189,
00585      191,   193,   195,   198,   201,   207,   208,   211,   212,   216,
00586      218,   220,   222,   224,   226,   228
00587 };
00588 
00589 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
00590 static const yytype_int8 yyrhs[] =
00591 {
00592       65,     0,    -1,    65,    57,    66,    -1,    66,    -1,    67,
00593       72,    -1,    -1,    68,    70,    69,    -1,    58,    -1,    59,
00594       -1,    70,    71,    -1,    71,    -1,    51,    60,    55,    -1,
00595       53,    60,    55,    -1,    52,    60,    55,    -1,    43,    60,
00596       55,    -1,    54,    60,    55,    -1,    73,    -1,    72,    61,
00597       73,    -1,    74,    -1,    75,    -1,    77,    -1,    76,    -1,
00598       91,    -1,    95,    -1,    94,    -1,    93,    -1,    83,    -1,
00599       78,    -1,    81,    -1,    84,    -1,    85,    -1,    87,    -1,
00600       89,    -1,    97,    -1,    99,    -1,    98,    -1,   104,    -1,
00601        3,    55,    -1,     4,    -1,     5,    -1,     6,    -1,    28,
00602       -1,    28,   103,    -1,    28,    79,    -1,    28,    80,    -1,
00603       21,    -1,    22,    -1,    23,    -1,    40,    -1,    41,    -1,
00604        7,    82,    -1,    -1,     8,    -1,     9,    -1,    26,    31,
00605       -1,    26,    32,    -1,    26,    55,    -1,    30,    -1,    10,
00606       86,    -1,    -1,    11,    -1,    33,    88,    -1,    34,    -1,
00607       62,    -1,    35,    -1,    63,    -1,    22,    90,    -1,    24,
00608       -1,    25,    -1,    27,    -1,    16,    92,    -1,    17,    -1,
00609       18,    -1,    19,    -1,    27,    -1,    29,   103,    -1,    29,
00610       26,    55,    -1,    42,    55,    -1,    12,    96,    -1,    13,
00611       -1,    14,    -1,    15,    -1,    43,    55,    -1,    50,    55,
00612       -1,    44,   102,   103,   100,   101,    -1,    -1,    56,    47,
00613       -1,    -1,    48,    56,    49,    -1,    45,    -1,    46,    -1,
00614       36,    -1,    37,    -1,    38,    -1,    39,    -1,    20,    55,
00615       -1
00616 };
00617 
00618 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00619 static const yytype_uint16 yyrline[] =
00620 {
00621        0,   193,   193,   194,   209,   212,   213,   220,   236,   285,
00622      286,   290,   295,   310,   325,   330,   338,   339,   343,   344,
00623      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
00624      355,   356,   357,   358,   359,   360,   361,   365,   374,   382,
00625      394,   402,   430,   457,   489,   500,   501,   502,   506,   507,
00626      511,   531,   532,   533,   537,   542,   547,   558,   570,   587,
00627      588,   592,   603,   604,   605,   606,   610,   635,   636,   637,
00628      641,   661,   662,   663,   664,   668,   675,   696,   706,   726,
00629      727,   728,   732,   751,   761,   822,   825,   833,   836,   843,
00630      844,   848,   849,   850,   851,   855
00631 };
00632 #endif
00633 
00634 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00635 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00636    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
00637 static const char *const yytname[] =
00638 {
00639   "$end", "error", "$undefined", "\"exec\"", "\"exit\"", "\"reload\"",
00640   "\"restart\"", "\"kill\"", "\"window\"", "\"client\"", "\"fullscreen\"",
00641   "\"global\"", "\"layout\"", "\"default\"", "\"stacked\"", "\"tabbed\"",
00642   "\"border\"", "\"normal\"", "\"none\"", "\"1pixel\"", "\"mode\"",
00643   "\"tiling\"", "\"floating\"", "\"mode_toggle\"", "\"enable\"",
00644   "\"disable\"", "\"workspace\"", "\"toggle\"", "\"focus\"", "\"move\"",
00645   "\"open\"", "\"next\"", "\"prev\"", "\"split\"", "\"horizontal\"",
00646   "\"vertical\"", "\"up\"", "\"down\"", "\"left\"", "\"right\"",
00647   "\"parent\"", "\"child\"", "\"append_layout\"", "\"mark\"", "\"resize\"",
00648   "\"grow\"", "\"shrink\"", "\"px\"", "\"or\"", "\"ppt\"", "\"nop\"",
00649   "\"class\"", "\"id\"", "\"con_id\"", "\"title\"", "\"<string>\"",
00650   "\"<number>\"", "';'", "'['", "']'", "'='", "','", "'h'", "'v'",
00651   "$accept", "commands", "command", "match", "matchstart", "matchend",
00652   "criteria", "criterion", "operations", "operation", "exec", "exit",
00653   "reload", "restart", "focus", "window_mode", "level", "kill",
00654   "optional_kill_mode", "workspace", "open", "fullscreen",
00655   "fullscreen_mode", "split", "split_direction", "floating", "boolean",
00656   "border", "border_style", "move", "append_layout", "layout",
00657   "layout_mode", "mark", "nop", "resize", "resize_px", "resize_tiling",
00658   "resize_way", "direction", "mode", 0
00659 };
00660 #endif
00661 
00662 # ifdef YYPRINT
00663 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00664    token YYLEX-NUM.  */
00665 static const yytype_uint16 yytoknum[] =
00666 {
00667        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00668      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
00669      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
00670      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
00671      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
00672      305,   306,   307,   308,   309,   310,   311,    59,    91,    93,
00673       61,    44,   104,   118
00674 };
00675 # endif
00676 
00677 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00678 static const yytype_uint8 yyr1[] =
00679 {
00680        0,    64,    65,    65,    66,    67,    67,    68,    69,    70,
00681       70,    71,    71,    71,    71,    71,    72,    72,    73,    73,
00682       73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
00683       73,    73,    73,    73,    73,    73,    73,    74,    75,    76,
00684       77,    78,    78,    78,    78,    79,    79,    79,    80,    80,
00685       81,    82,    82,    82,    83,    83,    83,    84,    85,    86,
00686       86,    87,    88,    88,    88,    88,    89,    90,    90,    90,
00687       91,    92,    92,    92,    92,    93,    93,    94,    95,    96,
00688       96,    96,    97,    98,    99,   100,   100,   101,   101,   102,
00689      102,   103,   103,   103,   103,   104
00690 };
00691 
00692 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00693 static const yytype_uint8 yyr2[] =
00694 {
00695        0,     2,     3,     1,     2,     0,     3,     1,     1,     2,
00696        1,     3,     3,     3,     3,     3,     1,     3,     1,     1,
00697        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
00698        1,     1,     1,     1,     1,     1,     1,     2,     1,     1,
00699        1,     1,     2,     2,     2,     1,     1,     1,     1,     1,
00700        2,     0,     1,     1,     2,     2,     2,     1,     2,     0,
00701        1,     2,     1,     1,     1,     1,     2,     1,     1,     1,
00702        2,     1,     1,     1,     1,     2,     3,     2,     2,     1,
00703        1,     1,     2,     2,     5,     0,     2,     0,     3,     1,
00704        1,     1,     1,     1,     1,     2
00705 };
00706 
00707 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
00708    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
00709    means the default is an error.  */
00710 static const yytype_uint8 yydefact[] =
00711 {
00712        5,     7,     0,     3,     0,     0,     1,     5,     0,    38,
00713       39,    40,    51,    59,     0,     0,     0,     0,     0,    41,
00714        0,    57,     0,     0,     0,     0,     0,     4,    16,    18,
00715       19,    21,    20,    27,    28,    26,    29,    30,    31,    32,
00716       22,    25,    24,    23,    33,    35,    34,    36,     0,     0,
00717        0,     0,     0,     0,    10,     2,    37,    52,    53,    50,
00718       60,    58,    79,    80,    81,    78,    71,    72,    73,    74,
00719       70,    95,    67,    68,    69,    66,    54,    55,    56,    45,
00720       46,    47,    91,    92,    93,    94,    48,    49,    43,    44,
00721       42,     0,    75,    62,    64,    63,    65,    61,    77,    82,
00722       89,    90,     0,    83,     0,     0,     0,     0,     0,     0,
00723        8,     6,     9,    76,    85,    17,    14,    11,    13,    12,
00724       15,     0,    87,    86,     0,    84,     0,    88
00725 };
00726 
00727 /* YYDEFGOTO[NTERM-NUM].  */
00728 static const yytype_int8 yydefgoto[] =
00729 {
00730       -1,     2,     3,     4,     5,   111,    53,    54,    27,    28,
00731       29,    30,    31,    32,    33,    88,    89,    34,    59,    35,
00732       36,    37,    61,    38,    97,    39,    75,    40,    70,    41,
00733       42,    43,    65,    44,    45,    46,   122,   125,   102,    90,
00734       47
00735 };
00736 
00737 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00738    STATE-NUM.  */
00739 #define YYPACT_NINF -49
00740 static const yytype_int8 yypact[] =
00741 {
00742      -48,   -49,     1,   -49,    -1,    26,   -49,   -48,   -43,   -49,
00743      -49,   -49,    22,     5,     9,    21,   -29,    -7,   -18,    23,
00744       48,   -49,   -27,    -8,    -5,   -12,     0,    10,   -49,   -49,
00745      -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,
00746      -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,    -4,    12,
00747       16,    28,    29,    14,   -49,   -49,   -49,   -49,   -49,   -49,
00748      -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,
00749      -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,
00750      -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,
00751      -49,    20,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,
00752      -49,   -49,    15,   -49,    -1,    35,    36,    37,    38,    39,
00753      -49,   -49,   -49,   -49,    25,   -49,   -49,   -49,   -49,   -49,
00754      -49,    49,    47,   -49,    27,   -49,    50,   -49
00755 };
00756 
00757 /* YYPGOTO[NTERM-NUM].  */
00758 static const yytype_int8 yypgoto[] =
00759 {
00760      -49,   -49,    63,   -49,   -49,   -49,   -49,    44,   -49,    -6,
00761      -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,
00762      -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,
00763      -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -20,
00764      -49
00765 };
00766 
00767 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00768    positive, shift that token.  If negative, reduce the rule which
00769    number is the opposite.  If zero, do what YYDEFACT says.
00770    If YYTABLE_NINF, syntax error.  */
00771 #define YYTABLE_NINF -1
00772 static const yytype_uint8 yytable[] =
00773 {
00774       92,     6,     8,     9,    10,    11,    12,    93,    94,    13,
00775        1,    14,    56,    76,    77,    15,    60,    72,    73,    16,
00776       74,    17,    62,    63,    64,    18,    71,    19,    20,    21,
00777       57,    58,    22,   100,   101,    95,    96,    78,    66,    67,
00778       68,    23,    24,    25,    79,    80,    81,    98,    69,    26,
00779       99,    82,    83,    84,    85,   103,   105,    48,     7,    82,
00780       83,    84,    85,    86,    87,    49,    50,    51,    52,    48,
00781       55,   104,   106,   110,    91,   113,   107,    49,    50,    51,
00782       52,   121,   114,   126,    82,    83,    84,    85,   108,   109,
00783      116,   117,   118,   119,   120,   124,   123,   112,   115,   127
00784 };
00785 
00786 static const yytype_uint8 yycheck[] =
00787 {
00788       20,     0,     3,     4,     5,     6,     7,    34,    35,    10,
00789       58,    12,    55,    31,    32,    16,    11,    24,    25,    20,
00790       27,    22,    13,    14,    15,    26,    55,    28,    29,    30,
00791        8,     9,    33,    45,    46,    62,    63,    55,    17,    18,
00792       19,    42,    43,    44,    21,    22,    23,    55,    27,    50,
00793       55,    36,    37,    38,    39,    55,    60,    43,    57,    36,
00794       37,    38,    39,    40,    41,    51,    52,    53,    54,    43,
00795        7,    61,    60,    59,    26,    55,    60,    51,    52,    53,
00796       54,    56,   102,    56,    36,    37,    38,    39,    60,    60,
00797       55,    55,    55,    55,    55,    48,    47,    53,   104,    49
00798 };
00799 
00800 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
00801    symbol of state STATE-NUM.  */
00802 static const yytype_uint8 yystos[] =
00803 {
00804        0,    58,    65,    66,    67,    68,     0,    57,     3,     4,
00805        5,     6,     7,    10,    12,    16,    20,    22,    26,    28,
00806       29,    30,    33,    42,    43,    44,    50,    72,    73,    74,
00807       75,    76,    77,    78,    81,    83,    84,    85,    87,    89,
00808       91,    93,    94,    95,    97,    98,    99,   104,    43,    51,
00809       52,    53,    54,    70,    71,    66,    55,     8,     9,    82,
00810       11,    86,    13,    14,    15,    96,    17,    18,    19,    27,
00811       92,    55,    24,    25,    27,    90,    31,    32,    55,    21,
00812       22,    23,    36,    37,    38,    39,    40,    41,    79,    80,
00813      103,    26,   103,    34,    35,    62,    63,    88,    55,    55,
00814       45,    46,   102,    55,    61,    60,    60,    60,    60,    60,
00815       59,    69,    71,    55,   103,    73,    55,    55,    55,    55,
00816       55,    56,   100,    47,    48,   101,    56,    49
00817 };
00818 
00819 #define yyerrok         (yyerrstatus = 0)
00820 #define yyclearin       (yychar = YYEMPTY)
00821 #define YYEMPTY         (-2)
00822 #define YYEOF           0
00823 
00824 #define YYACCEPT        goto yyacceptlab
00825 #define YYABORT         goto yyabortlab
00826 #define YYERROR         goto yyerrorlab
00827 
00828 
00829 /* Like YYERROR except do call yyerror.  This remains here temporarily
00830    to ease the transition to the new meaning of YYERROR, for GCC.
00831    Once GCC version 2 has supplanted version 1, this can go.  However,
00832    YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
00833    in Bison 2.4.2's NEWS entry, where a plan to phase it out is
00834    discussed.  */
00835 
00836 #define YYFAIL          goto yyerrlab
00837 #if defined YYFAIL
00838   /* This is here to suppress warnings from the GCC cpp's
00839      -Wunused-macros.  Normally we don't worry about that warning, but
00840      some users do, and we want to make it easy for users to remove
00841      YYFAIL uses, which will produce warnings from Bison 2.5.  */
00842 #endif
00843 
00844 #define YYRECOVERING()  (!!yyerrstatus)
00845 
00846 #define YYBACKUP(Token, Value)                                  \
00847 do                                                              \
00848   if (yychar == YYEMPTY && yylen == 1)                          \
00849     {                                                           \
00850       yychar = (Token);                                         \
00851       yylval = (Value);                                         \
00852       yytoken = YYTRANSLATE (yychar);                           \
00853       YYPOPSTACK (1);                                           \
00854       goto yybackup;                                            \
00855     }                                                           \
00856   else                                                          \
00857     {                                                           \
00858       yyerror (YY_("syntax error: cannot back up")); \
00859       YYERROR;                                                  \
00860     }                                                           \
00861 while (YYID (0))
00862 
00863 
00864 #define YYTERROR        1
00865 #define YYERRCODE       256
00866 
00867 
00868 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00869    If N is 0, then set CURRENT to the empty location which ends
00870    the previous symbol: RHS[0] (always defined).  */
00871 
00872 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00873 #ifndef YYLLOC_DEFAULT
00874 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
00875     do                                                                  \
00876       if (YYID (N))                                                    \
00877         {                                                               \
00878           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
00879           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
00880           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
00881           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
00882         }                                                               \
00883       else                                                              \
00884         {                                                               \
00885           (Current).first_line   = (Current).last_line   =              \
00886             YYRHSLOC (Rhs, 0).last_line;                                \
00887           (Current).first_column = (Current).last_column =              \
00888             YYRHSLOC (Rhs, 0).last_column;                              \
00889         }                                                               \
00890     while (YYID (0))
00891 #endif
00892 
00893 
00894 /* YY_LOCATION_PRINT -- Print the location on the stream.
00895    This macro was not mandated originally: define only if we know
00896    we won't break user code: when these are the locations we know.  */
00897 
00898 #ifndef YY_LOCATION_PRINT
00899 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
00900 #  define YY_LOCATION_PRINT(File, Loc)                  \
00901      fprintf (File, "%d.%d-%d.%d",                      \
00902               (Loc).first_line, (Loc).first_column,     \
00903               (Loc).last_line,  (Loc).last_column)
00904 # else
00905 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00906 # endif
00907 #endif
00908 
00909 
00910 /* YYLEX -- calling `yylex' with the right arguments.  */
00911 
00912 #ifdef YYLEX_PARAM
00913 # define YYLEX yylex (YYLEX_PARAM)
00914 #else
00915 # define YYLEX yylex (context)
00916 #endif
00917 
00918 /* Enable debugging if requested.  */
00919 #if YYDEBUG
00920 
00921 # ifndef YYFPRINTF
00922 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00923 #  define YYFPRINTF fprintf
00924 # endif
00925 
00926 # define YYDPRINTF(Args)                        \
00927 do {                                            \
00928   if (yydebug)                                  \
00929     YYFPRINTF Args;                             \
00930 } while (YYID (0))
00931 
00932 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
00933 do {                                                                      \
00934   if (yydebug)                                                            \
00935     {                                                                     \
00936       YYFPRINTF (stderr, "%s ", Title);                                   \
00937       yy_symbol_print (stderr,                                            \
00938                   Type, Value); \
00939       YYFPRINTF (stderr, "\n");                                           \
00940     }                                                                     \
00941 } while (YYID (0))
00942 
00943 
00944 /*--------------------------------.
00945 | Print this symbol on YYOUTPUT.  |
00946 `--------------------------------*/
00947 
00948 /*ARGSUSED*/
00949 #if (defined __STDC__ || defined __C99__FUNC__ \
00950      || defined __cplusplus || defined _MSC_VER)
00951 static void
00952 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00953 #else
00954 static void
00955 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
00956     FILE *yyoutput;
00957     int yytype;
00958     YYSTYPE const * const yyvaluep;
00959 #endif
00960 {
00961   if (!yyvaluep)
00962     return;
00963 # ifdef YYPRINT
00964   if (yytype < YYNTOKENS)
00965     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00966 # else
00967   YYUSE (yyoutput);
00968 # endif
00969   switch (yytype)
00970     {
00971       default:
00972         break;
00973     }
00974 }
00975 
00976 
00977 /*--------------------------------.
00978 | Print this symbol on YYOUTPUT.  |
00979 `--------------------------------*/
00980 
00981 #if (defined __STDC__ || defined __C99__FUNC__ \
00982      || defined __cplusplus || defined _MSC_VER)
00983 static void
00984 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00985 #else
00986 static void
00987 yy_symbol_print (yyoutput, yytype, yyvaluep)
00988     FILE *yyoutput;
00989     int yytype;
00990     YYSTYPE const * const yyvaluep;
00991 #endif
00992 {
00993   if (yytype < YYNTOKENS)
00994     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00995   else
00996     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00997 
00998   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
00999   YYFPRINTF (yyoutput, ")");
01000 }
01001 
01002 /*------------------------------------------------------------------.
01003 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
01004 | TOP (included).                                                   |
01005 `------------------------------------------------------------------*/
01006 
01007 #if (defined __STDC__ || defined __C99__FUNC__ \
01008      || defined __cplusplus || defined _MSC_VER)
01009 static void
01010 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
01011 #else
01012 static void
01013 yy_stack_print (yybottom, yytop)
01014     yytype_int16 *yybottom;
01015     yytype_int16 *yytop;
01016 #endif
01017 {
01018   YYFPRINTF (stderr, "Stack now");
01019   for (; yybottom <= yytop; yybottom++)
01020     {
01021       int yybot = *yybottom;
01022       YYFPRINTF (stderr, " %d", yybot);
01023     }
01024   YYFPRINTF (stderr, "\n");
01025 }
01026 
01027 # define YY_STACK_PRINT(Bottom, Top)                            \
01028 do {                                                            \
01029   if (yydebug)                                                  \
01030     yy_stack_print ((Bottom), (Top));                           \
01031 } while (YYID (0))
01032 
01033 
01034 /*------------------------------------------------.
01035 | Report that the YYRULE is going to be reduced.  |
01036 `------------------------------------------------*/
01037 
01038 #if (defined __STDC__ || defined __C99__FUNC__ \
01039      || defined __cplusplus || defined _MSC_VER)
01040 static void
01041 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
01042 #else
01043 static void
01044 yy_reduce_print (yyvsp, yyrule)
01045     YYSTYPE *yyvsp;
01046     int yyrule;
01047 #endif
01048 {
01049   int yynrhs = yyr2[yyrule];
01050   int yyi;
01051   unsigned long int yylno = yyrline[yyrule];
01052   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
01053              yyrule - 1, yylno);
01054   /* The symbols being reduced.  */
01055   for (yyi = 0; yyi < yynrhs; yyi++)
01056     {
01057       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
01058       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
01059                        &(yyvsp[(yyi + 1) - (yynrhs)])
01060                                        );
01061       YYFPRINTF (stderr, "\n");
01062     }
01063 }
01064 
01065 # define YY_REDUCE_PRINT(Rule)          \
01066 do {                                    \
01067   if (yydebug)                          \
01068     yy_reduce_print (yyvsp, Rule); \
01069 } while (YYID (0))
01070 
01071 /* Nonzero means print parse trace.  It is left uninitialized so that
01072    multiple parsers can coexist.  */
01073 int yydebug;
01074 #else /* !YYDEBUG */
01075 # define YYDPRINTF(Args)
01076 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01077 # define YY_STACK_PRINT(Bottom, Top)
01078 # define YY_REDUCE_PRINT(Rule)
01079 #endif /* !YYDEBUG */
01080 
01081 
01082 /* YYINITDEPTH -- initial size of the parser's stacks.  */
01083 #ifndef YYINITDEPTH
01084 # define YYINITDEPTH 200
01085 #endif
01086 
01087 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
01088    if the built-in stack extension method is used).
01089 
01090    Do not make this value too large; the results are undefined if
01091    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
01092    evaluated with infinite-precision integer arithmetic.  */
01093 
01094 #ifndef YYMAXDEPTH
01095 # define YYMAXDEPTH 10000
01096 #endif
01097 
01098 
01099 
01100 #if YYERROR_VERBOSE
01101 
01102 # ifndef yystrlen
01103 #  if defined __GLIBC__ && defined _STRING_H
01104 #   define yystrlen strlen
01105 #  else
01106 /* Return the length of YYSTR.  */
01107 #if (defined __STDC__ || defined __C99__FUNC__ \
01108      || defined __cplusplus || defined _MSC_VER)
01109 static YYSIZE_T
01110 yystrlen (const char *yystr)
01111 #else
01112 static YYSIZE_T
01113 yystrlen (yystr)
01114     const char *yystr;
01115 #endif
01116 {
01117   YYSIZE_T yylen;
01118   for (yylen = 0; yystr[yylen]; yylen++)
01119     continue;
01120   return yylen;
01121 }
01122 #  endif
01123 # endif
01124 
01125 # ifndef yystpcpy
01126 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01127 #   define yystpcpy stpcpy
01128 #  else
01129 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
01130    YYDEST.  */
01131 #if (defined __STDC__ || defined __C99__FUNC__ \
01132      || defined __cplusplus || defined _MSC_VER)
01133 static char *
01134 yystpcpy (char *yydest, const char *yysrc)
01135 #else
01136 static char *
01137 yystpcpy (yydest, yysrc)
01138     char *yydest;
01139     const char *yysrc;
01140 #endif
01141 {
01142   char *yyd = yydest;
01143   const char *yys = yysrc;
01144 
01145   while ((*yyd++ = *yys++) != '\0')
01146     continue;
01147 
01148   return yyd - 1;
01149 }
01150 #  endif
01151 # endif
01152 
01153 # ifndef yytnamerr
01154 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
01155    quotes and backslashes, so that it's suitable for yyerror.  The
01156    heuristic is that double-quoting is unnecessary unless the string
01157    contains an apostrophe, a comma, or backslash (other than
01158    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
01159    null, do not copy; instead, return the length of what the result
01160    would have been.  */
01161 static YYSIZE_T
01162 yytnamerr (char *yyres, const char *yystr)
01163 {
01164   if (*yystr == '"')
01165     {
01166       YYSIZE_T yyn = 0;
01167       char const *yyp = yystr;
01168 
01169       for (;;)
01170         switch (*++yyp)
01171           {
01172           case '\'':
01173           case ',':
01174             goto do_not_strip_quotes;
01175 
01176           case '\\':
01177             if (*++yyp != '\\')
01178               goto do_not_strip_quotes;
01179             /* Fall through.  */
01180           default:
01181             if (yyres)
01182               yyres[yyn] = *yyp;
01183             yyn++;
01184             break;
01185 
01186           case '"':
01187             if (yyres)
01188               yyres[yyn] = '\0';
01189             return yyn;
01190           }
01191     do_not_strip_quotes: ;
01192     }
01193 
01194   if (! yyres)
01195     return yystrlen (yystr);
01196 
01197   return yystpcpy (yyres, yystr) - yyres;
01198 }
01199 # endif
01200 
01201 /* Copy into YYRESULT an error message about the unexpected token
01202    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
01203    including the terminating null byte.  If YYRESULT is null, do not
01204    copy anything; just return the number of bytes that would be
01205    copied.  As a special case, return 0 if an ordinary "syntax error"
01206    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
01207    size calculation.  */
01208 static YYSIZE_T
01209 yysyntax_error (char *yyresult, int yystate, int yychar)
01210 {
01211   int yyn = yypact[yystate];
01212 
01213   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
01214     return 0;
01215   else
01216     {
01217       int yytype = YYTRANSLATE (yychar);
01218       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01219       YYSIZE_T yysize = yysize0;
01220       YYSIZE_T yysize1;
01221       int yysize_overflow = 0;
01222       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01223       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01224       int yyx;
01225 
01226 # if 0
01227       /* This is so xgettext sees the translatable formats that are
01228          constructed on the fly.  */
01229       YY_("syntax error, unexpected %s");
01230       YY_("syntax error, unexpected %s, expecting %s");
01231       YY_("syntax error, unexpected %s, expecting %s or %s");
01232       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01233       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01234 # endif
01235       char *yyfmt;
01236       char const *yyf;
01237       static char const yyunexpected[] = "syntax error, unexpected %s";
01238       static char const yyexpecting[] = ", expecting %s";
01239       static char const yyor[] = " or %s";
01240       char yyformat[sizeof yyunexpected
01241                     + sizeof yyexpecting - 1
01242                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01243                        * (sizeof yyor - 1))];
01244       char const *yyprefix = yyexpecting;
01245 
01246       /* Start YYX at -YYN if negative to avoid negative indexes in
01247          YYCHECK.  */
01248       int yyxbegin = yyn < 0 ? -yyn : 0;
01249 
01250       /* Stay within bounds of both yycheck and yytname.  */
01251       int yychecklim = YYLAST - yyn + 1;
01252       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01253       int yycount = 1;
01254 
01255       yyarg[0] = yytname[yytype];
01256       yyfmt = yystpcpy (yyformat, yyunexpected);
01257 
01258       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01259         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01260           {
01261             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01262               {
01263                 yycount = 1;
01264                 yysize = yysize0;
01265                 yyformat[sizeof yyunexpected - 1] = '\0';
01266                 break;
01267               }
01268             yyarg[yycount++] = yytname[yyx];
01269             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01270             yysize_overflow |= (yysize1 < yysize);
01271             yysize = yysize1;
01272             yyfmt = yystpcpy (yyfmt, yyprefix);
01273             yyprefix = yyor;
01274           }
01275 
01276       yyf = YY_(yyformat);
01277       yysize1 = yysize + yystrlen (yyf);
01278       yysize_overflow |= (yysize1 < yysize);
01279       yysize = yysize1;
01280 
01281       if (yysize_overflow)
01282         return YYSIZE_MAXIMUM;
01283 
01284       if (yyresult)
01285         {
01286           /* Avoid sprintf, as that infringes on the user's name space.
01287              Don't have undefined behavior even if the translation
01288              produced a string with the wrong number of "%s"s.  */
01289           char *yyp = yyresult;
01290           int yyi = 0;
01291           while ((*yyp = *yyf) != '\0')
01292             {
01293               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01294                 {
01295                   yyp += yytnamerr (yyp, yyarg[yyi++]);
01296                   yyf += 2;
01297                 }
01298               else
01299                 {
01300                   yyp++;
01301                   yyf++;
01302                 }
01303             }
01304         }
01305       return yysize;
01306     }
01307 }
01308 #endif /* YYERROR_VERBOSE */
01309 
01310 
01311 /*-----------------------------------------------.
01312 | Release the memory associated to this symbol.  |
01313 `-----------------------------------------------*/
01314 
01315 /*ARGSUSED*/
01316 #if (defined __STDC__ || defined __C99__FUNC__ \
01317      || defined __cplusplus || defined _MSC_VER)
01318 static void
01319 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
01320 #else
01321 static void
01322 yydestruct (yymsg, yytype, yyvaluep)
01323     const char *yymsg;
01324     int yytype;
01325     YYSTYPE *yyvaluep;
01326 #endif
01327 {
01328   YYUSE (yyvaluep);
01329 
01330   if (!yymsg)
01331     yymsg = "Deleting";
01332   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01333 
01334   switch (yytype)
01335     {
01336 
01337       default:
01338         break;
01339     }
01340 }
01341 
01342 /* Prevent warnings from -Wmissing-prototypes.  */
01343 #ifdef YYPARSE_PARAM
01344 #if defined __STDC__ || defined __cplusplus
01345 int yyparse (void *YYPARSE_PARAM);
01346 #else
01347 int yyparse ();
01348 #endif
01349 #else /* ! YYPARSE_PARAM */
01350 #if defined __STDC__ || defined __cplusplus
01351 int yyparse (void);
01352 #else
01353 int yyparse ();
01354 #endif
01355 #endif /* ! YYPARSE_PARAM */
01356 
01357 
01358 /* The lookahead symbol.  */
01359 int yychar;
01360 
01361 /* The semantic value of the lookahead symbol.  */
01362 YYSTYPE yylval;
01363 
01364 /* Number of syntax errors so far.  */
01365 int yynerrs;
01366 
01367 
01368 
01369 /*-------------------------.
01370 | yyparse or yypush_parse.  |
01371 `-------------------------*/
01372 
01373 #ifdef YYPARSE_PARAM
01374 #if (defined __STDC__ || defined __C99__FUNC__ \
01375      || defined __cplusplus || defined _MSC_VER)
01376 int
01377 yyparse (void *YYPARSE_PARAM)
01378 #else
01379 int
01380 yyparse (YYPARSE_PARAM)
01381     void *YYPARSE_PARAM;
01382 #endif
01383 #else /* ! YYPARSE_PARAM */
01384 #if (defined __STDC__ || defined __C99__FUNC__ \
01385      || defined __cplusplus || defined _MSC_VER)
01386 int
01387 yyparse (void)
01388 #else
01389 int
01390 yyparse ()
01391 
01392 #endif
01393 #endif
01394 {
01395 
01396 
01397     int yystate;
01398     /* Number of tokens to shift before error messages enabled.  */
01399     int yyerrstatus;
01400 
01401     /* The stacks and their tools:
01402        `yyss': related to states.
01403        `yyvs': related to semantic values.
01404 
01405        Refer to the stacks thru separate pointers, to allow yyoverflow
01406        to reallocate them elsewhere.  */
01407 
01408     /* The state stack.  */
01409     yytype_int16 yyssa[YYINITDEPTH];
01410     yytype_int16 *yyss;
01411     yytype_int16 *yyssp;
01412 
01413     /* The semantic value stack.  */
01414     YYSTYPE yyvsa[YYINITDEPTH];
01415     YYSTYPE *yyvs;
01416     YYSTYPE *yyvsp;
01417 
01418     YYSIZE_T yystacksize;
01419 
01420   int yyn;
01421   int yyresult;
01422   /* Lookahead token as an internal (translated) token number.  */
01423   int yytoken;
01424   /* The variables used to return semantic value and location from the
01425      action routines.  */
01426   YYSTYPE yyval;
01427 
01428 #if YYERROR_VERBOSE
01429   /* Buffer for error messages, and its allocated size.  */
01430   char yymsgbuf[128];
01431   char *yymsg = yymsgbuf;
01432   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01433 #endif
01434 
01435 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
01436 
01437   /* The number of symbols on the RHS of the reduced rule.
01438      Keep to zero when no symbol should be popped.  */
01439   int yylen = 0;
01440 
01441   yytoken = 0;
01442   yyss = yyssa;
01443   yyvs = yyvsa;
01444   yystacksize = YYINITDEPTH;
01445 
01446   YYDPRINTF ((stderr, "Starting parse\n"));
01447 
01448   yystate = 0;
01449   yyerrstatus = 0;
01450   yynerrs = 0;
01451   yychar = YYEMPTY; /* Cause a token to be read.  */
01452 
01453   /* Initialize stack pointers.
01454      Waste one element of value and location stack
01455      so that they stay on the same level as the state stack.
01456      The wasted elements are never initialized.  */
01457   yyssp = yyss;
01458   yyvsp = yyvs;
01459 
01460   goto yysetstate;
01461 
01462 /*------------------------------------------------------------.
01463 | yynewstate -- Push a new state, which is found in yystate.  |
01464 `------------------------------------------------------------*/
01465  yynewstate:
01466   /* In all cases, when you get here, the value and location stacks
01467      have just been pushed.  So pushing a state here evens the stacks.  */
01468   yyssp++;
01469 
01470  yysetstate:
01471   *yyssp = yystate;
01472 
01473   if (yyss + yystacksize - 1 <= yyssp)
01474     {
01475       /* Get the current used size of the three stacks, in elements.  */
01476       YYSIZE_T yysize = yyssp - yyss + 1;
01477 
01478 #ifdef yyoverflow
01479       {
01480         /* Give user a chance to reallocate the stack.  Use copies of
01481            these so that the &'s don't force the real ones into
01482            memory.  */
01483         YYSTYPE *yyvs1 = yyvs;
01484         yytype_int16 *yyss1 = yyss;
01485 
01486         /* Each stack pointer address is followed by the size of the
01487            data in use in that stack, in bytes.  This used to be a
01488            conditional around just the two extra args, but that might
01489            be undefined if yyoverflow is a macro.  */
01490         yyoverflow (YY_("memory exhausted"),
01491                     &yyss1, yysize * sizeof (*yyssp),
01492                     &yyvs1, yysize * sizeof (*yyvsp),
01493                     &yystacksize);
01494 
01495         yyss = yyss1;
01496         yyvs = yyvs1;
01497       }
01498 #else /* no yyoverflow */
01499 # ifndef YYSTACK_RELOCATE
01500       goto yyexhaustedlab;
01501 # else
01502       /* Extend the stack our own way.  */
01503       if (YYMAXDEPTH <= yystacksize)
01504         goto yyexhaustedlab;
01505       yystacksize *= 2;
01506       if (YYMAXDEPTH < yystacksize)
01507         yystacksize = YYMAXDEPTH;
01508 
01509       {
01510         yytype_int16 *yyss1 = yyss;
01511         union yyalloc *yyptr =
01512           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01513         if (! yyptr)
01514           goto yyexhaustedlab;
01515         YYSTACK_RELOCATE (yyss_alloc, yyss);
01516         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
01517 #  undef YYSTACK_RELOCATE
01518         if (yyss1 != yyssa)
01519           YYSTACK_FREE (yyss1);
01520       }
01521 # endif
01522 #endif /* no yyoverflow */
01523 
01524       yyssp = yyss + yysize - 1;
01525       yyvsp = yyvs + yysize - 1;
01526 
01527       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01528                   (unsigned long int) yystacksize));
01529 
01530       if (yyss + yystacksize - 1 <= yyssp)
01531         YYABORT;
01532     }
01533 
01534   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01535 
01536   if (yystate == YYFINAL)
01537     YYACCEPT;
01538 
01539   goto yybackup;
01540 
01541 /*-----------.
01542 | yybackup.  |
01543 `-----------*/
01544 yybackup:
01545 
01546   /* Do appropriate processing given the current state.  Read a
01547      lookahead token if we need one and don't already have one.  */
01548 
01549   /* First try to decide what to do without reference to lookahead token.  */
01550   yyn = yypact[yystate];
01551   if (yyn == YYPACT_NINF)
01552     goto yydefault;
01553 
01554   /* Not known => get a lookahead token if don't already have one.  */
01555 
01556   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
01557   if (yychar == YYEMPTY)
01558     {
01559       YYDPRINTF ((stderr, "Reading a token: "));
01560       yychar = YYLEX;
01561     }
01562 
01563   if (yychar <= YYEOF)
01564     {
01565       yychar = yytoken = YYEOF;
01566       YYDPRINTF ((stderr, "Now at end of input.\n"));
01567     }
01568   else
01569     {
01570       yytoken = YYTRANSLATE (yychar);
01571       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01572     }
01573 
01574   /* If the proper action on seeing token YYTOKEN is to reduce or to
01575      detect an error, take that action.  */
01576   yyn += yytoken;
01577   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01578     goto yydefault;
01579   yyn = yytable[yyn];
01580   if (yyn <= 0)
01581     {
01582       if (yyn == 0 || yyn == YYTABLE_NINF)
01583         goto yyerrlab;
01584       yyn = -yyn;
01585       goto yyreduce;
01586     }
01587 
01588   /* Count tokens shifted since error; after three, turn off error
01589      status.  */
01590   if (yyerrstatus)
01591     yyerrstatus--;
01592 
01593   /* Shift the lookahead token.  */
01594   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01595 
01596   /* Discard the shifted token.  */
01597   yychar = YYEMPTY;
01598 
01599   yystate = yyn;
01600   *++yyvsp = yylval;
01601 
01602   goto yynewstate;
01603 
01604 
01605 /*-----------------------------------------------------------.
01606 | yydefault -- do the default action for the current state.  |
01607 `-----------------------------------------------------------*/
01608 yydefault:
01609   yyn = yydefact[yystate];
01610   if (yyn == 0)
01611     goto yyerrlab;
01612   goto yyreduce;
01613 
01614 
01615 /*-----------------------------.
01616 | yyreduce -- Do a reduction.  |
01617 `-----------------------------*/
01618 yyreduce:
01619   /* yyn is the number of a rule to reduce with.  */
01620   yylen = yyr2[yyn];
01621 
01622   /* If YYLEN is nonzero, implement the default value of the action:
01623      `$$ = $1'.
01624 
01625      Otherwise, the following line sets YYVAL to garbage.
01626      This behavior is undocumented and Bison
01627      users should not rely upon it.  Assigning to YYVAL
01628      unconditionally makes the parser a bit smaller, and it avoids a
01629      GCC warning that YYVAL may be used uninitialized.  */
01630   yyval = yyvsp[1-yylen];
01631 
01632 
01633   YY_REDUCE_PRINT (yyn);
01634   switch (yyn)
01635     {
01636         case 3:
01637 
01638 /* Line 1464 of yacc.c  */
01639 #line 195 "src/cmdparse.y"
01640     {
01641         owindow *current;
01642 
01643         printf("single command completely parsed, dropping state...\n");
01644         while (!TAILQ_EMPTY(&owindows)) {
01645             current = TAILQ_FIRST(&owindows);
01646             TAILQ_REMOVE(&owindows, current, owindows);
01647             free(current);
01648         }
01649         match_init(&current_match);
01650     ;}
01651     break;
01652 
01653   case 6:
01654 
01655 /* Line 1464 of yacc.c  */
01656 #line 214 "src/cmdparse.y"
01657     {
01658         printf("match parsed\n");
01659     ;}
01660     break;
01661 
01662   case 7:
01663 
01664 /* Line 1464 of yacc.c  */
01665 #line 221 "src/cmdparse.y"
01666     {
01667         printf("start\n");
01668         match_init(&current_match);
01669         TAILQ_INIT(&owindows);
01670         /* copy all_cons */
01671         Con *con;
01672         TAILQ_FOREACH(con, &all_cons, all_cons) {
01673             owindow *ow = smalloc(sizeof(owindow));
01674             ow->con = con;
01675             TAILQ_INSERT_TAIL(&owindows, ow, owindows);
01676         }
01677     ;}
01678     break;
01679 
01680   case 8:
01681 
01682 /* Line 1464 of yacc.c  */
01683 #line 237 "src/cmdparse.y"
01684     {
01685         owindow *next, *current;
01686 
01687         printf("match specification finished, matching...\n");
01688         /* copy the old list head to iterate through it and start with a fresh
01689          * list which will contain only matching windows */
01690         struct owindows_head old = owindows;
01691         TAILQ_INIT(&owindows);
01692         for (next = TAILQ_FIRST(&old); next != TAILQ_END(&old);) {
01693             /* make a copy of the next pointer and advance the pointer to the
01694              * next element as we are going to invalidate the element’s
01695              * next/prev pointers by calling TAILQ_INSERT_TAIL later */
01696             current = next;
01697             next = TAILQ_NEXT(next, owindows);
01698 
01699             printf("checking if con %p / %s matches\n", current->con, current->con->name);
01700             if (current_match.con_id != NULL) {
01701                 if (current_match.con_id == current->con) {
01702                     printf("matches container!\n");
01703                     TAILQ_INSERT_TAIL(&owindows, current, owindows);
01704 
01705                 }
01706             } else if (current_match.mark != NULL && current->con->mark != NULL &&
01707                     strcasecmp(current_match.mark, current->con->mark) == 0) {
01708                 printf("match by mark\n");
01709                     TAILQ_INSERT_TAIL(&owindows, current, owindows);
01710 
01711             } else {
01712                 if (current->con->window == NULL)
01713                     continue;
01714                 if (match_matches_window(&current_match, current->con->window)) {
01715                     printf("matches window!\n");
01716                     TAILQ_INSERT_TAIL(&owindows, current, owindows);
01717                 } else {
01718                     printf("doesnt match\n");
01719                     free(current);
01720                 }
01721             }
01722         }
01723 
01724         TAILQ_FOREACH(current, &owindows, owindows) {
01725             printf("matching: %p / %s\n", current->con, current->con->name);
01726         }
01727 
01728     ;}
01729     break;
01730 
01731   case 11:
01732 
01733 /* Line 1464 of yacc.c  */
01734 #line 291 "src/cmdparse.y"
01735     {
01736         printf("criteria: class = %s\n", (yyvsp[(3) - (3)].string));
01737         current_match.class = (yyvsp[(3) - (3)].string);
01738     ;}
01739     break;
01740 
01741   case 12:
01742 
01743 /* Line 1464 of yacc.c  */
01744 #line 296 "src/cmdparse.y"
01745     {
01746         printf("criteria: id = %s\n", (yyvsp[(3) - (3)].string));
01747         char *end;
01748         long parsed = strtol((yyvsp[(3) - (3)].string), &end, 10);
01749         if (parsed == LONG_MIN ||
01750             parsed == LONG_MAX ||
01751             parsed < 0 ||
01752             (end && *end != '\0')) {
01753             ELOG("Could not parse con id \"%s\"\n", (yyvsp[(3) - (3)].string));
01754         } else {
01755             current_match.con_id = (Con*)parsed;
01756             printf("id as int = %p\n", current_match.con_id);
01757         }
01758     ;}
01759     break;
01760 
01761   case 13:
01762 
01763 /* Line 1464 of yacc.c  */
01764 #line 311 "src/cmdparse.y"
01765     {
01766         printf("criteria: window id = %s\n", (yyvsp[(3) - (3)].string));
01767         char *end;
01768         long parsed = strtol((yyvsp[(3) - (3)].string), &end, 10);
01769         if (parsed == LONG_MIN ||
01770             parsed == LONG_MAX ||
01771             parsed < 0 ||
01772             (end && *end != '\0')) {
01773             ELOG("Could not parse window id \"%s\"\n", (yyvsp[(3) - (3)].string));
01774         } else {
01775             current_match.id = parsed;
01776             printf("window id as int = %d\n", current_match.id);
01777         }
01778     ;}
01779     break;
01780 
01781   case 14:
01782 
01783 /* Line 1464 of yacc.c  */
01784 #line 326 "src/cmdparse.y"
01785     {
01786         printf("criteria: mark = %s\n", (yyvsp[(3) - (3)].string));
01787         current_match.mark = (yyvsp[(3) - (3)].string);
01788     ;}
01789     break;
01790 
01791   case 15:
01792 
01793 /* Line 1464 of yacc.c  */
01794 #line 331 "src/cmdparse.y"
01795     {
01796         printf("criteria: title = %s\n", (yyvsp[(3) - (3)].string));
01797         current_match.title = (yyvsp[(3) - (3)].string);
01798     ;}
01799     break;
01800 
01801   case 37:
01802 
01803 /* Line 1464 of yacc.c  */
01804 #line 366 "src/cmdparse.y"
01805     {
01806         printf("should execute %s\n", (yyvsp[(2) - (2)].string));
01807         start_application((yyvsp[(2) - (2)].string));
01808         free((yyvsp[(2) - (2)].string));
01809     ;}
01810     break;
01811 
01812   case 38:
01813 
01814 /* Line 1464 of yacc.c  */
01815 #line 375 "src/cmdparse.y"
01816     {
01817         printf("exit, bye bye\n");
01818         exit(0);
01819     ;}
01820     break;
01821 
01822   case 39:
01823 
01824 /* Line 1464 of yacc.c  */
01825 #line 383 "src/cmdparse.y"
01826     {
01827         printf("reloading\n");
01828         kill_configerror_nagbar(false);
01829         load_configuration(conn, NULL, true);
01830         x_set_i3_atoms();
01831         /* Send an IPC event just in case the ws names have changed */
01832         ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"reload\"}");
01833     ;}
01834     break;
01835 
01836   case 40:
01837 
01838 /* Line 1464 of yacc.c  */
01839 #line 395 "src/cmdparse.y"
01840     {
01841         printf("restarting i3\n");
01842         i3_restart(false);
01843     ;}
01844     break;
01845 
01846   case 41:
01847 
01848 /* Line 1464 of yacc.c  */
01849 #line 403 "src/cmdparse.y"
01850     {
01851         owindow *current;
01852 
01853         if (match_is_empty(&current_match)) {
01854             ELOG("You have to specify which window/container should be focused.\n");
01855             ELOG("Example: [class=\"urxvt\" title=\"irssi\"] focus\n");
01856 
01857             asprintf(&json_output, "{\"success\":false, \"error\":\"You have to "
01858                      "specify which window/container should be focused\"}");
01859             break;
01860         }
01861 
01862         int count = 0;
01863         TAILQ_FOREACH(current, &owindows, owindows) {
01864             Con *ws = con_get_workspace(current->con);
01865             workspace_show(ws->name);
01866             LOG("focusing %p / %s\n", current->con, current->con->name);
01867             con_focus(current->con);
01868             count++;
01869         }
01870 
01871         if (count > 1)
01872             LOG("WARNING: Your criteria for the focus command matches %d containers, "
01873                 "while only exactly one container can be focused at a time.\n", count);
01874 
01875         tree_render();
01876     ;}
01877     break;
01878 
01879   case 42:
01880 
01881 /* Line 1464 of yacc.c  */
01882 #line 431 "src/cmdparse.y"
01883     {
01884         int direction = (yyvsp[(2) - (2)].number);
01885         switch (direction) {
01886             case TOK_LEFT:
01887                 LOG("Focusing left\n");
01888                 tree_next('p', HORIZ);
01889                 break;
01890             case TOK_RIGHT:
01891                 LOG("Focusing right\n");
01892                 tree_next('n', HORIZ);
01893                 break;
01894             case TOK_UP:
01895                 LOG("Focusing up\n");
01896                 tree_next('p', VERT);
01897                 break;
01898             case TOK_DOWN:
01899                 LOG("Focusing down\n");
01900                 tree_next('n', VERT);
01901                 break;
01902             default:
01903                 ELOG("Invalid focus direction (%d)\n", direction);
01904                 break;
01905         }
01906 
01907         tree_render();
01908     ;}
01909     break;
01910 
01911   case 43:
01912 
01913 /* Line 1464 of yacc.c  */
01914 #line 458 "src/cmdparse.y"
01915     {
01916         printf("should focus: ");
01917 
01918         if ((yyvsp[(2) - (2)].number) == TOK_TILING)
01919             printf("tiling\n");
01920         else if ((yyvsp[(2) - (2)].number) == TOK_FLOATING)
01921             printf("floating\n");
01922         else printf("mode toggle\n");
01923 
01924         Con *ws = con_get_workspace(focused);
01925         Con *current;
01926         if (ws != NULL) {
01927             int to_focus = (yyvsp[(2) - (2)].number);
01928             if ((yyvsp[(2) - (2)].number) == TOK_MODE_TOGGLE) {
01929                 current = TAILQ_FIRST(&(ws->focus_head));
01930                 if (current->type == CT_FLOATING_CON)
01931                     to_focus = TOK_TILING;
01932                 else to_focus = TOK_FLOATING;
01933             }
01934             TAILQ_FOREACH(current, &(ws->focus_head), focused) {
01935                 if ((to_focus == TOK_FLOATING && current->type != CT_FLOATING_CON) ||
01936                     (to_focus == TOK_TILING && current->type == CT_FLOATING_CON))
01937                     continue;
01938 
01939                 con_focus(con_descend_focused(current));
01940                 break;
01941             }
01942         }
01943 
01944         tree_render();
01945     ;}
01946     break;
01947 
01948   case 44:
01949 
01950 /* Line 1464 of yacc.c  */
01951 #line 490 "src/cmdparse.y"
01952     {
01953         if ((yyvsp[(2) - (2)].number) == TOK_PARENT)
01954             level_up();
01955         else level_down();
01956 
01957         tree_render();
01958     ;}
01959     break;
01960 
01961   case 45:
01962 
01963 /* Line 1464 of yacc.c  */
01964 #line 500 "src/cmdparse.y"
01965     { (yyval.number) = TOK_TILING; ;}
01966     break;
01967 
01968   case 46:
01969 
01970 /* Line 1464 of yacc.c  */
01971 #line 501 "src/cmdparse.y"
01972     { (yyval.number) = TOK_FLOATING; ;}
01973     break;
01974 
01975   case 47:
01976 
01977 /* Line 1464 of yacc.c  */
01978 #line 502 "src/cmdparse.y"
01979     { (yyval.number) = TOK_MODE_TOGGLE; ;}
01980     break;
01981 
01982   case 48:
01983 
01984 /* Line 1464 of yacc.c  */
01985 #line 506 "src/cmdparse.y"
01986     { (yyval.number) = TOK_PARENT; ;}
01987     break;
01988 
01989   case 49:
01990 
01991 /* Line 1464 of yacc.c  */
01992 #line 507 "src/cmdparse.y"
01993     { (yyval.number) = TOK_CHILD;  ;}
01994     break;
01995 
01996   case 50:
01997 
01998 /* Line 1464 of yacc.c  */
01999 #line 512 "src/cmdparse.y"
02000     {
02001         owindow *current;
02002 
02003         printf("killing!\n");
02004         /* check if the match is empty, not if the result is empty */
02005         if (match_is_empty(&current_match))
02006             tree_close_con((yyvsp[(2) - (2)].number));
02007         else {
02008             TAILQ_FOREACH(current, &owindows, owindows) {
02009                 printf("matching: %p / %s\n", current->con, current->con->name);
02010                 tree_close(current->con, (yyvsp[(2) - (2)].number), false);
02011             }
02012         }
02013 
02014         tree_render();
02015     ;}
02016     break;
02017 
02018   case 51:
02019 
02020 /* Line 1464 of yacc.c  */
02021 #line 531 "src/cmdparse.y"
02022     { (yyval.number) = KILL_WINDOW; ;}
02023     break;
02024 
02025   case 52:
02026 
02027 /* Line 1464 of yacc.c  */
02028 #line 532 "src/cmdparse.y"
02029     { (yyval.number) = KILL_WINDOW; ;}
02030     break;
02031 
02032   case 53:
02033 
02034 /* Line 1464 of yacc.c  */
02035 #line 533 "src/cmdparse.y"
02036     { (yyval.number) = KILL_CLIENT; ;}
02037     break;
02038 
02039   case 54:
02040 
02041 /* Line 1464 of yacc.c  */
02042 #line 538 "src/cmdparse.y"
02043     {
02044         workspace_next();
02045         tree_render();
02046     ;}
02047     break;
02048 
02049   case 55:
02050 
02051 /* Line 1464 of yacc.c  */
02052 #line 543 "src/cmdparse.y"
02053     {
02054         workspace_prev();
02055         tree_render();
02056     ;}
02057     break;
02058 
02059   case 56:
02060 
02061 /* Line 1464 of yacc.c  */
02062 #line 548 "src/cmdparse.y"
02063     {
02064         printf("should switch to workspace %s\n", (yyvsp[(2) - (2)].string));
02065         workspace_show((yyvsp[(2) - (2)].string));
02066         free((yyvsp[(2) - (2)].string));
02067 
02068         tree_render();
02069     ;}
02070     break;
02071 
02072   case 57:
02073 
02074 /* Line 1464 of yacc.c  */
02075 #line 559 "src/cmdparse.y"
02076     {
02077         printf("opening new container\n");
02078         Con *con = tree_open_con(NULL, NULL);
02079         con_focus(con);
02080         asprintf(&json_output, "{\"success\":true, \"id\":%ld}", (long int)con);
02081 
02082         tree_render();
02083     ;}
02084     break;
02085 
02086   case 58:
02087 
02088 /* Line 1464 of yacc.c  */
02089 #line 571 "src/cmdparse.y"
02090     {
02091         printf("toggling fullscreen, mode = %s\n", ((yyvsp[(2) - (2)].number) == CF_OUTPUT ? "normal" : "global"));
02092         owindow *current;
02093 
02094         HANDLE_EMPTY_MATCH;
02095 
02096         TAILQ_FOREACH(current, &owindows, owindows) {
02097             printf("matching: %p / %s\n", current->con, current->con->name);
02098             con_toggle_fullscreen(current->con, (yyvsp[(2) - (2)].number));
02099         }
02100 
02101         tree_render();
02102     ;}
02103     break;
02104 
02105   case 59:
02106 
02107 /* Line 1464 of yacc.c  */
02108 #line 587 "src/cmdparse.y"
02109     { (yyval.number) = CF_OUTPUT; ;}
02110     break;
02111 
02112   case 60:
02113 
02114 /* Line 1464 of yacc.c  */
02115 #line 588 "src/cmdparse.y"
02116     { (yyval.number) = CF_GLOBAL; ;}
02117     break;
02118 
02119   case 61:
02120 
02121 /* Line 1464 of yacc.c  */
02122 #line 593 "src/cmdparse.y"
02123     {
02124         /* TODO: use matches */
02125         printf("splitting in direction %c\n", (yyvsp[(2) - (2)].number));
02126         tree_split(focused, ((yyvsp[(2) - (2)].number) == 'v' ? VERT : HORIZ));
02127 
02128         tree_render();
02129     ;}
02130     break;
02131 
02132   case 62:
02133 
02134 /* Line 1464 of yacc.c  */
02135 #line 603 "src/cmdparse.y"
02136     { (yyval.number) = 'h'; ;}
02137     break;
02138 
02139   case 63:
02140 
02141 /* Line 1464 of yacc.c  */
02142 #line 604 "src/cmdparse.y"
02143     { (yyval.number) = 'h'; ;}
02144     break;
02145 
02146   case 64:
02147 
02148 /* Line 1464 of yacc.c  */
02149 #line 605 "src/cmdparse.y"
02150     { (yyval.number) = 'v'; ;}
02151     break;
02152 
02153   case 65:
02154 
02155 /* Line 1464 of yacc.c  */
02156 #line 606 "src/cmdparse.y"
02157     { (yyval.number) = 'v'; ;}
02158     break;
02159 
02160   case 66:
02161 
02162 /* Line 1464 of yacc.c  */
02163 #line 611 "src/cmdparse.y"
02164     {
02165         HANDLE_EMPTY_MATCH;
02166 
02167         owindow *current;
02168         TAILQ_FOREACH(current, &owindows, owindows) {
02169             printf("matching: %p / %s\n", current->con, current->con->name);
02170             if ((yyvsp[(2) - (2)].number) == TOK_TOGGLE) {
02171                 printf("should toggle mode\n");
02172                 toggle_floating_mode(current->con, false);
02173             } else {
02174                 printf("should switch mode to %s\n", ((yyvsp[(2) - (2)].number) == TOK_FLOATING ? "floating" : "tiling"));
02175                 if ((yyvsp[(2) - (2)].number) == TOK_ENABLE) {
02176                     floating_enable(current->con, false);
02177                 } else {
02178                     floating_disable(current->con, false);
02179                 }
02180             }
02181         }
02182 
02183         tree_render();
02184     ;}
02185     break;
02186 
02187   case 67:
02188 
02189 /* Line 1464 of yacc.c  */
02190 #line 635 "src/cmdparse.y"
02191     { (yyval.number) = TOK_ENABLE; ;}
02192     break;
02193 
02194   case 68:
02195 
02196 /* Line 1464 of yacc.c  */
02197 #line 636 "src/cmdparse.y"
02198     { (yyval.number) = TOK_DISABLE; ;}
02199     break;
02200 
02201   case 69:
02202 
02203 /* Line 1464 of yacc.c  */
02204 #line 637 "src/cmdparse.y"
02205     { (yyval.number) = TOK_TOGGLE; ;}
02206     break;
02207 
02208   case 70:
02209 
02210 /* Line 1464 of yacc.c  */
02211 #line 642 "src/cmdparse.y"
02212     {
02213         printf("border style should be changed to %d\n", (yyvsp[(2) - (2)].number));
02214         owindow *current;
02215 
02216         HANDLE_EMPTY_MATCH;
02217 
02218         TAILQ_FOREACH(current, &owindows, owindows) {
02219             printf("matching: %p / %s\n", current->con, current->con->name);
02220             if ((yyvsp[(2) - (2)].number) == TOK_TOGGLE) {
02221                 current->con->border_style++;
02222                 current->con->border_style %= 3;
02223             } else current->con->border_style = (yyvsp[(2) - (2)].number);
02224         }
02225 
02226         tree_render();
02227     ;}
02228     break;
02229 
02230   case 71:
02231 
02232 /* Line 1464 of yacc.c  */
02233 #line 661 "src/cmdparse.y"
02234     { (yyval.number) = BS_NORMAL; ;}
02235     break;
02236 
02237   case 72:
02238 
02239 /* Line 1464 of yacc.c  */
02240 #line 662 "src/cmdparse.y"
02241     { (yyval.number) = BS_NONE; ;}
02242     break;
02243 
02244   case 73:
02245 
02246 /* Line 1464 of yacc.c  */
02247 #line 663 "src/cmdparse.y"
02248     { (yyval.number) = BS_1PIXEL; ;}
02249     break;
02250 
02251   case 74:
02252 
02253 /* Line 1464 of yacc.c  */
02254 #line 664 "src/cmdparse.y"
02255     { (yyval.number) = TOK_TOGGLE; ;}
02256     break;
02257 
02258   case 75:
02259 
02260 /* Line 1464 of yacc.c  */
02261 #line 669 "src/cmdparse.y"
02262     {
02263         printf("moving in direction %d\n", (yyvsp[(2) - (2)].number));
02264         tree_move((yyvsp[(2) - (2)].number));
02265 
02266         tree_render();
02267     ;}
02268     break;
02269 
02270   case 76:
02271 
02272 /* Line 1464 of yacc.c  */
02273 #line 676 "src/cmdparse.y"
02274     {
02275         owindow *current;
02276 
02277         printf("should move window to workspace %s\n", (yyvsp[(3) - (3)].string));
02278         /* get the workspace */
02279         Con *ws = workspace_get((yyvsp[(3) - (3)].string), NULL);
02280         free((yyvsp[(3) - (3)].string));
02281 
02282         HANDLE_EMPTY_MATCH;
02283 
02284         TAILQ_FOREACH(current, &owindows, owindows) {
02285             printf("matching: %p / %s\n", current->con, current->con->name);
02286             con_move_to_workspace(current->con, ws);
02287         }
02288 
02289         tree_render();
02290     ;}
02291     break;
02292 
02293   case 77:
02294 
02295 /* Line 1464 of yacc.c  */
02296 #line 697 "src/cmdparse.y"
02297     {
02298         printf("restoring \"%s\"\n", (yyvsp[(2) - (2)].string));
02299         tree_append_json((yyvsp[(2) - (2)].string));
02300         free((yyvsp[(2) - (2)].string));
02301         tree_render();
02302     ;}
02303     break;
02304 
02305   case 78:
02306 
02307 /* Line 1464 of yacc.c  */
02308 #line 707 "src/cmdparse.y"
02309     {
02310         printf("changing layout to %d\n", (yyvsp[(2) - (2)].number));
02311         owindow *current;
02312 
02313         /* check if the match is empty, not if the result is empty */
02314         if (match_is_empty(&current_match))
02315             con_set_layout(focused->parent, (yyvsp[(2) - (2)].number));
02316         else {
02317             TAILQ_FOREACH(current, &owindows, owindows) {
02318                 printf("matching: %p / %s\n", current->con, current->con->name);
02319                 con_set_layout(current->con, (yyvsp[(2) - (2)].number));
02320             }
02321         }
02322 
02323         tree_render();
02324     ;}
02325     break;
02326 
02327   case 79:
02328 
02329 /* Line 1464 of yacc.c  */
02330 #line 726 "src/cmdparse.y"
02331     { (yyval.number) = L_DEFAULT; ;}
02332     break;
02333 
02334   case 80:
02335 
02336 /* Line 1464 of yacc.c  */
02337 #line 727 "src/cmdparse.y"
02338     { (yyval.number) = L_STACKED; ;}
02339     break;
02340 
02341   case 81:
02342 
02343 /* Line 1464 of yacc.c  */
02344 #line 728 "src/cmdparse.y"
02345     { (yyval.number) = L_TABBED; ;}
02346     break;
02347 
02348   case 82:
02349 
02350 /* Line 1464 of yacc.c  */
02351 #line 733 "src/cmdparse.y"
02352     {
02353         printf("marking window with str %s\n", (yyvsp[(2) - (2)].string));
02354         owindow *current;
02355 
02356         HANDLE_EMPTY_MATCH;
02357 
02358         TAILQ_FOREACH(current, &owindows, owindows) {
02359             printf("matching: %p / %s\n", current->con, current->con->name);
02360             current->con->mark = sstrdup((yyvsp[(2) - (2)].string));
02361         }
02362 
02363         free((yyvsp[(2) - (2)].string));
02364 
02365         tree_render();
02366     ;}
02367     break;
02368 
02369   case 83:
02370 
02371 /* Line 1464 of yacc.c  */
02372 #line 752 "src/cmdparse.y"
02373     {
02374         printf("-------------------------------------------------\n");
02375         printf("  NOP: %s\n", (yyvsp[(2) - (2)].string));
02376         printf("-------------------------------------------------\n");
02377         free((yyvsp[(2) - (2)].string));
02378     ;}
02379     break;
02380 
02381   case 84:
02382 
02383 /* Line 1464 of yacc.c  */
02384 #line 762 "src/cmdparse.y"
02385     {
02386         /* resize <grow|shrink> <direction> [<px> px] [or <ppt> ppt] */
02387         printf("resizing in way %d, direction %d, px %d or ppt %d\n", (yyvsp[(2) - (5)].number), (yyvsp[(3) - (5)].number), (yyvsp[(4) - (5)].number), (yyvsp[(5) - (5)].number));
02388         int direction = (yyvsp[(3) - (5)].number);
02389         int px = (yyvsp[(4) - (5)].number);
02390         int ppt = (yyvsp[(5) - (5)].number);
02391         if ((yyvsp[(2) - (5)].number) == TOK_SHRINK) {
02392             px *= -1;
02393             ppt *= -1;
02394         }
02395 
02396         if (con_is_floating(focused)) {
02397             printf("floating resize\n");
02398             if (direction == TOK_UP) {
02399                 focused->parent->rect.y -= px;
02400                 focused->parent->rect.height += px;
02401             } else if (direction == TOK_DOWN) {
02402                 focused->rect.height += px;
02403             } else if (direction == TOK_LEFT) {
02404                 focused->rect.x -= px;
02405                 focused->rect.width += px;
02406             } else {
02407                 focused->rect.width += px;
02408             }
02409         } else {
02410             LOG("tiling resize\n");
02411             /* get the default percentage */
02412             int children = con_num_children(focused->parent);
02413             Con *other;
02414             LOG("ins. %d children\n", children);
02415             double percentage = 1.0 / children;
02416             LOG("default percentage = %f\n", percentage);
02417 
02418             if (direction == TOK_UP || direction == TOK_LEFT) {
02419                 other = TAILQ_PREV(focused, nodes_head, nodes);
02420             } else {
02421                 other = TAILQ_NEXT(focused, nodes);
02422             }
02423             if (other == TAILQ_END(workspaces)) {
02424                 LOG("No other container in this direction found, cannot resize.\n");
02425                 return 0;
02426             }
02427             LOG("other->percent = %f\n", other->percent);
02428             LOG("focused->percent before = %f\n", focused->percent);
02429             if (focused->percent == 0.0)
02430                 focused->percent = percentage;
02431             if (other->percent == 0.0)
02432                 other->percent = percentage;
02433             focused->percent += ((double)ppt / 100.0);
02434             other->percent -= ((double)ppt / 100.0);
02435             LOG("focused->percent after = %f\n", focused->percent);
02436             LOG("other->percent after = %f\n", other->percent);
02437         }
02438 
02439         tree_render();
02440     ;}
02441     break;
02442 
02443   case 85:
02444 
02445 /* Line 1464 of yacc.c  */
02446 #line 822 "src/cmdparse.y"
02447     {
02448         (yyval.number) = 10;
02449     ;}
02450     break;
02451 
02452   case 86:
02453 
02454 /* Line 1464 of yacc.c  */
02455 #line 826 "src/cmdparse.y"
02456     {
02457         (yyval.number) = (yyvsp[(1) - (2)].number);
02458     ;}
02459     break;
02460 
02461   case 87:
02462 
02463 /* Line 1464 of yacc.c  */
02464 #line 833 "src/cmdparse.y"
02465     {
02466         (yyval.number) = 10;
02467     ;}
02468     break;
02469 
02470   case 88:
02471 
02472 /* Line 1464 of yacc.c  */
02473 #line 837 "src/cmdparse.y"
02474     {
02475         (yyval.number) = (yyvsp[(2) - (3)].number);
02476     ;}
02477     break;
02478 
02479   case 89:
02480 
02481 /* Line 1464 of yacc.c  */
02482 #line 843 "src/cmdparse.y"
02483     { (yyval.number) = TOK_GROW; ;}
02484     break;
02485 
02486   case 90:
02487 
02488 /* Line 1464 of yacc.c  */
02489 #line 844 "src/cmdparse.y"
02490     { (yyval.number) = TOK_SHRINK; ;}
02491     break;
02492 
02493   case 91:
02494 
02495 /* Line 1464 of yacc.c  */
02496 #line 848 "src/cmdparse.y"
02497     { (yyval.number) = TOK_UP; ;}
02498     break;
02499 
02500   case 92:
02501 
02502 /* Line 1464 of yacc.c  */
02503 #line 849 "src/cmdparse.y"
02504     { (yyval.number) = TOK_DOWN; ;}
02505     break;
02506 
02507   case 93:
02508 
02509 /* Line 1464 of yacc.c  */
02510 #line 850 "src/cmdparse.y"
02511     { (yyval.number) = TOK_LEFT; ;}
02512     break;
02513 
02514   case 94:
02515 
02516 /* Line 1464 of yacc.c  */
02517 #line 851 "src/cmdparse.y"
02518     { (yyval.number) = TOK_RIGHT; ;}
02519     break;
02520 
02521   case 95:
02522 
02523 /* Line 1464 of yacc.c  */
02524 #line 856 "src/cmdparse.y"
02525     {
02526         switch_mode((yyvsp[(2) - (2)].string));
02527     ;}
02528     break;
02529 
02530 
02531 
02532 /* Line 1464 of yacc.c  */
02533 #line 2534 "src/cmdparse.tab.c"
02534       default: break;
02535     }
02536   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
02537 
02538   YYPOPSTACK (yylen);
02539   yylen = 0;
02540   YY_STACK_PRINT (yyss, yyssp);
02541 
02542   *++yyvsp = yyval;
02543 
02544   /* Now `shift' the result of the reduction.  Determine what state
02545      that goes to, based on the state we popped back to and the rule
02546      number reduced by.  */
02547 
02548   yyn = yyr1[yyn];
02549 
02550   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
02551   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
02552     yystate = yytable[yystate];
02553   else
02554     yystate = yydefgoto[yyn - YYNTOKENS];
02555 
02556   goto yynewstate;
02557 
02558 
02559 /*------------------------------------.
02560 | yyerrlab -- here on detecting error |
02561 `------------------------------------*/
02562 yyerrlab:
02563   /* If not already recovering from an error, report this error.  */
02564   if (!yyerrstatus)
02565     {
02566       ++yynerrs;
02567 #if ! YYERROR_VERBOSE
02568       yyerror (YY_("syntax error"));
02569 #else
02570       {
02571         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
02572         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
02573           {
02574             YYSIZE_T yyalloc = 2 * yysize;
02575             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
02576               yyalloc = YYSTACK_ALLOC_MAXIMUM;
02577             if (yymsg != yymsgbuf)
02578               YYSTACK_FREE (yymsg);
02579             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
02580             if (yymsg)
02581               yymsg_alloc = yyalloc;
02582             else
02583               {
02584                 yymsg = yymsgbuf;
02585                 yymsg_alloc = sizeof yymsgbuf;
02586               }
02587           }
02588 
02589         if (0 < yysize && yysize <= yymsg_alloc)
02590           {
02591             (void) yysyntax_error (yymsg, yystate, yychar);
02592             yyerror (yymsg);
02593           }
02594         else
02595           {
02596             yyerror (YY_("syntax error"));
02597             if (yysize != 0)
02598               goto yyexhaustedlab;
02599           }
02600       }
02601 #endif
02602     }
02603 
02604 
02605 
02606   if (yyerrstatus == 3)
02607     {
02608       /* If just tried and failed to reuse lookahead token after an
02609          error, discard it.  */
02610 
02611       if (yychar <= YYEOF)
02612         {
02613           /* Return failure if at end of input.  */
02614           if (yychar == YYEOF)
02615             YYABORT;
02616         }
02617       else
02618         {
02619           yydestruct ("Error: discarding",
02620                       yytoken, &yylval);
02621           yychar = YYEMPTY;
02622         }
02623     }
02624 
02625   /* Else will try to reuse lookahead token after shifting the error
02626      token.  */
02627   goto yyerrlab1;
02628 
02629 
02630 /*---------------------------------------------------.
02631 | yyerrorlab -- error raised explicitly by YYERROR.  |
02632 `---------------------------------------------------*/
02633 yyerrorlab:
02634 
02635   /* Pacify compilers like GCC when the user code never invokes
02636      YYERROR and the label yyerrorlab therefore never appears in user
02637      code.  */
02638   if (/*CONSTCOND*/ 0)
02639      goto yyerrorlab;
02640 
02641   /* Do not reclaim the symbols of the rule which action triggered
02642      this YYERROR.  */
02643   YYPOPSTACK (yylen);
02644   yylen = 0;
02645   YY_STACK_PRINT (yyss, yyssp);
02646   yystate = *yyssp;
02647   goto yyerrlab1;
02648 
02649 
02650 /*-------------------------------------------------------------.
02651 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
02652 `-------------------------------------------------------------*/
02653 yyerrlab1:
02654   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
02655 
02656   for (;;)
02657     {
02658       yyn = yypact[yystate];
02659       if (yyn != YYPACT_NINF)
02660         {
02661           yyn += YYTERROR;
02662           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02663             {
02664               yyn = yytable[yyn];
02665               if (0 < yyn)
02666                 break;
02667             }
02668         }
02669 
02670       /* Pop the current state because it cannot handle the error token.  */
02671       if (yyssp == yyss)
02672         YYABORT;
02673 
02674 
02675       yydestruct ("Error: popping",
02676                   yystos[yystate], yyvsp);
02677       YYPOPSTACK (1);
02678       yystate = *yyssp;
02679       YY_STACK_PRINT (yyss, yyssp);
02680     }
02681 
02682   *++yyvsp = yylval;
02683 
02684 
02685   /* Shift the error token.  */
02686   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
02687 
02688   yystate = yyn;
02689   goto yynewstate;
02690 
02691 
02692 /*-------------------------------------.
02693 | yyacceptlab -- YYACCEPT comes here.  |
02694 `-------------------------------------*/
02695 yyacceptlab:
02696   yyresult = 0;
02697   goto yyreturn;
02698 
02699 /*-----------------------------------.
02700 | yyabortlab -- YYABORT comes here.  |
02701 `-----------------------------------*/
02702 yyabortlab:
02703   yyresult = 1;
02704   goto yyreturn;
02705 
02706 #if !defined(yyoverflow) || YYERROR_VERBOSE
02707 /*-------------------------------------------------.
02708 | yyexhaustedlab -- memory exhaustion comes here.  |
02709 `-------------------------------------------------*/
02710 yyexhaustedlab:
02711   yyerror (YY_("memory exhausted"));
02712   yyresult = 2;
02713   /* Fall through.  */
02714 #endif
02715 
02716 yyreturn:
02717   if (yychar != YYEMPTY)
02718      yydestruct ("Cleanup: discarding lookahead",
02719                  yytoken, &yylval);
02720   /* Do not reclaim the symbols of the rule which action triggered
02721      this YYABORT or YYACCEPT.  */
02722   YYPOPSTACK (yylen);
02723   YY_STACK_PRINT (yyss, yyssp);
02724   while (yyssp != yyss)
02725     {
02726       yydestruct ("Cleanup: popping",
02727                   yystos[*yyssp], yyvsp);
02728       YYPOPSTACK (1);
02729     }
02730 #ifndef yyoverflow
02731   if (yyss != yyssa)
02732     YYSTACK_FREE (yyss);
02733 #endif
02734 #if YYERROR_VERBOSE
02735   if (yymsg != yymsgbuf)
02736     YYSTACK_FREE (yymsg);
02737 #endif
02738   /* Make sure YYID is used.  */
02739   return YYID (yyresult);
02740 }
02741 
02742 
02743