/* A Bison parser, made from rcfile.y
   by GNU bison 1.35.  */

#define YYBISON 1  /* Identify Bison output.  */

# define	OPTIONS	257
# define	KEYS	258
# define	PIXMAPS	259
# define	DECOR	260
# define	STYLE	261
# define	PLUGDAT	262
# define	FORPLUG	263
# define	OPAQUEMOVE	264
# define	MOUSEMOD	265
# define	ANIMDELAY	266
# define	DESKTOPCNT	267
# define	DESKTOPWID	268
# define	DESKTOPHEI	269
# define	FULLSCRZOOM	270
# define	LINEWIDTH	271
# define	LINEFG	272
# define	WANTMITSHM	273
# define	WSPACESLIDE	274
# define	RELRESIZE	275
# define	FOCUSNEW	276
# define	XINCORRECT	277
# define	FOCUS	278
# define	FOCUSTYPE	279
# define	PLACEMENT	280
# define	PLACETYPE	281
# define	PLACENONZEROS	282
# define	PLACETRANS	283
# define	TITLEFONT	284
# define	TITLE	285
# define	TITLECOLOR	286
# define	KEYNAME	287
# define	PLACEINTERACT	288
# define	INTERACTTIME	289
# define	DBUTTONLINES	290
# define	DECTYPE	291
# define	DECEDGE	292
# define	ACTION	293
# define	GROUPS	294
# define	DEFAULT	295
# define	TRANSIENT	296
# define	INTERNAL	297
# define	LOAD	298
# define	PARAM	299
# define	FPARAM	300
# define	PLUGPARAM	301
# define	INTEGER	302
# define	BOOLVAL	303
# define	MODIFIER	304
# define	NOMASK	305
# define	CYCLETYPE	306
# define	MVDIR	307
# define	STRING	308
# define	IDENT	309
# define	FLOAT	310

#line 1 "rcfile.y"

/*-
 * Copyright (c) 2001 Jordan DeLong
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the author nor the names of contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */
#include "wm.h"
#include "rclex.h"

/* set a string option after freeing the old one */
#define SETSTR(opt, val) do {	\
	if ((opt)) free((opt));	\
	(opt) = (val);		\
} while (0)

/* used for the dgroup_t that decor are being added to */
static dgroup_t	*dgroup_current	= NULL;

/* used to build subparams */
#define			SUBP_STACK_GRAN		10
static int		subparams_stack_loc	= 0;
static int		subparams_stack_size	= 0;
static subparams_t	**subparams_stack	= NULL;

/* table for plugin names mapped to forplug files */
typedef struct forplug {
	char	*plugin;	/* name of the plugin */
	char	*incfile;	/* path to conditionaly parsed file */

	SLIST_ENTRY(forplug) fp_list;
} forplug_t;
static SLIST_HEAD(, forplug) forplug_tab = SLIST_HEAD_INITIALIZER(forplug_tab);

/* yacc error reporting */
static int yyerror(char *s) {
	warnx("%s, %d: %s", filename, yylineno, s);
	return 0;
}

/* add a param; for the plugin parameter parsing */
static int rcfile_addparam(char *name, char *value, subparams_t *subparams) {
	param_t *param;

	/* make the paramater, name->value pair */
	param = plugin_param(name, value);
	if (!param)
		goto failure;

	/* initialize subparams for the new parameter */
	param->subparams.count = subparams ? subparams->count : 0;
	param->subparams.params = subparams ? subparams->params : NULL;
	if (subparams)
		free(subparams);

	/* add the new parameter onto the current subparam */
	if (plugin_subparams_add(subparams_stack[subparams_stack_loc - 1],
			param) != 0)
		goto failure;

	return 0;

failure:
	if (!param) {
		free(name);
		free(value);
	} else
		plugin_param_free(param);
	yyerror("couldn't add plugin parameter");

	return -1;
}

/* add a plugin -> filename to the forplug table */
static forplug_t *rcfile_forplug(char *plugin, char *incfile) {
	forplug_t *fp_tab;

	/* add an entry to the table */
	fp_tab = malloc(sizeof(forplug_t));
	if (!fp_tab)
		return NULL;
	fp_tab->plugin = plugin;
	fp_tab->incfile = incfile;
	SLIST_INSERT_HEAD(&forplug_tab, fp_tab, fp_list);

	return fp_tab;
}

/* find a forplug entry for a plugin */
static forplug_t *rcfile_find_forplug(char *plugin) {
	forplug_t *fp_tab;

	SLIST_FOREACH(fp_tab, &forplug_tab, fp_list)
		if (strcmp(plugin, fp_tab->plugin) == 0)
			break;

	return fp_tab;
}

/* make a filename using filedir for relative paths */
static char *rcfile_filename(char *name) {
	if (name[0] != '/') {
		char *tmp = malloc(strlen(name) + strlen(filedir) + 1);
		if (!tmp)
			return NULL;
		snprintf(tmp, strlen(name) + strlen(filedir) + 1,
			"%s%s", filedir, name);
		return tmp;
	} else
		return strdup(name);
}


#line 136 "rcfile.y"
#ifndef YYSTYPE
typedef union {
	double		flnum;		/* floating point values */
	int		num;		/* numeric values */
	char		*str;		/* string values */
	void		*vptr;		/* some void * */
	subparams_t	*subparams;	/* subparameters for a plugin */
} yystype;
# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif
#ifndef YYDEBUG
# define YYDEBUG 0
#endif



#define	YYFINAL		172
#define	YYFLAG		-32768
#define	YYNTBASE	65

/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= 310 ? yytranslate[x] : 93)

