twmruined/src/gram.c

2663 lines
85 KiB
C

/* A Bison parser, made by GNU Bison 3.7.6. */
/* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Identify Bison output, and Bison version. */
#define YYBISON 30706
/* Bison version string. */
#define YYBISON_VERSION "3.7.6"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 0
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* First part of user prologue. */
#line 67 "gram.y"
#include <stdio.h>
#include <ctype.h>
#include "twm.h"
#include "menus.h"
#include "list.h"
#include "util.h"
#include "screen.h"
#include "parse.h"
#include "add_window.h"
#include <X11/Xos.h>
#include <X11/Xmu/CharSet.h>
static char *Action = "";
static char *Name = "";
static MenuRoot *root, *pull = NULL;
static MenuRoot *GetRoot ( const char *name, const char *fore, const char *back );
static void GotButton ( int butt, int func );
static void GotKey ( char *key, int func );
static void GotTitleButton ( char *bitmapname, int func, Bool rightside );
static Bool CheckWarpScreenArg ( char *s );
static Bool CheckWarpRingArg ( char *s );
static Bool CheckColormapArg ( char *s );
static void RemoveDQuote ( char *str );
static char *ptr;
static name_list **list;
static int cont = 0;
static int color;
int mods = 0;
unsigned int mods_used = (ShiftMask | ControlMask | Mod1Mask);
extern int yylineno;
static void yyerror ( const char *s );
#line 109 "gram.c"
# ifndef YY_CAST
# ifdef __cplusplus
# define YY_CAST(Type, Val) static_cast<Type> (Val)
# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
# else
# define YY_CAST(Type, Val) ((Type) (Val))
# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
# endif
# endif
# ifndef YY_NULLPTR
# if defined __cplusplus
# if 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# else
# define YY_NULLPTR ((void*)0)
# endif
# endif
/* Use api.header.include to #include this header
instead of duplicating it here. */
#ifndef YY_YY_GRAM_H_INCLUDED
# define YY_YY_GRAM_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
YYEMPTY = -2,
YYEOF = 0, /* "end of file" */
YYerror = 256, /* error */
YYUNDEF = 257, /* "invalid token" */
LB = 258, /* LB */
RB = 259, /* RB */
LP = 260, /* LP */
RP = 261, /* RP */
MENUS = 262, /* MENUS */
MENU = 263, /* MENU */
BUTTON = 264, /* BUTTON */
DEFAULT_FUNCTION = 265, /* DEFAULT_FUNCTION */
PLUS = 266, /* PLUS */
MINUS = 267, /* MINUS */
ALL = 268, /* ALL */
OR = 269, /* OR */
CURSORS = 270, /* CURSORS */
ICONS = 271, /* ICONS */
COLOR = 272, /* COLOR */
SAVECOLOR = 273, /* SAVECOLOR */
MONOCHROME = 274, /* MONOCHROME */
WINDOW_FUNCTION = 275, /* WINDOW_FUNCTION */
MAKE_TITLE = 276, /* MAKE_TITLE */
GRAYSCALE = 277, /* GRAYSCALE */
NO_TITLE = 278, /* NO_TITLE */
AUTO_RAISE = 279, /* AUTO_RAISE */
META = 280, /* META */
SHIFT = 281, /* SHIFT */
LOCK = 282, /* LOCK */
CONTROL = 283, /* CONTROL */
WINDOW = 284, /* WINDOW */
TITLE = 285, /* TITLE */
ICON = 286, /* ICON */
ROOT = 287, /* ROOT */
FRAME = 288, /* FRAME */
COLON = 289, /* COLON */
EQUALS = 290, /* EQUALS */
START_ICONIFIED = 291, /* START_ICONIFIED */
MOVE = 292, /* MOVE */
RESIZE = 293, /* RESIZE */
WAIT = 294, /* WAIT */
SELECT = 295, /* SELECT */
KILL = 296, /* KILL */
LEFT_TITLEBUTTON = 297, /* LEFT_TITLEBUTTON */
RIGHT_TITLEBUTTON = 298, /* RIGHT_TITLEBUTTON */
NUMBER = 299, /* NUMBER */
KEYWORD = 300, /* KEYWORD */
NKEYWORD = 301, /* NKEYWORD */
CKEYWORD = 302, /* CKEYWORD */
CLKEYWORD = 303, /* CLKEYWORD */
FKEYWORD = 304, /* FKEYWORD */
FSKEYWORD = 305, /* FSKEYWORD */
SKEYWORD = 306, /* SKEYWORD */
DKEYWORD = 307, /* DKEYWORD */
JKEYWORD = 308, /* JKEYWORD */
WINDOW_RING = 309, /* WINDOW_RING */
WARP_CURSOR = 310, /* WARP_CURSOR */
ERRORTOKEN = 311, /* ERRORTOKEN */
NO_STACKMODE = 312, /* NO_STACKMODE */
STRING = 313 /* STRING */
};
typedef enum yytokentype yytoken_kind_t;
#endif
/* Token kinds. */
#define YYEMPTY -2
#define YYEOF 0
#define YYerror 256
#define YYUNDEF 257
#define LB 258
#define RB 259
#define LP 260
#define RP 261
#define MENUS 262
#define MENU 263
#define BUTTON 264
#define DEFAULT_FUNCTION 265
#define PLUS 266
#define MINUS 267
#define ALL 268
#define OR 269
#define CURSORS 270
#define ICONS 271
#define COLOR 272
#define SAVECOLOR 273
#define MONOCHROME 274
#define WINDOW_FUNCTION 275
#define MAKE_TITLE 276
#define GRAYSCALE 277
#define NO_TITLE 278
#define AUTO_RAISE 279
#define META 280
#define SHIFT 281
#define LOCK 282
#define CONTROL 283
#define WINDOW 284
#define TITLE 285
#define ICON 286
#define ROOT 287
#define FRAME 288
#define COLON 289
#define EQUALS 290
#define START_ICONIFIED 291
#define MOVE 292
#define RESIZE 293
#define WAIT 294
#define SELECT 295
#define KILL 296
#define LEFT_TITLEBUTTON 297
#define RIGHT_TITLEBUTTON 298
#define NUMBER 299
#define KEYWORD 300
#define NKEYWORD 301
#define CKEYWORD 302
#define CLKEYWORD 303
#define FKEYWORD 304
#define FSKEYWORD 305
#define SKEYWORD 306
#define DKEYWORD 307
#define JKEYWORD 308
#define WINDOW_RING 309
#define WARP_CURSOR 310
#define ERRORTOKEN 311
#define NO_STACKMODE 312
#define STRING 313
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 106 "gram.y"
int num;
char *ptr;
#line 283 "gram.c"
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_GRAM_H_INCLUDED */
/* Symbol kind. */
enum yysymbol_kind_t
{
YYSYMBOL_YYEMPTY = -2,
YYSYMBOL_YYEOF = 0, /* "end of file" */
YYSYMBOL_YYerror = 1, /* error */
YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
YYSYMBOL_LB = 3, /* LB */
YYSYMBOL_RB = 4, /* RB */
YYSYMBOL_LP = 5, /* LP */
YYSYMBOL_RP = 6, /* RP */
YYSYMBOL_MENUS = 7, /* MENUS */
YYSYMBOL_MENU = 8, /* MENU */
YYSYMBOL_BUTTON = 9, /* BUTTON */
YYSYMBOL_DEFAULT_FUNCTION = 10, /* DEFAULT_FUNCTION */
YYSYMBOL_PLUS = 11, /* PLUS */
YYSYMBOL_MINUS = 12, /* MINUS */
YYSYMBOL_ALL = 13, /* ALL */
YYSYMBOL_OR = 14, /* OR */
YYSYMBOL_CURSORS = 15, /* CURSORS */
YYSYMBOL_ICONS = 16, /* ICONS */
YYSYMBOL_COLOR = 17, /* COLOR */
YYSYMBOL_SAVECOLOR = 18, /* SAVECOLOR */
YYSYMBOL_MONOCHROME = 19, /* MONOCHROME */
YYSYMBOL_WINDOW_FUNCTION = 20, /* WINDOW_FUNCTION */
YYSYMBOL_MAKE_TITLE = 21, /* MAKE_TITLE */
YYSYMBOL_GRAYSCALE = 22, /* GRAYSCALE */
YYSYMBOL_NO_TITLE = 23, /* NO_TITLE */
YYSYMBOL_AUTO_RAISE = 24, /* AUTO_RAISE */
YYSYMBOL_META = 25, /* META */
YYSYMBOL_SHIFT = 26, /* SHIFT */
YYSYMBOL_LOCK = 27, /* LOCK */
YYSYMBOL_CONTROL = 28, /* CONTROL */
YYSYMBOL_WINDOW = 29, /* WINDOW */
YYSYMBOL_TITLE = 30, /* TITLE */
YYSYMBOL_ICON = 31, /* ICON */
YYSYMBOL_ROOT = 32, /* ROOT */
YYSYMBOL_FRAME = 33, /* FRAME */
YYSYMBOL_COLON = 34, /* COLON */
YYSYMBOL_EQUALS = 35, /* EQUALS */
YYSYMBOL_START_ICONIFIED = 36, /* START_ICONIFIED */
YYSYMBOL_MOVE = 37, /* MOVE */
YYSYMBOL_RESIZE = 38, /* RESIZE */
YYSYMBOL_WAIT = 39, /* WAIT */
YYSYMBOL_SELECT = 40, /* SELECT */
YYSYMBOL_KILL = 41, /* KILL */
YYSYMBOL_LEFT_TITLEBUTTON = 42, /* LEFT_TITLEBUTTON */
YYSYMBOL_RIGHT_TITLEBUTTON = 43, /* RIGHT_TITLEBUTTON */
YYSYMBOL_NUMBER = 44, /* NUMBER */
YYSYMBOL_KEYWORD = 45, /* KEYWORD */
YYSYMBOL_NKEYWORD = 46, /* NKEYWORD */
YYSYMBOL_CKEYWORD = 47, /* CKEYWORD */
YYSYMBOL_CLKEYWORD = 48, /* CLKEYWORD */
YYSYMBOL_FKEYWORD = 49, /* FKEYWORD */
YYSYMBOL_FSKEYWORD = 50, /* FSKEYWORD */
YYSYMBOL_SKEYWORD = 51, /* SKEYWORD */
YYSYMBOL_DKEYWORD = 52, /* DKEYWORD */
YYSYMBOL_JKEYWORD = 53, /* JKEYWORD */
YYSYMBOL_WINDOW_RING = 54, /* WINDOW_RING */
YYSYMBOL_WARP_CURSOR = 55, /* WARP_CURSOR */
YYSYMBOL_ERRORTOKEN = 56, /* ERRORTOKEN */
YYSYMBOL_NO_STACKMODE = 57, /* NO_STACKMODE */
YYSYMBOL_STRING = 58, /* STRING */
YYSYMBOL_YYACCEPT = 59, /* $accept */
YYSYMBOL_twmrc = 60, /* twmrc */
YYSYMBOL_stmts = 61, /* stmts */
YYSYMBOL_stmt = 62, /* stmt */
YYSYMBOL_63_1 = 63, /* $@1 */
YYSYMBOL_64_2 = 64, /* $@2 */
YYSYMBOL_65_3 = 65, /* $@3 */
YYSYMBOL_66_4 = 66, /* $@4 */
YYSYMBOL_67_5 = 67, /* $@5 */
YYSYMBOL_68_6 = 68, /* $@6 */
YYSYMBOL_69_7 = 69, /* $@7 */
YYSYMBOL_70_8 = 70, /* $@8 */
YYSYMBOL_71_9 = 71, /* $@9 */
YYSYMBOL_72_10 = 72, /* $@10 */
YYSYMBOL_73_11 = 73, /* $@11 */
YYSYMBOL_74_12 = 74, /* $@12 */
YYSYMBOL_75_13 = 75, /* $@13 */
YYSYMBOL_noarg = 76, /* noarg */
YYSYMBOL_sarg = 77, /* sarg */
YYSYMBOL_narg = 78, /* narg */
YYSYMBOL_full = 79, /* full */
YYSYMBOL_fullkey = 80, /* fullkey */
YYSYMBOL_keys = 81, /* keys */
YYSYMBOL_key = 82, /* key */
YYSYMBOL_contexts = 83, /* contexts */
YYSYMBOL_context = 84, /* context */
YYSYMBOL_contextkeys = 85, /* contextkeys */
YYSYMBOL_contextkey = 86, /* contextkey */
YYSYMBOL_cursor_list = 87, /* cursor_list */
YYSYMBOL_cursor_entries = 88, /* cursor_entries */
YYSYMBOL_cursor_entry = 89, /* cursor_entry */
YYSYMBOL_color_list = 90, /* color_list */
YYSYMBOL_color_entries = 91, /* color_entries */
YYSYMBOL_color_entry = 92, /* color_entry */
YYSYMBOL_93_14 = 93, /* $@14 */
YYSYMBOL_save_color_list = 94, /* save_color_list */
YYSYMBOL_s_color_entries = 95, /* s_color_entries */
YYSYMBOL_s_color_entry = 96, /* s_color_entry */
YYSYMBOL_win_color_list = 97, /* win_color_list */
YYSYMBOL_win_color_entries = 98, /* win_color_entries */
YYSYMBOL_win_color_entry = 99, /* win_color_entry */
YYSYMBOL_win_list = 100, /* win_list */
YYSYMBOL_win_entries = 101, /* win_entries */
YYSYMBOL_win_entry = 102, /* win_entry */
YYSYMBOL_icon_list = 103, /* icon_list */
YYSYMBOL_icon_entries = 104, /* icon_entries */
YYSYMBOL_icon_entry = 105, /* icon_entry */
YYSYMBOL_menu = 106, /* menu */
YYSYMBOL_menu_entries = 107, /* menu_entries */
YYSYMBOL_menu_entry = 108, /* menu_entry */
YYSYMBOL_action = 109, /* action */
YYSYMBOL_button = 110, /* button */
YYSYMBOL_string = 111, /* string */
YYSYMBOL_number = 112 /* number */
};
typedef enum yysymbol_kind_t yysymbol_kind_t;
#ifdef short
# undef short
#endif
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
<limits.h> and (if available) <stdint.h> are included
so that the code can choose integer types of a good width. */
#ifndef __PTRDIFF_MAX__
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
# define YY_STDINT_H
# endif
#endif
/* Narrow types that promote to a signed type and that can represent a
signed or unsigned integer of at least N bits. In tables they can
save space and decrease cache pressure. Promoting to a signed type
helps avoid bugs in integer arithmetic. */
#ifdef __INT_LEAST8_MAX__
typedef __INT_LEAST8_TYPE__ yytype_int8;
#elif defined YY_STDINT_H
typedef int_least8_t yytype_int8;
#else
typedef signed char yytype_int8;
#endif
#ifdef __INT_LEAST16_MAX__
typedef __INT_LEAST16_TYPE__ yytype_int16;
#elif defined YY_STDINT_H
typedef int_least16_t yytype_int16;
#else
typedef short yytype_int16;
#endif
/* Work around bug in HP-UX 11.23, which defines these macros
incorrectly for preprocessor constants. This workaround can likely
be removed in 2023, as HPE has promised support for HP-UX 11.23
(aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
<https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
#ifdef __hpux
# undef UINT_LEAST8_MAX
# undef UINT_LEAST16_MAX
# define UINT_LEAST8_MAX 255
# define UINT_LEAST16_MAX 65535
#endif
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
&& UINT_LEAST8_MAX <= INT_MAX)
typedef uint_least8_t yytype_uint8;
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
typedef unsigned char yytype_uint8;
#else
typedef short yytype_uint8;
#endif
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
&& UINT_LEAST16_MAX <= INT_MAX)
typedef uint_least16_t yytype_uint16;
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
typedef unsigned short yytype_uint16;
#else
typedef int yytype_uint16;
#endif
#ifndef YYPTRDIFF_T
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
# define YYPTRDIFF_T __PTRDIFF_TYPE__
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
# elif defined PTRDIFF_MAX
# ifndef ptrdiff_t
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# endif
# define YYPTRDIFF_T ptrdiff_t
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
# else
# define YYPTRDIFF_T long
# define YYPTRDIFF_MAXIMUM LONG_MAX
# endif
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned
# endif
#endif
#define YYSIZE_MAXIMUM \
YY_CAST (YYPTRDIFF_T, \
(YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
? YYPTRDIFF_MAXIMUM \
: YY_CAST (YYSIZE_T, -1)))
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
/* Stored state numbers (used for stacks). */
typedef yytype_uint8 yy_state_t;
/* State numbers in computations. */
typedef int yy_state_fast_t;
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
# define YY_ATTRIBUTE_PURE
# endif
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
# define YY_ATTRIBUTE_UNUSED
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YY_USE(E) ((void) (E))
#else
# define YY_USE(E) /* empty */
#endif
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
# define YY_IGNORE_USELESS_CAST_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
# define YY_IGNORE_USELESS_CAST_END \
_Pragma ("GCC diagnostic pop")
#endif
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_END
#endif
#define YY_ASSERT(E) ((void) (0 && (E)))
#if !defined yyoverflow
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's 'empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
to allow for a few compiler-allocated temporary stack slots. */
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
#endif /* !defined yyoverflow */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yy_state_t yyss_alloc;
YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYPTRDIFF_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / YYSIZEOF (*yyptr); \
} \
while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
YYPTRDIFF_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 3
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 193
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 59
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 54
/* YYNRULES -- Number of rules. */
#define YYNRULES 136
/* YYNSTATES -- Number of states. */
#define YYNSTATES 202
/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 313
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
(0 <= (YYX) && (YYX) <= YYMAXUTOK \
? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
: YYSYMBOL_YYUNDEF)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex. */
static const yytype_int8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int16 yyrline[] =
{
0, 133, 133, 136, 137, 140, 141, 142, 143, 144,
145, 148, 151, 155, 171, 172, 173, 173, 175, 177,
177, 179, 181, 181, 183, 183, 185, 185, 187, 187,
190, 190, 192, 192, 194, 194, 196, 196, 198, 200,
200, 202, 218, 226, 226, 228, 230, 230, 235, 245,
255, 267, 270, 273, 274, 277, 278, 279, 280, 281,
291, 294, 295, 298, 299, 300, 301, 302, 303, 304,
307, 308, 311, 312, 313, 314, 315, 316, 317, 318,
321, 324, 325, 328, 330, 332, 334, 336, 338, 340,
342, 344, 346, 348, 350, 352, 354, 356, 358, 360,
362, 364, 366, 370, 374, 375, 378, 387, 387, 398,
409, 412, 413, 416, 417, 420, 423, 424, 427, 432,
435, 436, 439, 444, 447, 448, 451, 454, 457, 458,
461, 466, 474, 475, 513, 525, 530
};
#endif
/** Accessing symbol of state STATE. */
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
#if YYDEBUG || 0
/* The user-facing name of the symbol whose (internal) number is
YYSYMBOL. No bounds checking. */
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"\"end of file\"", "error", "\"invalid token\"", "LB", "RB", "LP", "RP",
"MENUS", "MENU", "BUTTON", "DEFAULT_FUNCTION", "PLUS", "MINUS", "ALL",
"OR", "CURSORS", "ICONS", "COLOR", "SAVECOLOR", "MONOCHROME",
"WINDOW_FUNCTION", "MAKE_TITLE", "GRAYSCALE", "NO_TITLE", "AUTO_RAISE",
"META", "SHIFT", "LOCK", "CONTROL", "WINDOW", "TITLE", "ICON", "ROOT",
"FRAME", "COLON", "EQUALS", "START_ICONIFIED", "MOVE", "RESIZE", "WAIT",
"SELECT", "KILL", "LEFT_TITLEBUTTON", "RIGHT_TITLEBUTTON", "NUMBER",
"KEYWORD", "NKEYWORD", "CKEYWORD", "CLKEYWORD", "FKEYWORD", "FSKEYWORD",
"SKEYWORD", "DKEYWORD", "JKEYWORD", "WINDOW_RING", "WARP_CURSOR",
"ERRORTOKEN", "NO_STACKMODE", "STRING", "$accept", "twmrc", "stmts",
"stmt", "$@1", "$@2", "$@3", "$@4", "$@5", "$@6", "$@7", "$@8", "$@9",
"$@10", "$@11", "$@12", "$@13", "noarg", "sarg", "narg", "full",
"fullkey", "keys", "key", "contexts", "context", "contextkeys",
"contextkey", "cursor_list", "cursor_entries", "cursor_entry",
"color_list", "color_entries", "color_entry", "$@14", "save_color_list",
"s_color_entries", "s_color_entry", "win_color_list",
"win_color_entries", "win_color_entry", "win_list", "win_entries",
"win_entry", "icon_list", "icon_entries", "icon_entry", "menu",
"menu_entries", "menu_entry", "action", "button", "string", "number", YY_NULLPTR
};
static const char *
yysymbol_name (yysymbol_kind_t yysymbol)
{
return yytname[yysymbol];
}
#endif
#ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
static const yytype_int16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313
};
#endif
#define YYPACT_NINF (-58)
#define yypact_value_is_default(Yyn) \
((Yyn) == YYPACT_NINF)
#define YYTABLE_NINF (-108)
#define yytable_value_is_error(Yyn) \
0
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const yytype_int16 yypact[] =
{
-58, 3, 21, -58, -58, -46, -27, -24, 16, -58,
-58, 25, -58, -24, -58, -58, 31, -58, -58, -46,
-46, -58, -27, -46, -58, 32, 44, -58, -58, -58,
-58, -58, -26, 13, 45, -58, -58, -58, -46, -58,
-58, -58, 46, 52, -58, -58, 52, -58, 57, 52,
57, 57, 57, 33, 38, -58, -58, 57, 57, 57,
-58, -58, -58, -58, -58, -58, -46, 71, -58, 73,
-58, -58, -58, -58, -2, -58, -58, -58, -58, -58,
-58, -58, -24, -24, -58, -58, -58, 143, 158, 49,
-58, -58, -58, -46, -46, -46, -46, -46, -46, -46,
-46, -46, -46, -58, 0, 6, -58, -58, -58, -58,
1, -58, -58, -58, -27, -58, -58, -58, -58, -58,
-58, -46, 4, -46, -46, -46, -46, -46, -46, -46,
-46, -46, -46, -58, -58, -46, -58, -46, -46, -58,
-58, -58, -58, -58, 121, 115, 74, -58, -58, 2,
-58, -58, -58, -58, -58, -58, -58, -58, -58, -58,
-58, -58, 81, -58, -58, -58, -58, -58, -58, -58,
-24, -58, -58, -58, -58, -58, -58, -58, -58, -24,
-58, -58, -58, -46, -58, 82, -58, -58, 71, 53,
-58, -58, -58, -46, 7, 80, -58, -58, -46, -24,
-58, -58
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
3, 0, 0, 1, 5, 0, 0, 0, 0, 32,
34, 0, 39, 0, 22, 36, 21, 26, 24, 0,
0, 48, 0, 0, 46, 45, 18, 135, 4, 6,
7, 8, 0, 0, 30, 136, 134, 132, 0, 41,
81, 9, 0, 0, 111, 38, 0, 42, 0, 0,
0, 0, 0, 0, 0, 50, 49, 0, 0, 0,
53, 15, 13, 12, 53, 14, 0, 0, 133, 0,
124, 33, 104, 35, 0, 40, 120, 23, 37, 20,
27, 25, 0, 0, 47, 44, 17, 0, 0, 0,
128, 31, 80, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 82, 0, 0, 110, 114, 112, 113,
0, 10, 11, 60, 55, 56, 57, 58, 61, 54,
70, 0, 0, 98, 90, 86, 88, 84, 92, 94,
96, 100, 102, 123, 125, 0, 103, 0, 0, 105,
119, 121, 122, 59, 0, 0, 0, 127, 129, 0,
97, 89, 85, 87, 83, 91, 93, 95, 99, 101,
126, 109, 106, 68, 69, 63, 64, 65, 66, 67,
0, 62, 77, 78, 72, 73, 74, 75, 76, 0,
71, 79, 28, 0, 130, 0, 51, 52, 0, 0,
116, 108, 29, 0, 0, 0, 115, 117, 0, 0,
118, 131
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-58, -58, -58, -58, -58, -58, -58, -58, -58, -58,
-58, -58, -58, -58, -58, -58, -58, -58, -58, -58,
-58, -58, 51, -58, -58, -58, -58, -58, -58, -58,
-58, -33, -58, -58, -58, -58, -58, -58, -58, -58,
-58, 50, -58, -58, -58, -58, -58, -57, -58, -58,
-12, -58, -5, -16
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_uint8 yydefgoto[] =
{
0, 1, 2, 28, 59, 50, 48, 52, 51, 188,
67, 42, 43, 49, 46, 58, 57, 29, 30, 31,
61, 65, 87, 119, 144, 171, 145, 180, 41, 69,
103, 73, 105, 139, 185, 45, 74, 108, 191, 194,
197, 77, 110, 141, 71, 104, 134, 91, 122, 148,
39, 32, 33, 36
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
34, 47, 106, 3, 133, 140, 55, 183, 147, 60,
136, 196, 27, 75, 53, 54, 78, 35, 56, 40,
62, -2, 4, 37, 38, 37, 38, 63, 44, 5,
6, 7, 27, 68, -19, -43, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 107, -16, 64, 70,
66, 37, 38, 137, 138, 72, 27, 18, 27, 27,
76, 89, 27, 19, 20, 27, 21, 22, 82, 109,
111, 112, 23, 83, 90, 24, 25, 92, 26, 27,
182, 93, 94, 121, -107, 190, 199, 193, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 143, 135,
79, 80, 81, 95, 96, 142, 97, 84, 85, 86,
98, 99, 100, 101, 102, 88, 146, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159, 172, 173,
160, 192, 161, 162, 163, 164, 0, 184, 0, 0,
181, 0, 0, 0, 174, 175, 176, 177, 178, 179,
165, 166, 167, 168, 169, 170, 0, 113, 186, 0,
0, 0, 0, 0, 0, 0, 0, 187, 114, 115,
116, 117, 113, 27, 0, 0, 0, 118, 189, 0,
0, 0, 0, 114, 115, 116, 117, 201, 195, 198,
0, 0, 120, 200
};
static const yytype_int16 yycheck[] =
{
5, 13, 4, 0, 4, 4, 22, 5, 4, 35,
4, 4, 58, 46, 19, 20, 49, 44, 23, 3,
32, 0, 1, 49, 50, 49, 50, 32, 3, 8,
9, 10, 58, 38, 3, 3, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 48, 3, 35, 3,
5, 49, 50, 47, 48, 3, 58, 36, 58, 58,
3, 66, 58, 42, 43, 58, 45, 46, 35, 74,
82, 83, 51, 35, 3, 54, 55, 4, 57, 58,
6, 8, 9, 34, 3, 3, 6, 34, 93, 94,
95, 96, 97, 98, 99, 100, 101, 102, 114, 104,
50, 51, 52, 30, 31, 110, 33, 57, 58, 59,
37, 38, 39, 40, 41, 64, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 13, 14,
135, 188, 137, 138, 13, 14, -1, 149, -1, -1,
145, -1, -1, -1, 29, 30, 31, 32, 33, 34,
29, 30, 31, 32, 33, 34, -1, 14, 170, -1,
-1, -1, -1, -1, -1, -1, -1, 179, 25, 26,
27, 28, 14, 58, -1, -1, -1, 34, 183, -1,
-1, -1, -1, 25, 26, 27, 28, 199, 193, 194,
-1, -1, 34, 198
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_int8 yystos[] =
{
0, 60, 61, 0, 1, 8, 9, 10, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 36, 42,
43, 45, 46, 51, 54, 55, 57, 58, 62, 76,
77, 78, 110, 111, 111, 44, 112, 49, 50, 109,
3, 87, 70, 71, 3, 94, 73, 109, 65, 72,
64, 67, 66, 111, 111, 112, 111, 75, 74, 63,
35, 79, 109, 111, 35, 80, 5, 69, 111, 88,
3, 103, 3, 90, 95, 90, 3, 100, 90, 100,
100, 100, 35, 35, 100, 100, 100, 81, 81, 111,
3, 106, 4, 8, 9, 30, 31, 33, 37, 38,
39, 40, 41, 89, 104, 91, 4, 48, 96, 111,
101, 109, 109, 14, 25, 26, 27, 28, 34, 82,
34, 34, 107, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 4, 105, 111, 4, 47, 48, 92,
4, 102, 111, 112, 83, 85, 111, 4, 108, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 13, 14, 29, 30, 31, 32, 33,
34, 84, 13, 14, 29, 30, 31, 32, 33, 34,
86, 111, 6, 5, 109, 93, 109, 109, 68, 111,
3, 97, 106, 34, 98, 111, 4, 99, 111, 6,
111, 109
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_int8 yyr1[] =
{
0, 59, 60, 61, 61, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 63, 62, 62, 64,
62, 62, 65, 62, 66, 62, 67, 62, 68, 62,
69, 62, 70, 62, 71, 62, 72, 62, 62, 73,
62, 62, 62, 74, 62, 62, 75, 62, 76, 77,
78, 79, 80, 81, 81, 82, 82, 82, 82, 82,
82, 83, 83, 84, 84, 84, 84, 84, 84, 84,
85, 85, 86, 86, 86, 86, 86, 86, 86, 86,
87, 88, 88, 89, 89, 89, 89, 89, 89, 89,
89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
89, 89, 89, 90, 91, 91, 92, 93, 92, 92,
94, 95, 95, 96, 96, 97, 98, 98, 99, 100,
101, 101, 102, 103, 104, 104, 105, 106, 107, 107,
108, 108, 109, 109, 110, 111, 112
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_int8 yyr2[] =
{
0, 2, 1, 0, 2, 1, 1, 1, 1, 2,
4, 4, 2, 2, 2, 2, 0, 3, 1, 0,
3, 1, 0, 3, 0, 3, 0, 3, 0, 9,
0, 4, 0, 3, 0, 3, 0, 3, 2, 0,
3, 2, 2, 0, 3, 1, 0, 3, 1, 2,
2, 6, 6, 0, 2, 1, 1, 1, 1, 2,
1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
3, 0, 2, 3, 2, 3, 2, 3, 2, 3,
2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
2, 3, 2, 3, 0, 2, 2, 0, 4, 2,
3, 0, 2, 1, 1, 3, 0, 2, 2, 3,
0, 2, 1, 3, 0, 2, 2, 3, 0, 2,
2, 7, 1, 2, 2, 1, 1
};
enum { YYENOMEM = -2 };
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
/* Backward compatibility with an undocumented macro.
Use YYerror or YYUNDEF. */
#define YYERRCODE YYUNDEF
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/* This macro is provided for backward compatibility. */
# ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Kind, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
/*-----------------------------------.
| Print this symbol's value on YYO. |
`-----------------------------------*/
static void
yy_symbol_value_print (FILE *yyo,
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
FILE *yyoutput = yyo;
YY_USE (yyoutput);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yykind < YYNTOKENS)
YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
# endif
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YY_USE (yykind);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
/*---------------------------.
| Print this symbol on YYO. |
`---------------------------*/
static void
yy_symbol_print (FILE *yyo,
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
YYFPRINTF (yyo, "%s %s (",
yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
yy_symbol_value_print (yyo, yykind, yyvaluep);
YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
static void
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
static void
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
int yyrule)
{
int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
&yyvsp[(yyi + 1) - (yynrhs)]);
YYFPRINTF (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyssp, yyvsp, Rule); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args) ((void) 0)
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
static void
yydestruct (const char *yymsg,
yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
{
YY_USE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YY_USE (yykind);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
/* Lookahead token kind. */
int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
/* Number of syntax errors so far. */
int yynerrs;
/*----------.
| yyparse. |
`----------*/
int
yyparse (void)
{
yy_state_fast_t yystate = 0;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus = 0;
/* Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* Their size. */
YYPTRDIFF_T yystacksize = YYINITDEPTH;
/* The state stack: array, bottom, top. */
yy_state_t yyssa[YYINITDEPTH];
yy_state_t *yyss = yyssa;
yy_state_t *yyssp = yyss;
/* The semantic value stack: array, bottom, top. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
YYSTYPE *yyvsp = yyvs;
int yyn;
/* The return value of yyparse. */
int yyresult;
/* Lookahead symbol kind. */
yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
YYDPRINTF ((stderr, "Starting parse\n"));
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
/*--------------------------------------------------------------------.
| yysetstate -- set current state (the top of the stack) to yystate. |
`--------------------------------------------------------------------*/
yysetstate:
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
YY_IGNORE_USELESS_CAST_BEGIN
*yyssp = YY_CAST (yy_state_t, yystate);
YY_IGNORE_USELESS_CAST_END
YY_STACK_PRINT (yyss, yyssp);
if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
goto yyexhaustedlab;
#else
{
/* Get the current used size of the three stacks, in elements. */
YYPTRDIFF_T yysize = yyssp - yyss + 1;
# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
yy_state_t *yyss1 = yyss;
YYSTYPE *yyvs1 = yyvs;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * YYSIZEOF (*yyssp),
&yyvs1, yysize * YYSIZEOF (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
}
# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
yy_state_t *yyss1 = yyss;
union yyalloc *yyptr =
YY_CAST (union yyalloc *,
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YY_IGNORE_USELESS_CAST_BEGIN
YYDPRINTF ((stderr, "Stack size increased to %ld\n",
YY_CAST (long, yystacksize)));
YY_IGNORE_USELESS_CAST_END
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token\n"));
yychar = yylex ();
}
if (yychar <= YYEOF)
{
yychar = YYEOF;
yytoken = YYSYMBOL_YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else if (yychar == YYerror)
{
/* The scanner already issued an error message, process directly
to error recovery. But do not keep the error token as
lookahead, it is too special and may lead us to an endless
loop in error recovery. */
yychar = YYUNDEF;
yytoken = YYSYMBOL_YYerror;
goto yyerrlab1;
}
else
{
yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yytable_value_is_error (yyn))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Discard the shifted token. */
yychar = YYEMPTY;
goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
'$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 9: /* stmt: CURSORS cursor_list */
#line 144 "gram.y"
{}
#line 1540 "gram.c"
break;
case 10: /* stmt: LEFT_TITLEBUTTON string EQUALS action */
#line 145 "gram.y"
{
GotTitleButton ((yyvsp[-2].ptr), (yyvsp[0].num), False);
}
#line 1548 "gram.c"
break;
case 11: /* stmt: RIGHT_TITLEBUTTON string EQUALS action */
#line 148 "gram.y"
{
GotTitleButton ((yyvsp[-2].ptr), (yyvsp[0].num), True);
}
#line 1556 "gram.c"
break;
case 12: /* stmt: button string */
#line 151 "gram.y"
{ root = GetRoot((yyvsp[0].ptr), NULLSTR, NULLSTR);
Scr->Mouse[(yyvsp[-1].num)][C_ROOT][0].func = F_MENU;
Scr->Mouse[(yyvsp[-1].num)][C_ROOT][0].menu = root;
}
#line 1565 "gram.c"
break;
case 13: /* stmt: button action */
#line 155 "gram.y"
{ Scr->Mouse[(yyvsp[-1].num)][C_ROOT][0].func = (yyvsp[0].num);
if ((yyvsp[0].num) == F_MENU)
{
pull->prev = NULL;
Scr->Mouse[(yyvsp[-1].num)][C_ROOT][0].menu = pull;
}
else
{
root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR);
Scr->Mouse[(yyvsp[-1].num)][C_ROOT][0].item =
AddToMenu(root,"x",Action,
NULL,(yyvsp[0].num),NULLSTR,NULLSTR);
}
Action = "";
pull = NULL;
}
#line 1586 "gram.c"
break;
case 14: /* stmt: string fullkey */
#line 171 "gram.y"
{ GotKey((yyvsp[-1].ptr), (yyvsp[0].num)); }
#line 1592 "gram.c"
break;
case 15: /* stmt: button full */
#line 172 "gram.y"
{ GotButton((yyvsp[-1].num), (yyvsp[0].num)); }
#line 1598 "gram.c"
break;
case 16: /* $@1: %empty */
#line 173 "gram.y"
{ list = &Scr->NoStackModeL; }
#line 1604 "gram.c"
break;
case 18: /* stmt: NO_STACKMODE */
#line 175 "gram.y"
{ if (Scr->FirstTime)
Scr->StackMode = FALSE; }
#line 1611 "gram.c"
break;
case 19: /* $@2: %empty */
#line 177 "gram.y"
{ list = &Scr->NoTitle; }
#line 1617 "gram.c"
break;
case 21: /* stmt: NO_TITLE */
#line 179 "gram.y"
{ if (Scr->FirstTime)
Scr->NoTitlebar = TRUE; }
#line 1624 "gram.c"
break;
case 22: /* $@3: %empty */
#line 181 "gram.y"
{ list = &Scr->MakeTitle; }
#line 1630 "gram.c"
break;
case 24: /* $@4: %empty */
#line 183 "gram.y"
{ list = &Scr->StartIconified; }
#line 1636 "gram.c"
break;
case 26: /* $@5: %empty */
#line 185 "gram.y"
{ list = &Scr->AutoRaise; }
#line 1642 "gram.c"
break;
case 28: /* $@6: %empty */
#line 187 "gram.y"
{
root = GetRoot((yyvsp[-5].ptr), (yyvsp[-3].ptr), (yyvsp[-1].ptr)); }
#line 1649 "gram.c"
break;
case 29: /* stmt: MENU string LP string COLON string RP $@6 menu */
#line 189 "gram.y"
{ root->real_menu = TRUE;}
#line 1655 "gram.c"
break;
case 30: /* $@7: %empty */
#line 190 "gram.y"
{ root = GetRoot((yyvsp[0].ptr), NULLSTR, NULLSTR); }
#line 1661 "gram.c"
break;
case 31: /* stmt: MENU string $@7 menu */
#line 191 "gram.y"
{ root->real_menu = TRUE; }
#line 1667 "gram.c"
break;
case 32: /* $@8: %empty */
#line 192 "gram.y"
{ list = &Scr->IconNames; }
#line 1673 "gram.c"
break;
case 34: /* $@9: %empty */
#line 194 "gram.y"
{ color = COLOR; }
#line 1679 "gram.c"
break;
case 36: /* $@10: %empty */
#line 196 "gram.y"
{ color = GRAYSCALE; }
#line 1685 "gram.c"
break;
case 39: /* $@11: %empty */
#line 200 "gram.y"
{ color = MONOCHROME; }
#line 1691 "gram.c"
break;
case 41: /* stmt: DEFAULT_FUNCTION action */
#line 202 "gram.y"
{ Scr->DefaultFunction.func = (yyvsp[0].num);
if ((yyvsp[0].num) == F_MENU)
{
pull->prev = NULL;
Scr->DefaultFunction.menu = pull;
}
else
{
root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR);
Scr->DefaultFunction.item =
AddToMenu(root,"x",Action,
NULL,(yyvsp[0].num), NULLSTR, NULLSTR);
}
Action = "";
pull = NULL;
}
#line 1712 "gram.c"
break;
case 42: /* stmt: WINDOW_FUNCTION action */
#line 218 "gram.y"
{ Scr->WindowFunction.func = (yyvsp[0].num);
root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR);
Scr->WindowFunction.item =
AddToMenu(root,"x",Action,
NULL,(yyvsp[0].num), NULLSTR, NULLSTR);
Action = "";
pull = NULL;
}
#line 1725 "gram.c"
break;
case 43: /* $@12: %empty */
#line 226 "gram.y"
{ list = &Scr->WarpCursorL; }
#line 1731 "gram.c"
break;
case 45: /* stmt: WARP_CURSOR */
#line 228 "gram.y"
{ if (Scr->FirstTime)
Scr->WarpCursor = TRUE; }
#line 1738 "gram.c"
break;
case 46: /* $@13: %empty */
#line 230 "gram.y"
{ list = &Scr->WindowRingL; }
#line 1744 "gram.c"
break;
case 48: /* noarg: KEYWORD */
#line 235 "gram.y"
{ if (!do_single_keyword ((yyvsp[0].num))) {
twmrc_error_prefix();
fprintf (stderr,
"unknown singleton keyword %d\n",
(yyvsp[0].num));
ParseError = 1;
}
}
#line 1757 "gram.c"
break;
case 49: /* sarg: SKEYWORD string */
#line 245 "gram.y"
{ if (!do_string_keyword ((yyvsp[-1].num), (yyvsp[0].ptr))) {
twmrc_error_prefix();
fprintf (stderr,
"unknown string keyword %d (value \"%s\")\n",
(yyvsp[-1].num), (yyvsp[0].ptr));
ParseError = 1;
}
}
#line 1770 "gram.c"
break;
case 50: /* narg: NKEYWORD number */
#line 255 "gram.y"
{ if (!do_number_keyword ((yyvsp[-1].num), (yyvsp[0].num))) {
twmrc_error_prefix();
fprintf (stderr,
"unknown numeric keyword %d (value %d)\n",
(yyvsp[-1].num), (yyvsp[0].num));
ParseError = 1;
}
}
#line 1783 "gram.c"
break;
case 51: /* full: EQUALS keys COLON contexts COLON action */
#line 267 "gram.y"
{ (yyval.num) = (yyvsp[0].num); }
#line 1789 "gram.c"
break;
case 52: /* fullkey: EQUALS keys COLON contextkeys COLON action */
#line 270 "gram.y"
{ (yyval.num) = (yyvsp[0].num); }
#line 1795 "gram.c"
break;
case 55: /* key: META */
#line 277 "gram.y"
{ mods |= Mod1Mask; }
#line 1801 "gram.c"
break;
case 56: /* key: SHIFT */
#line 278 "gram.y"
{ mods |= ShiftMask; }
#line 1807 "gram.c"
break;
case 57: /* key: LOCK */
#line 279 "gram.y"
{ mods |= LockMask; }
#line 1813 "gram.c"
break;
case 58: /* key: CONTROL */
#line 280 "gram.y"
{ mods |= ControlMask; }
#line 1819 "gram.c"
break;
case 59: /* key: META number */
#line 281 "gram.y"
{ if ((yyvsp[0].num) < 1 || (yyvsp[0].num) > 5) {
twmrc_error_prefix();
fprintf (stderr,
"bad modifier number (%d), must be 1-5\n",
(yyvsp[0].num));
ParseError = 1;
} else {
mods |= (Mod1Mask << ((yyvsp[0].num) - 1));
}
}
#line 1834 "gram.c"
break;
case 60: /* key: OR */
#line 291 "gram.y"
{ }
#line 1840 "gram.c"
break;
case 63: /* context: WINDOW */
#line 298 "gram.y"
{ cont |= C_WINDOW_BIT; }
#line 1846 "gram.c"
break;
case 64: /* context: TITLE */
#line 299 "gram.y"
{ cont |= C_TITLE_BIT; }
#line 1852 "gram.c"
break;
case 65: /* context: ICON */
#line 300 "gram.y"
{ cont |= C_ICON_BIT; }
#line 1858 "gram.c"
break;
case 66: /* context: ROOT */
#line 301 "gram.y"
{ cont |= C_ROOT_BIT; }
#line 1864 "gram.c"
break;
case 67: /* context: FRAME */
#line 302 "gram.y"
{ cont |= C_FRAME_BIT; }
#line 1870 "gram.c"
break;
case 68: /* context: ALL */
#line 303 "gram.y"
{ cont |= C_ALL_BITS; }
#line 1876 "gram.c"
break;
case 69: /* context: OR */
#line 304 "gram.y"
{ }
#line 1882 "gram.c"
break;
case 72: /* contextkey: WINDOW */
#line 311 "gram.y"
{ cont |= C_WINDOW_BIT; }
#line 1888 "gram.c"
break;
case 73: /* contextkey: TITLE */
#line 312 "gram.y"
{ cont |= C_TITLE_BIT; }
#line 1894 "gram.c"
break;
case 74: /* contextkey: ICON */
#line 313 "gram.y"
{ cont |= C_ICON_BIT; }
#line 1900 "gram.c"
break;
case 75: /* contextkey: ROOT */
#line 314 "gram.y"
{ cont |= C_ROOT_BIT; }
#line 1906 "gram.c"
break;
case 76: /* contextkey: FRAME */
#line 315 "gram.y"
{ cont |= C_FRAME_BIT; }
#line 1912 "gram.c"
break;
case 77: /* contextkey: ALL */
#line 316 "gram.y"
{ cont |= C_ALL_BITS; }
#line 1918 "gram.c"
break;
case 78: /* contextkey: OR */
#line 317 "gram.y"
{ }
#line 1924 "gram.c"
break;
case 79: /* contextkey: string */
#line 318 "gram.y"
{ Name = (yyvsp[0].ptr); cont |= C_NAME_BIT; }
#line 1930 "gram.c"
break;
case 83: /* cursor_entry: FRAME string string */
#line 328 "gram.y"
{
NewBitmapCursor(&Scr->FrameCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 1937 "gram.c"
break;
case 84: /* cursor_entry: FRAME string */
#line 330 "gram.y"
{
NewFontCursor(&Scr->FrameCursor, (yyvsp[0].ptr)); }
#line 1944 "gram.c"
break;
case 85: /* cursor_entry: TITLE string string */
#line 332 "gram.y"
{
NewBitmapCursor(&Scr->TitleCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 1951 "gram.c"
break;
case 86: /* cursor_entry: TITLE string */
#line 334 "gram.y"
{
NewFontCursor(&Scr->TitleCursor, (yyvsp[0].ptr)); }
#line 1958 "gram.c"
break;
case 87: /* cursor_entry: ICON string string */
#line 336 "gram.y"
{
NewBitmapCursor(&Scr->IconCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 1965 "gram.c"
break;
case 88: /* cursor_entry: ICON string */
#line 338 "gram.y"
{
NewFontCursor(&Scr->IconCursor, (yyvsp[0].ptr)); }
#line 1972 "gram.c"
break;
case 89: /* cursor_entry: BUTTON string string */
#line 340 "gram.y"
{
NewBitmapCursor(&Scr->ButtonCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 1979 "gram.c"
break;
case 90: /* cursor_entry: BUTTON string */
#line 342 "gram.y"
{
NewFontCursor(&Scr->ButtonCursor, (yyvsp[0].ptr)); }
#line 1986 "gram.c"
break;
case 91: /* cursor_entry: MOVE string string */
#line 344 "gram.y"
{
NewBitmapCursor(&Scr->MoveCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 1993 "gram.c"
break;
case 92: /* cursor_entry: MOVE string */
#line 346 "gram.y"
{
NewFontCursor(&Scr->MoveCursor, (yyvsp[0].ptr)); }
#line 2000 "gram.c"
break;
case 93: /* cursor_entry: RESIZE string string */
#line 348 "gram.y"
{
NewBitmapCursor(&Scr->ResizeCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 2007 "gram.c"
break;
case 94: /* cursor_entry: RESIZE string */
#line 350 "gram.y"
{
NewFontCursor(&Scr->ResizeCursor, (yyvsp[0].ptr)); }
#line 2014 "gram.c"
break;
case 95: /* cursor_entry: WAIT string string */
#line 352 "gram.y"
{
NewBitmapCursor(&Scr->WaitCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 2021 "gram.c"
break;
case 96: /* cursor_entry: WAIT string */
#line 354 "gram.y"
{
NewFontCursor(&Scr->WaitCursor, (yyvsp[0].ptr)); }
#line 2028 "gram.c"
break;
case 97: /* cursor_entry: MENU string string */
#line 356 "gram.y"
{
NewBitmapCursor(&Scr->MenuCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 2035 "gram.c"
break;
case 98: /* cursor_entry: MENU string */
#line 358 "gram.y"
{
NewFontCursor(&Scr->MenuCursor, (yyvsp[0].ptr)); }
#line 2042 "gram.c"
break;
case 99: /* cursor_entry: SELECT string string */
#line 360 "gram.y"
{
NewBitmapCursor(&Scr->SelectCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 2049 "gram.c"
break;
case 100: /* cursor_entry: SELECT string */
#line 362 "gram.y"
{
NewFontCursor(&Scr->SelectCursor, (yyvsp[0].ptr)); }
#line 2056 "gram.c"
break;
case 101: /* cursor_entry: KILL string string */
#line 364 "gram.y"
{
NewBitmapCursor(&Scr->DestroyCursor, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 2063 "gram.c"
break;
case 102: /* cursor_entry: KILL string */
#line 366 "gram.y"
{
NewFontCursor(&Scr->DestroyCursor, (yyvsp[0].ptr)); }
#line 2070 "gram.c"
break;
case 106: /* color_entry: CLKEYWORD string */
#line 378 "gram.y"
{ if (!do_colorlist_keyword ((yyvsp[-1].num), color,
(yyvsp[0].ptr))) {
twmrc_error_prefix();
fprintf (stderr,
"unhandled list color keyword %d (string \"%s\")\n",
(yyvsp[-1].num), (yyvsp[0].ptr));
ParseError = 1;
}
}
#line 2084 "gram.c"
break;
case 107: /* $@14: %empty */
#line 387 "gram.y"
{ list = do_colorlist_keyword((yyvsp[-1].num), color,
(yyvsp[0].ptr));
if (!list) {
twmrc_error_prefix();
fprintf (stderr,
"unhandled color list keyword %d (string \"%s\")\n",
(yyvsp[-1].num), (yyvsp[0].ptr));
ParseError = 1;
}
}
#line 2099 "gram.c"
break;
case 108: /* color_entry: CLKEYWORD string $@14 win_color_list */
#line 397 "gram.y"
{ /* No action */; }
#line 2105 "gram.c"
break;
case 109: /* color_entry: CKEYWORD string */
#line 398 "gram.y"
{ if (!do_color_keyword ((yyvsp[-1].num), color,
(yyvsp[0].ptr))) {
twmrc_error_prefix();
fprintf (stderr,
"unhandled color keyword %d (string \"%s\")\n",
(yyvsp[-1].num), (yyvsp[0].ptr));
ParseError = 1;
}
}
#line 2119 "gram.c"
break;
case 113: /* s_color_entry: string */
#line 416 "gram.y"
{ do_string_savecolor(color, (yyvsp[0].ptr)); }
#line 2125 "gram.c"
break;
case 114: /* s_color_entry: CLKEYWORD */
#line 417 "gram.y"
{ do_var_savecolor((yyvsp[0].num)); }
#line 2131 "gram.c"
break;
case 118: /* win_color_entry: string string */
#line 427 "gram.y"
{ if (Scr->FirstTime &&
color == Scr->Monochrome)
AddToList(list, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 2139 "gram.c"
break;
case 122: /* win_entry: string */
#line 439 "gram.y"
{ if (Scr->FirstTime)
AddToList(list, (yyvsp[0].ptr), 0);
}
#line 2147 "gram.c"
break;
case 126: /* icon_entry: string string */
#line 451 "gram.y"
{ if (Scr->FirstTime) AddToList(list, (yyvsp[-1].ptr), (yyvsp[0].ptr)); }
#line 2153 "gram.c"
break;
case 130: /* menu_entry: string action */
#line 461 "gram.y"
{ AddToMenu(root, (yyvsp[-1].ptr), Action, pull, (yyvsp[0].num),
NULLSTR, NULLSTR);
Action = "";
pull = NULL;
}
#line 2163 "gram.c"
break;
case 131: /* menu_entry: string LP string COLON string RP action */
#line 466 "gram.y"
{
AddToMenu(root, (yyvsp[-6].ptr), Action, pull, (yyvsp[0].num),
(yyvsp[-4].ptr), (yyvsp[-2].ptr));
Action = "";
pull = NULL;
}
#line 2174 "gram.c"
break;
case 132: /* action: FKEYWORD */
#line 474 "gram.y"
{ (yyval.num) = (yyvsp[0].num); }
#line 2180 "gram.c"
break;
case 133: /* action: FSKEYWORD string */
#line 475 "gram.y"
{
(yyval.num) = (yyvsp[-1].num);
Action = (yyvsp[0].ptr);
switch ((yyvsp[-1].num)) {
case F_MENU:
pull = GetRoot ((yyvsp[0].ptr), NULLSTR,NULLSTR);
pull->prev = root;
break;
case F_WARPTOSCREEN:
if (!CheckWarpScreenArg (Action)) {
twmrc_error_prefix();
fprintf (stderr,
"ignoring invalid f.warptoscreen argument \"%s\"\n",
Action);
(yyval.num) = F_NOP;
}
break;
case F_COLORMAP:
if (CheckColormapArg (Action)) {
(yyval.num) = F_COLORMAP;
} else {
twmrc_error_prefix();
fprintf (stderr,
"ignoring invalid f.colormap argument \"%s\"\n",
Action);
(yyval.num) = F_NOP;
}
break;
} /* end switch */
}
#line 2215 "gram.c"
break;
case 134: /* button: BUTTON number */
#line 513 "gram.y"
{ (yyval.num) = (yyvsp[0].num);
if ((yyvsp[0].num) == 0)
yyerror("bad button 0");
if ((yyvsp[0].num) > MAX_BUTTONS)
{
(yyval.num) = 0;
yyerror("button number too large");
}
}
#line 2230 "gram.c"
break;
case 135: /* string: STRING */
#line 525 "gram.y"
{ ptr = strdup((yyvsp[0].ptr));
RemoveDQuote(ptr);
(yyval.ptr) = ptr;
}
#line 2239 "gram.c"
break;
case 136: /* number: NUMBER */
#line 530 "gram.y"
{ (yyval.num) = (yyvsp[0].num); }
#line 2245 "gram.c"
break;
#line 2249 "gram.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
incorrect destructor might then be invoked immediately. In the
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
*++yyvsp = yyval;
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
{
const int yylhs = yyr1[yyn] - YYNTOKENS;
const int yyi = yypgoto[yylhs] + *yyssp;
yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
? yytable[yyi]
: yydefgoto[yylhs]);
}
goto yynewstate;
/*--------------------------------------.
| yyerrlab -- here on detecting error. |
`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
yyerror (YY_("syntax error"));
}
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval);
yychar = YYEMPTY;
}
}
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
/* Pacify compilers when the user code never invokes YYERROR and the
label yyerrorlab therefore never appears in user code. */
if (0)
YYERROR;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
/* Pop stack until we find a state that shifts the error token. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
{
yyn += YYSYMBOL_YYerror;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
yydestruct ("Error: popping",
YY_ACCESSING_SYMBOL (yystate), yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined yyoverflow
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
goto yyreturn;
#endif
/*-------------------------------------------------------.
| yyreturn -- parsing is finished, clean up and return. |
`-------------------------------------------------------*/
yyreturn:
if (yychar != YYEMPTY)
{
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
/* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
return yyresult;
}
#line 533 "gram.y"
static void
yyerror(const char *s)
{
twmrc_error_prefix();
fprintf (stderr, "error in input file: %s\n", s ? s : "");
ParseError = 1;
}
static void
RemoveDQuote(char *str)
{
register char *i, *o;
register int n;
register int count;
for (i=str+1, o=str; *i && *i != '\"'; o++)
{
if (*i == '\\')
{
switch (*++i)
{
case 'n':
*o = '\n';
i++;
break;
case 'b':
*o = '\b';
i++;
break;
case 'r':
*o = '\r';
i++;
break;
case 't':
*o = '\t';
i++;
break;
case 'f':
*o = '\f';
i++;
break;
case '0':
if (*++i == 'x')
goto hex;
else
--i;
case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
n = 0;
count = 0;
while (*i >= '0' && *i <= '7' && count < 3)
{
n = (n<<3) + (*i++ - '0');
count++;
}
*o = n;
break;
hex:
case 'x':
n = 0;
count = 0;
while (i++, count++ < 2)
{
if (*i >= '0' && *i <= '9')
n = (n<<4) + (*i - '0');
else if (*i >= 'a' && *i <= 'f')
n = (n<<4) + (*i - 'a') + 10;
else if (*i >= 'A' && *i <= 'F')
n = (n<<4) + (*i - 'A') + 10;
else
break;
}
*o = n;
break;
case '\n':
i++; /* punt */
o--; /* to account for o++ at end of loop */
break;
case '\"':
case '\'':
case '\\':
default:
*o = *i++;
break;
}
}
else
*o = *i++;
}
*o = '\0';
}
static MenuRoot *GetRoot(const char *name, const char* fore, const char *back)
{
MenuRoot *tmp;
tmp = FindMenuRoot(name);
if (tmp == NULL)
tmp = NewMenuRoot(name);
if (fore)
{
int save;
save = Scr->FirstTime;
Scr->FirstTime = TRUE;
GetColor(COLOR, &tmp->hi_fore, fore);
GetColor(COLOR, &tmp->hi_back, back);
Scr->FirstTime = save;
}
return tmp;
}
static void GotButton(int butt, int func)
{
int i;
for (i = 0; i < NUM_CONTEXTS; i++)
{
if ((cont & (1 << i)) == 0)
continue;
Scr->Mouse[butt][i][mods].func = func;
if (func == F_MENU)
{
pull->prev = NULL;
Scr->Mouse[butt][i][mods].menu = pull;
}
else
{
root = GetRoot(TWM_ROOT, NULLSTR, NULLSTR);
Scr->Mouse[butt][i][mods].item = AddToMenu(root,"x",Action,
NULL, func, NULLSTR, NULLSTR);
}
}
Action = "";
pull = NULL;
cont = 0;
mods_used |= mods;
mods = 0;
}
static void GotKey(char *key, int func)
{
int i;
for (i = 0; i < NUM_CONTEXTS; i++)
{
if ((cont & (1 << i)) == 0)
continue;
if (!AddFuncKey(key, i, mods, func, Name, Action))
break;
}
Action = "";
pull = NULL;
cont = 0;
mods_used |= mods;
mods = 0;
}
static void GotTitleButton (char *bitmapname, int func, Bool rightside)
{
if (!CreateTitleButton (bitmapname, func, Action, pull, rightside, True)) {
twmrc_error_prefix();
fprintf (stderr,
"unable to create %s titlebutton \"%s\"\n",
rightside ? "right" : "left", bitmapname);
}
Action = "";
pull = NULL;
}
static Bool CheckWarpScreenArg (char *s)
{
XmuCopyISOLatin1Lowered (s, s);
if (strcmp (s, WARPSCREEN_NEXT) == 0 ||
strcmp (s, WARPSCREEN_PREV) == 0 ||
strcmp (s, WARPSCREEN_BACK) == 0)
return True;
for (; *s && isascii(*s) && isdigit(*s); s++) ; /* SUPPRESS 530 */
return (*s ? False : True);
}
static Bool CheckWarpRingArg (char *s)
{
XmuCopyISOLatin1Lowered (s, s);
if (strcmp (s, WARPSCREEN_NEXT) == 0 ||
strcmp (s, WARPSCREEN_PREV) == 0)
return True;
return False;
}
static Bool CheckColormapArg (char *s)
{
XmuCopyISOLatin1Lowered (s, s);
if (strcmp (s, COLORMAP_NEXT) == 0 ||
strcmp (s, COLORMAP_PREV) == 0 ||
strcmp (s, COLORMAP_DEFAULT) == 0)
return True;
return False;
}
void
twmrc_error_prefix (void)
{
fprintf (stderr, "%s: line %d: ", ProgramName, yylineno);
}