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