/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
static const char 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,
      60,    61,     2,     2,    63,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,    64,    59,
       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,    57,    62,    58,     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,     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
};

#if YYDEBUG
static const short yyprhs[] =
{
       0,     0,     1,     4,    10,    16,    22,    28,    29,    35,
      36,    41,    42,    46,    47,    51,    52,    56,    62,    68,
      69,    73,    74,    80,    84,    85,    89,    91,    92,    97,
      98,   104,   110,   112,   115,   118,   121,   124,   127,   130,
     133,   136,   139,   142,   145,   148,   151,   154,   157,   160,
     163,   166,   169,   172,   174,   179,   181,   184,   187,   189,
     192,   194,   197,   200,   203,   206,   208,   225,   227,   229,
     231,   235,   239,   241,   245,   246,   248,   250,   252,   254,
     258,   259,   261,   263,   264,   267,   276,   278
};
static const short yyrhs[] =
{
      -1,    65,     1,     0,    65,     3,    57,    68,    58,     0,
      65,     4,    57,    69,    58,     0,    65,     7,    57,    70,
      58,     0,    65,     9,    54,    83,    59,     0,     0,    65,
      44,    66,    54,    74,     0,     0,    65,     8,    67,    74,
       0,     0,    68,    77,    59,     0,     0,    69,    78,    59,
       0,     0,    70,    79,    59,     0,    70,     5,    57,    71,
      58,     0,    70,     6,    57,    72,    58,     0,     0,    71,
      80,    59,     0,     0,    72,    40,    57,    73,    58,     0,
      72,    82,    59,     0,     0,    73,    81,    59,     0,    59,
       0,     0,    57,    75,    76,    58,     0,     0,    76,    46,
      54,    83,    74,     0,    76,    45,    54,    54,    74,     0,
       1,     0,    13,    48,     0,    14,    48,     0,    15,    48,
       0,    24,    25,     0,    16,    49,     0,    10,    49,     0,
      22,    49,     0,    11,    85,     0,    12,    48,     0,    29,
      49,     0,    28,    49,     0,    34,    49,     0,    35,    48,
       0,    26,    27,     0,    17,    48,     0,    18,    54,     0,
      19,    49,     0,    20,    49,     0,    21,    49,     0,    23,
      49,     0,     1,     0,    33,    54,    85,    87,     0,     1,
       0,    30,    54,     0,    32,    54,     0,     1,     0,    55,
      83,     0,     1,     0,    89,    90,     0,    41,    91,     0,
      42,    91,     0,    43,    91,     0,     1,     0,    55,    37,
      38,    48,    48,    48,    84,    84,    49,    49,    39,    39,
      39,    92,    92,    88,     0,    54,     0,    48,     0,    56,
       0,    60,    86,    61,     0,    60,    51,    61,     0,    50,
       0,    86,    62,    50,     0,     0,    54,     0,    48,     0,
      53,     0,    52,     0,    48,    63,    48,     0,     0,    92,
       0,    55,     0,     0,    90,    55,     0,    90,    55,    64,
      31,    64,    48,    64,    48,     0,    55,     0,    55,     0
};

#endif

#if YYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
       0,   167,   168,   169,   170,   171,   172,   180,   180,   205,
     205,   219,   220,   223,   224,   227,   228,   229,   230,   233,
     234,   237,   238,   239,   242,   243,   246,   247,   247,   271,
     272,   276,   282,   283,   284,   285,   286,   287,   288,   289,
     290,   291,   292,   293,   294,   295,   296,   297,   298,   299,
     300,   301,   302,   305,   306,   317,   318,   319,   322,   323,
     340,   341,   342,   343,   344,   347,   348,   385,   398,   399,
     402,   403,   406,   407,   410,   411,   412,   413,   414,   415,
     430,   431,   434,   449,   450,   462,   481,   492
};
#endif


#if (YYDEBUG) || defined YYERROR_VERBOSE

/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
static const char *const yytname[] =
{
  "$", "error", "$undefined.", "OPTIONS", "KEYS", "PIXMAPS", "DECOR", 
  "STYLE", "PLUGDAT", "FORPLUG", "OPAQUEMOVE", "MOUSEMOD", "ANIMDELAY", 
  "DESKTOPCNT", "DESKTOPWID", "DESKTOPHEI", "FULLSCRZOOM", "LINEWIDTH", 
  "LINEFG", "WANTMITSHM", "WSPACESLIDE", "RELRESIZE", "FOCUSNEW", 
  "XINCORRECT", "FOCUS", "FOCUSTYPE", "PLACEMENT", "PLACETYPE", 
  "PLACENONZEROS", "PLACETRANS", "TITLEFONT", "TITLE", "TITLECOLOR", 
  "KEYNAME", "PLACEINTERACT", "INTERACTTIME", "DBUTTONLINES", "DECTYPE", 
  "DECEDGE", "ACTION", "GROUPS", "DEFAULT", "TRANSIENT", "INTERNAL", 
  "LOAD", "PARAM", "FPARAM", "PLUGPARAM", "INTEGER", "BOOLVAL", 
  "MODIFIER", "NOMASK", "CYCLETYPE", "MVDIR", "STRING", "IDENT", "FLOAT", 
  "'{'", "'}'", "';'", "'('", "')'", "'|'", "','", "':'", "rcfile", "@1", 
  "@2", "options_stmts", "keys_stmts", "style_stmts", "pixmaps_stmts", 
  "decor_stmts", "groups_stmts", "subparams", "@3", "params", 
  "options_stmt", "keys_stmt", "style_stmt", "pixmaps_stmt", 
  "groups_stmt", "decor_stmt", "filename", "floatval", "modmask", 
  "modmaskifiers", "keyarg", "decarg", "addgroup", "decorlist", "groupid", 
  "pixmapid", 0
};
#endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const short yyr1[] =
{
       0,    65,    65,    65,    65,    65,    65,    66,    65,    67,
      65,    68,    68,    69,    69,    70,    70,    70,    70,    71,
      71,    72,    72,    72,    73,    73,    74,    75,    74,    76,
      76,    76,    77,    77,    77,    77,    77,    77,    77,    77,
      77,    77,    77,    77,    77,    77,    77,    77,    77,    77,
      77,    77,    77,    78,    78,    79,    79,    79,    80,    80,
      81,    81,    81,    81,    81,    82,    82,    83,    84,    84,
      85,    85,    86,    86,    87,    87,    87,    87,    87,    87,
      88,    88,    89,    90,    90,    90,    91,    92
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const short yyr2[] =
{
       0,     0,     2,     5,     5,     5,     5,     0,     5,     0,
       4,     0,     3,     0,     3,     0,     3,     5,     5,     0,
       3,     0,     5,     3,     0,     3,     1,     0,     4,     0,
       5,     5,     1,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     1,     4,     1,     2,     2,     1,     2,
       1,     2,     2,     2,     2,     1,    16,     1,     1,     1,
       3,     3,     1,     3,     0,     1,     1,     1,     1,     3,
       0,     1,     1,     0,     2,     8,     1,     1
};

/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
   doesn't specify something else to do.  Zero means the default is an
   error. */
static const short yydefact[] =
{
       1,     0,     2,     0,     0,     0,     9,     0,     7,    11,
      13,    15,     0,     0,     0,     0,     0,     0,    27,    26,
      10,    67,     0,     0,    32,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     3,     0,    53,     0,     4,
       0,    55,     0,     0,     0,     0,     5,     0,    29,     6,
       8,    38,     0,    40,    41,    33,    34,    35,    37,    47,
      48,    49,    50,    51,    39,    52,    36,    46,    43,    42,
      44,    45,    12,     0,    14,    19,    21,    56,    57,    16,
       0,    72,     0,     0,    74,     0,     0,     0,     0,    28,
      71,    70,     0,    76,    78,    77,    75,    54,    58,     0,
      17,     0,    65,     0,     0,    18,     0,     0,     0,    73,
       0,    59,    20,    24,     0,    23,     0,     0,    79,     0,
       0,    31,    30,    60,     0,     0,     0,    82,    22,     0,
      83,     0,    86,    62,    63,    64,    25,    61,     0,    84,
       0,     0,    68,    69,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    85,     0,     0,    87,     0,    80,    66,
      81,     0,     0
};

static const short yydefgoto[] =
{
       1,    14,    12,    15,    16,    17,    95,    96,   129,    20,
      58,    90,    46,    50,    57,   111,   139,   116,    22,   154,
      63,    93,   107,   169,   140,   147,   143,   167
};

static const short yypact[] =
{
  -32768,    67,-32768,   -52,   -11,    -2,-32768,    10,-32768,-32768,
  -32768,-32768,   -32,    15,    18,     0,     3,     1,-32768,-32768,
  -32768,-32768,    -3,   -32,-32768,    31,    21,    34,    35,    36,
      37,    38,    40,    32,    41,    42,    43,    44,    45,    64,
      68,    47,    48,    49,    51,-32768,    46,-32768,    52,-32768,
      50,-32768,    53,    55,    54,    59,-32768,    56,-32768,-32768,
  -32768,-32768,    -9,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  -32768,-32768,-32768,    21,-32768,-32768,-32768,-32768,-32768,-32768,
      -8,-32768,    39,   -13,    25,     8,     7,    60,    62,-32768,
  -32768,-32768,    57,    58,-32768,-32768,-32768,-32768,-32768,    15,
  -32768,    61,-32768,    65,    80,-32768,    66,    69,    15,-32768,
      70,-32768,-32768,-32768,    63,-32768,   -32,   -32,-32768,     2,
      71,-32768,-32768,-32768,    72,    72,    72,-32768,-32768,    73,
  -32768,    76,-32768,-32768,-32768,-32768,-32768,    74,    78,    75,
     -16,    97,-32768,-32768,   -16,    77,    81,    83,    84,    79,
      95,    87,    98,-32768,    99,    85,-32768,    85,    85,-32768,
  -32768,   102,-32768
};

static const short yypgoto[] =
{
  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   -23,
  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   -79,   -18,
      82,-32768,-32768,-32768,-32768,-32768,   -84,  -114
};


#define	YYLAST		165


static const short yytable[] =
{
      60,    24,    51,   133,    47,     9,    52,    53,   112,   108,
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      35,    36,    37,    38,    39,    18,    40,    19,    41,    42,
     121,    54,   152,    55,    43,    44,    48,    97,    98,   127,
     153,    91,    92,   134,   135,   136,    10,   113,   101,   102,
      99,   144,   145,   168,   170,    11,    59,   137,    45,    56,
     138,    49,   114,   109,    13,   115,   110,   171,     2,    21,
       3,     4,    23,   103,     5,     6,     7,   104,   105,   106,
      61,    62,    64,    65,    66,    67,    70,    68,    69,    76,
      71,    72,    73,    74,    75,    77,    78,    79,    80,    81,
     100,   130,   172,   131,   132,    82,    83,   119,    87,    84,
      85,     8,    86,    88,   117,    89,   118,   124,   128,   141,
     122,   120,   123,   126,   148,   125,   150,   142,   155,   149,
     158,   159,   146,   160,   162,   163,   156,   164,   165,   151,
     166,   157,     0,   161,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,    94
};

static const short yycheck[] =
{
      23,     1,     1,     1,     1,    57,     5,     6,     1,     1,
      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
      20,    21,    22,    23,    24,    57,    26,    59,    28,    29,
     109,    30,    48,    32,    34,    35,    33,    45,    46,   118,
      56,    50,    51,    41,    42,    43,    57,    40,    61,    62,
      58,   135,   136,   167,   168,    57,    59,    55,    58,    58,
      58,    58,    55,    55,    54,    58,    58,     0,     1,    54,
       3,     4,    54,    48,     7,     8,     9,    52,    53,    54,
      49,    60,    48,    48,    48,    48,    54,    49,    48,    25,
      49,    49,    49,    49,    49,    27,    49,    49,    49,    48,
      61,    38,     0,   126,   127,    59,    54,    50,    54,    59,
      57,    44,    57,    54,    54,    59,    54,    37,    48,    48,
      59,    63,    57,    54,    48,    59,    48,    55,    31,    55,
      49,    48,    59,    49,    39,    48,   154,    39,    39,    64,
      55,    64,    -1,    64,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    83
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "/usr/local/share/bison/bison.simple"

/* Skeleton output parser for bison,

   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 2, 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, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

/* This is the parser code that is written into each bison parser when
   the %semantic_parser declaration is not specified in the grammar.
   It was written by Richard Stallman by simplifying the hairy parser
   used when %semantic_parser is specified.  */

/* 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.  */

#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# if YYSTACK_USE_ALLOCA
#  define YYSTACK_ALLOC alloca
# else
#  ifndef YYSTACK_USE_ALLOCA
#   if defined (alloca) || defined (_ALLOCA_H)
#    define YYSTACK_ALLOC alloca
#   else
#    ifdef __GNUC__
#     define YYSTACK_ALLOC __builtin_alloca
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning. */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
#  if defined (__STDC__) || defined (__cplusplus)
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T size_t
#  endif
#  define YYSTACK_ALLOC malloc
#  define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */


#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \
	 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  short yyss;
  YYSTYPE yyvs;
# if YYLSP_NEEDED
  YYLTYPE yyls;
# endif
};

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# if YYLSP_NEEDED
#  define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))	\
      + 2 * YYSTACK_GAP_MAX)
# else
#  define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
      + YYSTACK_GAP_MAX)
# endif

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)		\
      do					\
	{					\
	  register YYSIZE_T yyi;		\
	  for (yyi = 0; yyi < (Count); yyi++)	\
	    (To)[yyi] = (From)[yyi];		\
	}					\
      while (0)
#  endif
# endif

/* 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)					\
    do									\
      {									\
	YYSIZE_T yynewbytes;						\
	YYCOPY (&yyptr->Stack, Stack, yysize);				\
	Stack = &yyptr->Stack;						\
	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;	\
	yyptr += yynewbytes / sizeof (*yyptr);				\
      }									\
    while (0)

#endif


#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	goto yyacceptlab
#define YYABORT 	goto yyabortlab
#define YYERROR		goto yyerrlab1
/* Like YYERROR except do call yyerror.  This remains here temporarily
   to ease the transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(Token, Value)					\
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    {								\
      yychar = (Token);						\
      yylval = (Value);						\
      yychar1 = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { 								\
      yyerror ("syntax error: cannot back up");			\
      YYERROR;							\
    }								\
while (0)

#define YYTERROR	1
#define YYERRCODE	256


/* YYLLOC_DEFAULT -- Compute the default location (before the actions
   are run).

   When YYLLOC_DEFAULT is run, CURRENT is set the location of the
   first token.  By default, to implement support for ranges, extend
   its range to the last symbol.  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)       	\
   Current.last_line   = Rhs[N].last_line;	\
   Current.last_column = Rhs[N].last_column;
#endif


/* YYLEX -- calling `yylex' with the right arguments.  */

#if YYPURE
# if YYLSP_NEEDED
#  ifdef YYLEX_PARAM
#   define YYLEX		yylex (&yylval, &yylloc, YYLEX_PARAM)
#  else
#   define YYLEX		yylex (&yylval, &yylloc)
#  endif
# else /* !YYLSP_NEEDED */
#  ifdef YYLEX_PARAM
#   define YYLEX		yylex (&yylval, YYLEX_PARAM)
#  else
#   define YYLEX		yylex (&yylval)
#  endif
# endif /* !YYLSP_NEEDED */
#else /* !YYPURE */
# define YYLEX			yylex ()
#endif /* !YYPURE */


/* 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)
/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
#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
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif

#ifdef YYERROR_VERBOSE

# ifndef yystrlen
#  if defined (__GLIBC__) && defined (_STRING_H)
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
static YYSIZE_T
#   if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
#   else
yystrlen (yystr)
     const char *yystr;
#   endif
{
  register const char *yys = yystr;

  while (*yys++ != '\0')
    continue;

  return yys - yystr - 1;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
#   if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
#   else
yystpcpy (yydest, yysrc)
     char *yydest;
     const char *yysrc;
#   endif
{
  register char *yyd = yydest;
  register const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif
#endif

#line 315 "/usr/local/share/bison/bison.simple"


/* The user can define YYPARSE_PARAM as the name of an argument to be passed
   into yyparse.  The argument should have type void *.
   It should actually point to an object.
   Grammar actions can access the variable by casting it
   to the proper pointer type.  */

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
#  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#  define YYPARSE_PARAM_DECL
# else
#  define YYPARSE_PARAM_ARG YYPARSE_PARAM
#  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
# endif
#else /* !YYPARSE_PARAM */
# define YYPARSE_PARAM_ARG
# define YYPARSE_PARAM_DECL
#endif /* !YYPARSE_PARAM */

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
# ifdef YYPARSE_PARAM
int yyparse (void *);
# else
int yyparse (void);
# endif
#endif

/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
   variables are global, or local to YYPARSE.  */

#define YY_DECL_NON_LSP_VARIABLES			\
/* The lookahead symbol.  */				\
int yychar;						\
							\
/* The semantic value of the lookahead symbol. */	\
YYSTYPE yylval;						\
							\
/* Number of parse errors so far.  */			\
int yynerrs;

#if YYLSP_NEEDED
# define YY_DECL_VARIABLES			\
YY_DECL_NON_LSP_VARIABLES			\
						\
/* Location data for the lookahead symbol.  */	\
YYLTYPE yylloc;
#else
# define YY_DECL_VARIABLES			\
YY_DECL_NON_LSP_VARIABLES
#endif


/* If nonreentrant, generate the variables here. */

#if !YYPURE
YY_DECL_VARIABLES
#endif  /* !YYPURE */

int
yyparse (YYPARSE_PARAM_ARG)
     YYPARSE_PARAM_DECL
{
  /* If reentrant, generate the variables here. */
#if YYPURE
  YY_DECL_VARIABLES
#endif  /* !YYPURE */

  register int yystate;
  register int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Lookahead token as an internal (translated) token number.  */
  int yychar1 = 0;

  /* Three stacks and their tools:
     `yyss': related to states,
     `yyvs': related to semantic values,
     `yyls': related to locations.

     Refer to the stacks thru separate pointers, to allow yyoverflow
     to reallocate them elsewhere.  */

  /* The state stack. */
  short	yyssa[YYINITDEPTH];
  short *yyss = yyssa;
  register short *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  register YYSTYPE *yyvsp;

#if YYLSP_NEEDED
  /* The location stack.  */
  YYLTYPE yylsa[YYINITDEPTH];
  YYLTYPE *yyls = yylsa;
  YYLTYPE *yylsp;
#endif

#if YYLSP_NEEDED
# define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
# define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  YYSIZE_T yystacksize = YYINITDEPTH;


  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;
#if YYLSP_NEEDED
  YYLTYPE yyloc;
#endif

  /* When reducing, the number of symbols on the RHS of the reduced
     rule. */
  int yylen;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss;
  yyvsp = yyvs;
#if YYLSP_NEEDED
  yylsp = yyls;
#endif
  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:
  *yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef 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.  */
	YYSTYPE *yyvs1 = yyvs;
	short *yyss1 = yyss;

	/* Each stack pointer address is followed by the size of the
	   data in use in that stack, in bytes.  */
# if YYLSP_NEEDED
	YYLTYPE *yyls1 = yyls;
	/* This used to be a conditional around just the two extra args,
	   but that might be undefined if yyoverflow is a macro.  */
	yyoverflow ("parser stack overflow",
		    &yyss1, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),
		    &yyls1, yysize * sizeof (*yylsp),
		    &yystacksize);
	yyls = yyls1;
# else
	yyoverflow ("parser stack overflow",
		    &yyss1, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),
		    &yystacksize);
# endif
	yyss = yyss1;
	yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	goto yyoverflowlab;
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;

      {
	short *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyoverflowlab;
	YYSTACK_RELOCATE (yyss);
	YYSTACK_RELOCATE (yyvs);
# if YYLSP_NEEDED
	YYSTACK_RELOCATE (yyls);
# endif
# undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
#if YYLSP_NEEDED
      yylsp = yyls + yysize - 1;
#endif

      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  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.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yychar1 = YYTRANSLATE (yychar);

#if YYDEBUG
     /* We have to keep this `#if YYDEBUG', since we use variables
	which are defined only if `YYDEBUG' is set.  */
      if (yydebug)
	{
	  YYFPRINTF (stderr, "Next token is %d (%s",
		     yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise
	     meaning of a token, for further debugging info.  */
# ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
# endif
	  YYFPRINTF (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %d (%s), ",
	      yychar, yytname[yychar1]));

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#if YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  yystate = yyn;
  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 the semantic value of
     the lookahead token.  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];

#if YYLSP_NEEDED
  /* Similarly for the default location.  Let the user run additional
     commands if for instance locations are ranges.  */
  yyloc = yylsp[1-yylen];
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
#endif

#if YYDEBUG
  /* We have to keep this `#if YYDEBUG', since we use variables which
     are defined only if `YYDEBUG' is set.  */
  if (yydebug)
    {
      int yyi;

      YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
		 yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
	YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
      YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif

  switch (yyn) {

case 6:
#line 172 "rcfile.y"
{
				if (rcfile_forplug(yyvsp[-2].str, yyvsp[-1].str) == NULL) {
					free(yyvsp[-2].str);
					free(yyvsp[-1].str);
					yyerror("out of memory: couldn't make forplug entry");
					YYERROR;
				}
			}
    break;
case 7:
#line 180 "rcfile.y"
{
				if (inside_forplug) {
					yyerror("plugins may not be loaded "
						"from a forplug include");
					YYERROR;
				}
			}
    break;
case 8:
#line 187 "rcfile.y"
{
				plugin_t *plugin;
				forplug_t *forplug;
				
				forplug = rcfile_find_forplug(yyvsp[-1].str);

				if ((plugin = plugin_load(yyvsp[-1].str, yyvsp[0].subparams, forplug ? 0 : 1)) == NULL) {
					if (yyvsp[0].subparams)
						free(yyvsp[0].subparams);
					yyerror("unable to load plugin");
					YYERROR;
				}

				if (forplug)
					rclex_include(forplug->incfile, plugin);
				if (yyvsp[0].subparams)
					free(yyvsp[0].subparams);
			}
    break;
case 9:
#line 205 "rcfile.y"
{
				if (!inside_forplug) {
					yyerror("plugdat section only valid "
						"in a forplug include");
					YYERROR;
				}
			}
    break;
case 10:
#line 212 "rcfile.y"
{
		  		plugin_subparams_merge(&inside_forplug->params, yyvsp[0].subparams);
		  		if (yyvsp[0].subparams)
		  			free(yyvsp[0].subparams);
		  	}
    break;
case 26:
#line 246 "rcfile.y"
{ yyval.subparams = NULL; }
    break;
case 27:
#line 247 "rcfile.y"
{
				if (++subparams_stack_loc > subparams_stack_size) {
					subparams_t **tmp;

					subparams_stack_size += SUBP_STACK_GRAN;
					tmp = realloc(subparams_stack,
						subparams_stack_size * sizeof(subparams_t *));
					if (!tmp) {
						yyerror("not enough memory while"
							" parsing plugin parameters");
						YYERROR;
					}
					subparams_stack = tmp;
					
				}
				subparams_stack[subparams_stack_loc - 1] =
					calloc(1, sizeof(subparams_t));
			}
    break;
case 28:
#line 265 "rcfile.y"
{
				yyval.subparams = subparams_stack[subparams_stack_loc - 1]; 
				subparams_stack[--subparams_stack_loc] = NULL;
			}
    break;
case 30:
#line 272 "rcfile.y"
{
				if (rcfile_addparam(yyvsp[-2].str, yyvsp[-1].str, yyvsp[0].subparams) == -1)
					YYERROR;
			}
    break;
case 31:
#line 276 "rcfile.y"
{
				if (rcfile_addparam(yyvsp[-2].str, yyvsp[-1].str, yyvsp[0].subparams) == -1)
					YYERROR;
			}
    break;
case 33:
#line 283 "rcfile.y"
{ if (yyvsp[0].num > 0) options.desktop_count = yyvsp[0].num; }
    break;
case 34:
#line 284 "rcfile.y"
{ if (yyvsp[0].num > 0) options.desktop_width = yyvsp[0].num; }
    break;
case 35:
#line 285 "rcfile.y"
{ if (yyvsp[0].num > 0) options.desktop_height = yyvsp[0].num; }
    break;
case 36:
#line 286 "rcfile.y"
{ options.focus = yyvsp[0].num; }
    break;
case 37:
#line 287 "rcfile.y"
{ options.fullscreen_zoom = yyvsp[0].num; }
    break;
case 38:
#line 288 "rcfile.y"
{ options.opaquemove = yyvsp[0].num; }
    break;
case 39:
#line 289 "rcfile.y"
{ options.focus_new = yyvsp[0].num; }
    break;
case 40:
#line 290 "rcfile.y"
{ options.mouse_modifier = yyvsp[0].num; }
    break;
case 41:
#line 291 "rcfile.y"
{ options.anim_delay = yyvsp[0].num; }
    break;
case 42:
#line 292 "rcfile.y"
{ options.place_transients = yyvsp[0].num; }
    break;
case 43:
#line 293 "rcfile.y"
{ options.place_nonzeros = yyvsp[0].num; }
    break;
case 44:
#line 294 "rcfile.y"
{ options.place_interactive = yyvsp[0].num; }
    break;
case 45:
#line 295 "rcfile.y"
{ options.interact_timeout = yyvsp[0].num; }
    break;
case 46:
#line 296 "rcfile.y"
{ options.placement = yyvsp[0].num; }
    break;
case 47:
#line 297 "rcfile.y"
{ if (yyvsp[0].num > 0) options.linewidth = yyvsp[0].num; }
    break;
case 48:
#line 298 "rcfile.y"
{ SETSTR(options.linefgclr, yyvsp[0].str); }
    break;
case 49:
#line 299 "rcfile.y"
{ options.wantmitshm = yyvsp[0].num; }
    break;
case 50:
#line 300 "rcfile.y"
{ options.workspace_slide = yyvsp[0].num; }
    break;
case 51:
#line 301 "rcfile.y"
{ options.relative_resize = yyvsp[0].num; }
    break;
case 52:
#line 302 "rcfile.y"
{ options.xinerama_correctloc = yyvsp[0].num; }
    break;
case 54:
#line 306 "rcfile.y"
{
				if (keys_add(XKeysymToKeycode(display, XStringToKeysym(yyvsp[-2].str)),
						yyvsp[-1].num, yyvsp[-3].num, (void *) yyvsp[0].vptr) == NULL) {
					free(yyvsp[-2].str);
					yyerror("couldn't allocate memory for keybind_t");
					YYERROR;
				}
				free(yyvsp[-2].str);
			}
    break;
case 56:
#line 318 "rcfile.y"
{ SETSTR(options.title_font, yyvsp[0].str); }
    break;
case 57:
#line 319 "rcfile.y"
{ SETSTR(options.titleclr, yyvsp[0].str); }
    break;
case 59:
#line 323 "rcfile.y"
{
				if (pixmap_ident(yyvsp[-1].str) != NULL) {
					free(yyvsp[-1].str);
					free(yyvsp[0].str);
					yyerror("duplicate pixmap identifier");
					YYERROR;
				}

				if (pixmap_add(yyvsp[-1].str, yyvsp[0].str) == NULL) {
					free(yyvsp[-1].str);
					free(yyvsp[0].str);
					yyerror("couldn't allocate memory for pixmap");
					YYERROR;
				}
			}
    break;
case 61:
#line 341 "rcfile.y"
{ dgroup_current = NULL; }
    break;
case 62:
#line 342 "rcfile.y"
{ options.dgroup_default = yyvsp[0].vptr; }
    break;
case 63:
#line 343 "rcfile.y"
{ options.dgroup_trans = yyvsp[0].vptr; }
    break;
case 64:
#line 344 "rcfile.y"
{ options.dgroup_internal = yyvsp[0].vptr; }
    break;
case 66:
#line 350 "rcfile.y"
{
				decor_t *decor;

				if (decor_ident(yyvsp[-15].str) != NULL) {
					free(yyvsp[-15].str);
					yyerror("duplicate decoration identifier\n");
					YYERROR;
				}

				decor = calloc(1, sizeof(decor_t));
				if (!decor) {
					free(yyvsp[-15].str);
					yyerror("couldn't allocate memory for decoration.");
					YYERROR;
				}
				decor->ident = yyvsp[-15].str;
				decor->type = yyvsp[-14].num;
				decor->edge = yyvsp[-13].num;
				decor->offset = yyvsp[-12].num;
				decor->lenmod = yyvsp[-11].num;
				decor->soffset = yyvsp[-10].num;
				decor->offsetmult = yyvsp[-9].flnum;
				decor->lenmult = yyvsp[-8].flnum;
				decor->flags.shaped = yyvsp[-7].num;
				decor->flags.button = yyvsp[-6].num;
				decor->lclick_action = yyvsp[-5].num;
				decor->mclick_action = yyvsp[-4].num;
				decor->rclick_action = yyvsp[-3].num;
				decor->pixmap = yyvsp[-2].vptr;
				decor->focpixmap = yyvsp[-1].vptr;
				decor->pressedmap = yyvsp[0].vptr;
				decor_add(decor);
			}
    break;
case 67:
#line 385 "rcfile.y"
{
				char *tmp = rcfile_filename(yyvsp[0].str);

				free(yyvsp[0].str);
				if (!tmp) {
					yyerror("couldn't get memory for filename");
					YYERROR;
				}

				yyval.str = tmp;
			}
    break;
case 68:
#line 398 "rcfile.y"
{ yyval.flnum = (double) yyvsp[0].num; }
    break;
case 70:
#line 402 "rcfile.y"
{ yyval.num = yyvsp[-1].num; }
    break;
case 71:
#line 403 "rcfile.y"
{ yyval.num = 0; }
    break;
case 73:
#line 407 "rcfile.y"
{ yyval.num |= yyvsp[0].num; }
    break;
case 74:
#line 410 "rcfile.y"
{ yyval.vptr = (void *) 0; }
    break;
case 75:
#line 411 "rcfile.y"
{ yyval.vptr = (void *) yyvsp[0].str; }
    break;
case 76:
#line 412 "rcfile.y"
{ yyval.vptr = (void *) yyvsp[0].num; }
    break;
case 77:
#line 413 "rcfile.y"
{ yyval.vptr = (void *) yyvsp[0].num; }
    break;
case 78:
#line 414 "rcfile.y"
{ yyval.vptr = (void *) yyvsp[0].num; }
    break;
case 79:
#line 415 "rcfile.y"
{
				point_t *pt;

				pt = malloc(sizeof(point_t));
				if (!pt) {
					yyerror("couldn't get memory for keyarg, point_t");
					YYERROR;
				}

				pt->x = yyvsp[-2].num;
				pt->y = yyvsp[0].num;
				yyval.vptr = (void *) pt;
			}
    break;
case 80:
#line 430 "rcfile.y"
{ yyval.vptr = NULL; }
    break;
case 82:
#line 434 "rcfile.y"
{
				if (dgroup_ident(yyvsp[0].str) != NULL) {
					free(yyvsp[0].str);
					yyerror("duplicate decoration group identifier");
					YYERROR;
				}

				if ((dgroup_current = dgroup_add(yyvsp[0].str)) == NULL) {
					free(yyvsp[0].str);
					yyerror("couldn't allocate memory for decoration group");
					YYERROR;
				}
			}
    break;
case 84:
#line 450 "rcfile.y"
{
				decor_t *decor;

				decor = decor_ident(yyvsp[0].str);
				free(yyvsp[0].str);
				if (decor == NULL) {
					yyerror("undeclared decoration group identifier");
					YYERROR;
				}
				if (dgroup_add_decor(dgroup_current, decor) == -1)
					warnx("out of mem trying to add decor to dgroup");
			}
    break;
case 85:
#line 462 "rcfile.y"
{
				decor_t *decor;

				decor = decor_ident(yyvsp[-6].str);
				free(yyvsp[-6].str);
				if (decor == NULL) {
					yyerror("undeclared decoration group identifier");
					YYERROR;
				}
				if (dgroup_add_decor(dgroup_current, decor) == -1)
					warnx("out of mem trying to add decor to dgroup");

				/* now add to the title for the group */
				dgroup_current->title = decor;
				dgroup_current->title_x = yyvsp[-2].num;
				dgroup_current->title_y = yyvsp[0].num;
			}
    break;
case 86:
#line 481 "rcfile.y"
{
				dgroup_t *dgroup = dgroup_ident(yyvsp[0].str);
				free(yyvsp[0].str);
				if (dgroup == NULL) {
					yyerror("undeclared decoration group identifier");
					YYERROR;
				}
				yyval.vptr = dgroup;
			}
    break;
case 87:
#line 492 "rcfile.y"
{
				pixmap_t *pixmap = pixmap_ident(yyvsp[0].str);
				free(yyvsp[0].str);
				if (pixmap == NULL) {
					yyerror("undeclared pixmap identifier");
					YYERROR;
				}
				yyval.vptr = pixmap;
			}
    break;
}

#line 705 "/usr/local/share/bison/bison.simple"


  yyvsp -= yylen;
  yyssp -= yylen;
#if YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG
  if (yydebug)
    {
      short *yyssp1 = yyss - 1;
      YYFPRINTF (stderr, "state stack now");
      while (yyssp1 != yyssp)
	YYFPRINTF (stderr, " %d", *++yyssp1);
      YYFPRINTF (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;
#if YYLSP_NEEDED
  *++yylsp = yyloc;
#endif

  /* 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.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  YYSIZE_T yysize = 0;
	  char *yymsg;
	  int yyx, yycount;

	  yycount = 0;
	  /* Start YYX at -YYN if negative to avoid negative indexes in
	     YYCHECK.  */
	  for (yyx = yyn < 0 ? -yyn : 0;
	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
	    if (yycheck[yyx + yyn] == yyx)
	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
	  yysize += yystrlen ("parse error, unexpected ") + 1;
	  yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
	  yymsg = (char *) YYSTACK_ALLOC (yysize);
	  if (yymsg != 0)
	    {
	      char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
	      yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);

	      if (yycount < 5)
		{
		  yycount = 0;
		  for (yyx = yyn < 0 ? -yyn : 0;
		       yyx < (int) (sizeof (yytname) / sizeof (char *));
		       yyx++)
		    if (yycheck[yyx + yyn] == yyx)
		      {
			const char *yyq = ! yycount ? ", expecting " : " or ";
			yyp = yystpcpy (yyp, yyq);
			yyp = yystpcpy (yyp, yytname[yyx]);
			yycount++;
		      }
		}
	      yyerror (yymsg);
	      YYSTACK_FREE (yymsg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exhausted");
	}
      else
#endif /* defined (YYERROR_VERBOSE) */
	yyerror ("parse error");
    }
  goto yyerrlab1;


/*--------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action |
`--------------------------------------------------*/
yyerrlab1:
  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
	 error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;
      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
		  yychar, yytname[yychar1]));
      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;


/*-------------------------------------------------------------------.
| yyerrdefault -- current state does not do anything special for the |
| error token.                                                       |
`-------------------------------------------------------------------*/
yyerrdefault:
#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */

  /* If its default is to accept any token, ok.  Otherwise pop it.  */
  yyn = yydefact[yystate];
  if (yyn)
    goto yydefault;
#endif


/*---------------------------------------------------------------.
| yyerrpop -- pop the current state because it cannot handle the |
| error token                                                    |
`---------------------------------------------------------------*/
yyerrpop:
  if (yyssp == yyss)
    YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#if YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG
  if (yydebug)
    {
      short *yyssp1 = yyss - 1;
      YYFPRINTF (stderr, "Error: state stack now");
      while (yyssp1 != yyssp)
	YYFPRINTF (stderr, " %d", *++yyssp1);
      YYFPRINTF (stderr, "\n");
    }
#endif

/*--------------.
| yyerrhandle.  |
`--------------*/
yyerrhandle:
  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

  YYDPRINTF ((stderr, "Shifting error token, "));

  *++yyvsp = yylval;
#if YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

/*---------------------------------------------.
| yyoverflowab -- parser overflow comes here.  |
`---------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */

yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
  return yyresult;
}
#line 504 "rcfile.y"


/* exported parsing function */
void rcfile_parse() {
	forplug_t *fp_tab, *next;
	char rcfn[MAXPATHLEN];
	FILE *fp;

	/*
	 * get space for filename/dir strings, and for the subparams
	 * stack.  the subparams stack is used for parsing of plugin
	 * subparams in the yacc grammar.
	 */
	filedir = malloc(MAXPATHLEN);
	if (!filedir)
		return;
	filename = malloc(MAXPATHLEN);
	if (!filename)
		goto free1;
	subparams_stack_size = SUBP_STACK_GRAN;
	subparams_stack = calloc(subparams_stack_size, sizeof(subparams_t *));
	if (!subparams_stack)
		goto free2;

	/* build file location strings */	
	snprintf(filedir, MAXPATHLEN, "%s/.golem/", homedir_path);
	snprintf(filename, MAXPATHLEN, "%s", "golemrc");
	snprintf(rcfn, sizeof(rcfn), "%s%s", filedir, filename);

	/*
	 * attempt to open the user's golemrc, if not, try for
	 * the system-wide rc file.
	 */
	fp = fopen(rcfn, "r");
	if (!fp) {
		snprintf(filedir, MAXPATHLEN, "%s/golem/", DATADIR);
		snprintf(rcfn, sizeof(rcfn), "%s%s", filedir, filename);
		fp = fopen(rcfn, "r");
		if (!fp)
			goto free3;
		warnx("unable to read from ~/.golem/golemrc, using system-wide file");
	}

	/*
	 * parse the file, when the flexer reaches EOF for the
	 * file, it will call fclose() on it, so it is not
	 * necessary to call that here.
	 */
	yyin = fp;
	yyparse();

	/* free the forplug table */
	fp_tab = SLIST_FIRST(&forplug_tab);
	while (fp_tab) {
		next = SLIST_NEXT(fp_tab, fp_list);
		free(fp_tab->incfile);
		free(fp_tab->plugin);
		free(fp_tab);
		fp_tab = next;
	}
	SLIST_INIT(&forplug_tab);

free3:	
	free(subparams_stack);
	subparams_stack = NULL;
free2:	
	free(filename);
	filename = NULL;
free1:	
	free(filedir);
	filedir = NULL;
}


syntax highlighted by Code2HTML, v. 0.9.1