cfgparse.c revision 9ff100ac
1/* A Bison parser, made by GNU Bison 2.3.  */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6   Free Software Foundation, Inc.
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program; if not, write to the Free Software
20   Foundation, Inc., 51 Franklin Street, Fifth Floor,
21   Boston, MA 02110-1301, USA.  */
22
23/* As a special exception, you may create a larger work that contains
24   part or all of the Bison parser skeleton and distribute that work
25   under terms of your choice, so long as that work isn't itself a
26   parser generator using the skeleton or a modified version thereof
27   as a parser skeleton.  Alternatively, if you modify or redistribute
28   the parser skeleton itself, you may (at your option) remove this
29   special exception, which will cause the skeleton and the resulting
30   Bison output files to be licensed under the GNU General Public
31   License without this special exception.
32
33   This special exception was added by the Free Software Foundation in
34   version 2.2 of Bison.  */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37   simplifying the original so-called "semantic" parser.  */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40   infringing on user name space.  This should be done even for local
41   variables, as they might otherwise be expanded by user macros.
42   There are some unavoidable exceptions within include files to
43   define necessary library symbols; they are noted "INFRINGES ON
44   USER NAME SPACE" below.  */
45
46/* Identify Bison output.  */
47#define YYBISON 1
48
49/* Bison version.  */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name.  */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers.  */
56#define YYPURE 0
57
58/* Using locations.  */
59#define YYLSP_NEEDED 0
60
61
62
63/* Tokens.  */
64#ifndef YYTOKENTYPE
65# define YYTOKENTYPE
66   /* Put the tokens into the symbol table, so that GDB and other debuggers
67      know about them.  */
68   enum yytokentype {
69     END_OF_FILE = 0,
70     ERROR = 255,
71     BELL = 1,
72     ACCESSX = 2,
73     MESSAGE = 3,
74     NONE = 20,
75     IGNORE = 21,
76     ECHO = 22,
77     PRINT_EV = 23,
78     SHELL = 24,
79     SOUND = 25,
80     EQUALS = 40,
81     PLUS = 41,
82     MINUS = 42,
83     DIVIDE = 43,
84     TIMES = 44,
85     OBRACE = 45,
86     CBRACE = 46,
87     OPAREN = 47,
88     CPAREN = 48,
89     OBRACKET = 49,
90     CBRACKET = 50,
91     DOT = 51,
92     COMMA = 52,
93     SEMI = 53,
94     EXCLAM = 54,
95     INVERT = 55,
96     STRING = 60,
97     INTEGER = 61,
98     FLOAT = 62,
99     IDENT = 63,
100     KEYNAME = 64
101   };
102#endif
103/* Tokens.  */
104#define END_OF_FILE 0
105#define ERROR 255
106#define BELL 1
107#define ACCESSX 2
108#define MESSAGE 3
109#define NONE 20
110#define IGNORE 21
111#define ECHO 22
112#define PRINT_EV 23
113#define SHELL 24
114#define SOUND 25
115#define EQUALS 40
116#define PLUS 41
117#define MINUS 42
118#define DIVIDE 43
119#define TIMES 44
120#define OBRACE 45
121#define CBRACE 46
122#define OPAREN 47
123#define CPAREN 48
124#define OBRACKET 49
125#define CBRACKET 50
126#define DOT 51
127#define COMMA 52
128#define SEMI 53
129#define EXCLAM 54
130#define INVERT 55
131#define STRING 60
132#define INTEGER 61
133#define FLOAT 62
134#define IDENT 63
135#define KEYNAME 64
136
137
138
139
140/* Copy the first part of user declarations.  */
141#line 62 "cfgparse.y"
142
143#ifdef DEBUG
144#define	YYDEBUG 1
145#endif
146#include "xkbevd.h"
147#include <stdlib.h>
148
149
150/* Enabling traces.  */
151#ifndef YYDEBUG
152# define YYDEBUG 0
153#endif
154
155/* Enabling verbose error messages.  */
156#ifdef YYERROR_VERBOSE
157# undef YYERROR_VERBOSE
158# define YYERROR_VERBOSE 1
159#else
160# define YYERROR_VERBOSE 0
161#endif
162
163/* Enabling the token table.  */
164#ifndef YYTOKEN_TABLE
165# define YYTOKEN_TABLE 0
166#endif
167
168#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
169typedef union YYSTYPE
170#line 75 "cfgparse.y"
171{
172	char *		str;
173	int		ival;
174	CfgEntryPtr	entry;
175	ActDefPtr	act;
176}
177/* Line 187 of yacc.c.  */
178#line 179 "cfgparse.c"
179	YYSTYPE;
180# define yystype YYSTYPE /* obsolescent; will be withdrawn */
181# define YYSTYPE_IS_DECLARED 1
182# define YYSTYPE_IS_TRIVIAL 1
183#endif
184
185
186
187/* Copy the second part of user declarations.  */
188
189
190/* Line 216 of yacc.c.  */
191#line 192 "cfgparse.c"
192
193#ifdef short
194# undef short
195#endif
196
197#ifdef YYTYPE_UINT8
198typedef YYTYPE_UINT8 yytype_uint8;
199#else
200typedef unsigned char yytype_uint8;
201#endif
202
203#ifdef YYTYPE_INT8
204typedef YYTYPE_INT8 yytype_int8;
205#elif (defined __STDC__ || defined __C99__FUNC__ \
206     || defined __cplusplus || defined _MSC_VER)
207typedef signed char yytype_int8;
208#else
209typedef short int yytype_int8;
210#endif
211
212#ifdef YYTYPE_UINT16
213typedef YYTYPE_UINT16 yytype_uint16;
214#else
215typedef unsigned short int yytype_uint16;
216#endif
217
218#ifdef YYTYPE_INT16
219typedef YYTYPE_INT16 yytype_int16;
220#else
221typedef short int yytype_int16;
222#endif
223
224#ifndef YYSIZE_T
225# ifdef __SIZE_TYPE__
226#  define YYSIZE_T __SIZE_TYPE__
227# elif defined size_t
228#  define YYSIZE_T size_t
229# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
230     || defined __cplusplus || defined _MSC_VER)
231#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
232#  define YYSIZE_T size_t
233# else
234#  define YYSIZE_T unsigned int
235# endif
236#endif
237
238#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
239
240#ifndef YY_
241# if YYENABLE_NLS
242#  if ENABLE_NLS
243#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
244#   define YY_(msgid) dgettext ("bison-runtime", msgid)
245#  endif
246# endif
247# ifndef YY_
248#  define YY_(msgid) msgid
249# endif
250#endif
251
252/* Suppress unused-variable warnings by "using" E.  */
253#if ! defined lint || defined __GNUC__
254# define YYUSE(e) ((void) (e))
255#else
256# define YYUSE(e) /* empty */
257#endif
258
259/* Identity function, used to suppress warnings about constant conditions.  */
260#ifndef lint
261# define YYID(n) (n)
262#else
263#if (defined __STDC__ || defined __C99__FUNC__ \
264     || defined __cplusplus || defined _MSC_VER)
265static int
266YYID (int i)
267#else
268static int
269YYID (i)
270    int i;
271#endif
272{
273  return i;
274}
275#endif
276
277#if ! defined yyoverflow || YYERROR_VERBOSE
278
279/* The parser invokes alloca or malloc; define the necessary symbols.  */
280
281# ifdef YYSTACK_USE_ALLOCA
282#  if YYSTACK_USE_ALLOCA
283#   ifdef __GNUC__
284#    define YYSTACK_ALLOC __builtin_alloca
285#   elif defined __BUILTIN_VA_ARG_INCR
286#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
287#   elif defined _AIX
288#    define YYSTACK_ALLOC __alloca
289#   elif defined _MSC_VER
290#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
291#    define alloca _alloca
292#   else
293#    define YYSTACK_ALLOC alloca
294#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
295     || defined __cplusplus || defined _MSC_VER)
296#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
297#     ifndef _STDLIB_H
298#      define _STDLIB_H 1
299#     endif
300#    endif
301#   endif
302#  endif
303# endif
304
305# ifdef YYSTACK_ALLOC
306   /* Pacify GCC's `empty if-body' warning.  */
307#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
308#  ifndef YYSTACK_ALLOC_MAXIMUM
309    /* The OS might guarantee only one guard page at the bottom of the stack,
310       and a page size can be as small as 4096 bytes.  So we cannot safely
311       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
312       to allow for a few compiler-allocated temporary stack slots.  */
313#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
314#  endif
315# else
316#  define YYSTACK_ALLOC YYMALLOC
317#  define YYSTACK_FREE YYFREE
318#  ifndef YYSTACK_ALLOC_MAXIMUM
319#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
320#  endif
321#  if (defined __cplusplus && ! defined _STDLIB_H \
322       && ! ((defined YYMALLOC || defined malloc) \
323	     && (defined YYFREE || defined free)))
324#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
325#   ifndef _STDLIB_H
326#    define _STDLIB_H 1
327#   endif
328#  endif
329#  ifndef YYMALLOC
330#   define YYMALLOC malloc
331#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
332     || defined __cplusplus || defined _MSC_VER)
333void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
334#   endif
335#  endif
336#  ifndef YYFREE
337#   define YYFREE free
338#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
339     || defined __cplusplus || defined _MSC_VER)
340void free (void *); /* INFRINGES ON USER NAME SPACE */
341#   endif
342#  endif
343# endif
344#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
345
346
347#if (! defined yyoverflow \
348     && (! defined __cplusplus \
349	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
350
351/* A type that is properly aligned for any stack member.  */
352union yyalloc
353{
354  yytype_int16 yyss;
355  YYSTYPE yyvs;
356  };
357
358/* The size of the maximum gap between one aligned stack and the next.  */
359# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
360
361/* The size of an array large to enough to hold all stacks, each with
362   N elements.  */
363# define YYSTACK_BYTES(N) \
364     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
365      + YYSTACK_GAP_MAXIMUM)
366
367/* Copy COUNT objects from FROM to TO.  The source and destination do
368   not overlap.  */
369# ifndef YYCOPY
370#  if defined __GNUC__ && 1 < __GNUC__
371#   define YYCOPY(To, From, Count) \
372      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
373#  else
374#   define YYCOPY(To, From, Count)		\
375      do					\
376	{					\
377	  YYSIZE_T yyi;				\
378	  for (yyi = 0; yyi < (Count); yyi++)	\
379	    (To)[yyi] = (From)[yyi];		\
380	}					\
381      while (YYID (0))
382#  endif
383# endif
384
385/* Relocate STACK from its old location to the new one.  The
386   local variables YYSIZE and YYSTACKSIZE give the old and new number of
387   elements in the stack, and YYPTR gives the new location of the
388   stack.  Advance YYPTR to a properly aligned location for the next
389   stack.  */
390# define YYSTACK_RELOCATE(Stack)					\
391    do									\
392      {									\
393	YYSIZE_T yynewbytes;						\
394	YYCOPY (&yyptr->Stack, Stack, yysize);				\
395	Stack = &yyptr->Stack;						\
396	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
397	yyptr += yynewbytes / sizeof (*yyptr);				\
398      }									\
399    while (YYID (0))
400
401#endif
402
403/* YYFINAL -- State number of the termination state.  */
404#define YYFINAL  12
405/* YYLAST -- Last index in YYTABLE.  */
406#define YYLAST   28
407
408/* YYNTOKENS -- Number of terminals.  */
409#define YYNTOKENS  34
410/* YYNNTS -- Number of nonterminals.  */
411#define YYNNTS  14
412/* YYNRULES -- Number of rules.  */
413#define YYNRULES  27
414/* YYNRULES -- Number of states.  */
415#define YYNSTATES  33
416
417/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
418#define YYUNDEFTOK  2
419#define YYMAXUTOK   257
420
421#define YYTRANSLATE(YYX)						\
422  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
423
424/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
425static const yytype_uint8 yytranslate[] =
426{
427       0,     4,     5,     6,     2,     2,     2,     2,     2,     2,
428       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
429       7,     8,     9,    10,    11,    12,     2,     2,     2,     2,
430       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
431      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
432      23,    24,    25,    26,    27,    28,     2,     2,     2,     2,
433      29,    30,    31,    32,    33,     2,     2,     2,     2,     2,
434       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
435       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
436       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
437       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
438       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
439       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
440       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
441       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
442       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
443       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
444       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
445       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
446       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
447       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
448       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
449       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
450       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
451       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
452       2,     2,     2,     2,     2,     3,     1,     2
453};
454
455#if YYDEBUG
456/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
457   YYRHS.  */
458static const yytype_uint8 yyprhs[] =
459{
460       0,     0,     3,     5,     8,    10,    13,    15,    19,    24,
461      26,    28,    30,    33,    35,    37,    39,    41,    43,    45,
462      46,    48,    49,    51,    53,    55,    57,    58
463};
464
465/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
466static const yytype_int8 yyrhs[] =
467{
468      35,     0,    -1,    36,    -1,    36,    37,    -1,    37,    -1,
469      39,    41,    -1,    38,    -1,    45,    13,    44,    -1,    40,
470      20,    43,    21,    -1,     4,    -1,     5,    -1,     6,    -1,
471      42,    46,    -1,     7,    -1,     8,    -1,     9,    -1,    10,
472      -1,    11,    -1,    12,    -1,    -1,    44,    -1,    -1,    45,
473      -1,    47,    -1,    32,    -1,    47,    -1,    -1,    29,    -1
474};
475
476/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
477static const yytype_uint8 yyrline[] =
478{
479       0,    86,    86,    90,   102,   105,   113,   116,   133,   150,
480     151,   152,   155,   167,   168,   169,   170,   171,   172,   173,
481     176,   177,   180,   181,   184,   187,   188,   191
482};
483#endif
484
485#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
486/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
487   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
488static const char *const yytname[] =
489{
490  "END_OF_FILE", "error", "$undefined", "ERROR", "BELL", "ACCESSX",
491  "MESSAGE", "NONE", "IGNORE", "ECHO", "PRINT_EV", "SHELL", "SOUND",
492  "EQUALS", "PLUS", "MINUS", "DIVIDE", "TIMES", "OBRACE", "CBRACE",
493  "OPAREN", "CPAREN", "OBRACKET", "CBRACKET", "DOT", "COMMA", "SEMI",
494  "EXCLAM", "INVERT", "STRING", "INTEGER", "FLOAT", "IDENT", "KEYNAME",
495  "$accept", "CfgFile", "CfgEntryList", "CfgEntry", "VarDef", "EventDef",
496  "EventType", "ActionDef", "ActionType", "OptNameSpec", "NameSpec",
497  "Ident", "OptString", "String", 0
498};
499#endif
500
501# ifdef YYPRINT
502/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
503   token YYLEX-NUM.  */
504static const yytype_uint16 yytoknum[] =
505{
506       0,   256,   257,   255,     1,     2,     3,    20,    21,    22,
507      23,    24,    25,    40,    41,    42,    43,    44,    45,    46,
508      47,    48,    49,    50,    51,    52,    53,    54,    55,    60,
509      61,    62,    63,    64
510};
511# endif
512
513/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
514static const yytype_uint8 yyr1[] =
515{
516       0,    34,    35,    36,    36,    37,    37,    38,    39,    40,
517      40,    40,    41,    42,    42,    42,    42,    42,    42,    42,
518      43,    43,    44,    44,    45,    46,    46,    47
519};
520
521/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
522static const yytype_uint8 yyr2[] =
523{
524       0,     2,     1,     2,     1,     2,     1,     3,     4,     1,
525       1,     1,     2,     1,     1,     1,     1,     1,     1,     0,
526       1,     0,     1,     1,     1,     1,     0,     1
527};
528
529/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
530   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
531   means the default is an error.  */
532static const yytype_uint8 yydefact[] =
533{
534       0,     9,    10,    11,    24,     0,     2,     4,     6,    19,
535       0,     0,     1,     3,    13,    14,    15,    16,    17,    18,
536       5,    26,    21,     0,    27,    12,    25,     0,    20,    22,
537      23,     7,     8
538};
539
540/* YYDEFGOTO[NTERM-NUM].  */
541static const yytype_int8 yydefgoto[] =
542{
543      -1,     5,     6,     7,     8,     9,    10,    20,    21,    27,
544      28,    11,    25,    30
545};
546
547/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
548   STATE-NUM.  */
549#define YYPACT_NINF -20
550static const yytype_int8 yypact[] =
551{
552      -4,   -20,   -20,   -20,   -20,     3,    -4,   -20,   -20,    -3,
553      -6,     2,   -20,   -20,   -20,   -20,   -20,   -20,   -20,   -20,
554     -20,   -13,   -19,   -19,   -20,   -20,   -20,    -2,   -20,   -20,
555     -20,   -20,   -20
556};
557
558/* YYPGOTO[NTERM-NUM].  */
559static const yytype_int8 yypgoto[] =
560{
561     -20,   -20,   -20,    11,   -20,   -20,   -20,   -20,   -20,   -20,
562      -5,   -11,   -20,    -1
563};
564
565/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
566   positive, shift that token.  If negative, reduce the rule which
567   number is the opposite.  If zero, do what YYDEFACT says.
568   If YYTABLE_NINF, syntax error.  */
569#define YYTABLE_NINF -1
570static const yytype_uint8 yytable[] =
571{
572       1,     2,     3,    12,    14,    15,    16,    17,    18,    19,
573      24,    29,    29,     4,    22,    23,    24,    13,    31,    32,
574      26,     0,     0,     0,     0,     0,     0,     0,     4
575};
576
577static const yytype_int8 yycheck[] =
578{
579       4,     5,     6,     0,     7,     8,     9,    10,    11,    12,
580      29,    22,    23,    32,    20,    13,    29,     6,    23,    21,
581      21,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32
582};
583
584/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
585   symbol of state STATE-NUM.  */
586static const yytype_uint8 yystos[] =
587{
588       0,     4,     5,     6,    32,    35,    36,    37,    38,    39,
589      40,    45,     0,    37,     7,     8,     9,    10,    11,    12,
590      41,    42,    20,    13,    29,    46,    47,    43,    44,    45,
591      47,    44,    21
592};
593
594#define yyerrok		(yyerrstatus = 0)
595#define yyclearin	(yychar = YYEMPTY)
596#define YYEMPTY		(-2)
597#define YYEOF		0
598
599#define YYACCEPT	goto yyacceptlab
600#define YYABORT		goto yyabortlab
601#define YYERROR		goto yyerrorlab
602
603
604/* Like YYERROR except do call yyerror.  This remains here temporarily
605   to ease the transition to the new meaning of YYERROR, for GCC.
606   Once GCC version 2 has supplanted version 1, this can go.  */
607
608#define YYFAIL		goto yyerrlab
609
610#define YYRECOVERING()  (!!yyerrstatus)
611
612#define YYBACKUP(Token, Value)					\
613do								\
614  if (yychar == YYEMPTY && yylen == 1)				\
615    {								\
616      yychar = (Token);						\
617      yylval = (Value);						\
618      yytoken = YYTRANSLATE (yychar);				\
619      YYPOPSTACK (1);						\
620      goto yybackup;						\
621    }								\
622  else								\
623    {								\
624      yyerror (YY_("syntax error: cannot back up")); \
625      YYERROR;							\
626    }								\
627while (YYID (0))
628
629
630#define YYTERROR	1
631#define YYERRCODE	256
632
633
634/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
635   If N is 0, then set CURRENT to the empty location which ends
636   the previous symbol: RHS[0] (always defined).  */
637
638#define YYRHSLOC(Rhs, K) ((Rhs)[K])
639#ifndef YYLLOC_DEFAULT
640# define YYLLOC_DEFAULT(Current, Rhs, N)				\
641    do									\
642      if (YYID (N))                                                    \
643	{								\
644	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
645	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
646	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
647	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
648	}								\
649      else								\
650	{								\
651	  (Current).first_line   = (Current).last_line   =		\
652	    YYRHSLOC (Rhs, 0).last_line;				\
653	  (Current).first_column = (Current).last_column =		\
654	    YYRHSLOC (Rhs, 0).last_column;				\
655	}								\
656    while (YYID (0))
657#endif
658
659
660/* YY_LOCATION_PRINT -- Print the location on the stream.
661   This macro was not mandated originally: define only if we know
662   we won't break user code: when these are the locations we know.  */
663
664#ifndef YY_LOCATION_PRINT
665# if YYLTYPE_IS_TRIVIAL
666#  define YY_LOCATION_PRINT(File, Loc)			\
667     fprintf (File, "%d.%d-%d.%d",			\
668	      (Loc).first_line, (Loc).first_column,	\
669	      (Loc).last_line,  (Loc).last_column)
670# else
671#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
672# endif
673#endif
674
675
676/* YYLEX -- calling `yylex' with the right arguments.  */
677
678#ifdef YYLEX_PARAM
679# define YYLEX yylex (YYLEX_PARAM)
680#else
681# define YYLEX yylex ()
682#endif
683
684/* Enable debugging if requested.  */
685#if YYDEBUG
686
687# ifndef YYFPRINTF
688#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
689#  define YYFPRINTF fprintf
690# endif
691
692# define YYDPRINTF(Args)			\
693do {						\
694  if (yydebug)					\
695    YYFPRINTF Args;				\
696} while (YYID (0))
697
698# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
699do {									  \
700  if (yydebug)								  \
701    {									  \
702      YYFPRINTF (stderr, "%s ", Title);					  \
703      yy_symbol_print (stderr,						  \
704		  Type, Value); \
705      YYFPRINTF (stderr, "\n");						  \
706    }									  \
707} while (YYID (0))
708
709
710/*--------------------------------.
711| Print this symbol on YYOUTPUT.  |
712`--------------------------------*/
713
714/*ARGSUSED*/
715#if (defined __STDC__ || defined __C99__FUNC__ \
716     || defined __cplusplus || defined _MSC_VER)
717static void
718yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
719#else
720static void
721yy_symbol_value_print (yyoutput, yytype, yyvaluep)
722    FILE *yyoutput;
723    int yytype;
724    YYSTYPE const * const yyvaluep;
725#endif
726{
727  if (!yyvaluep)
728    return;
729# ifdef YYPRINT
730  if (yytype < YYNTOKENS)
731    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
732# else
733  YYUSE (yyoutput);
734# endif
735  switch (yytype)
736    {
737      default:
738	break;
739    }
740}
741
742
743/*--------------------------------.
744| Print this symbol on YYOUTPUT.  |
745`--------------------------------*/
746
747#if (defined __STDC__ || defined __C99__FUNC__ \
748     || defined __cplusplus || defined _MSC_VER)
749static void
750yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
751#else
752static void
753yy_symbol_print (yyoutput, yytype, yyvaluep)
754    FILE *yyoutput;
755    int yytype;
756    YYSTYPE const * const yyvaluep;
757#endif
758{
759  if (yytype < YYNTOKENS)
760    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
761  else
762    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
763
764  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
765  YYFPRINTF (yyoutput, ")");
766}
767
768/*------------------------------------------------------------------.
769| yy_stack_print -- Print the state stack from its BOTTOM up to its |
770| TOP (included).                                                   |
771`------------------------------------------------------------------*/
772
773#if (defined __STDC__ || defined __C99__FUNC__ \
774     || defined __cplusplus || defined _MSC_VER)
775static void
776yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
777#else
778static void
779yy_stack_print (bottom, top)
780    yytype_int16 *bottom;
781    yytype_int16 *top;
782#endif
783{
784  YYFPRINTF (stderr, "Stack now");
785  for (; bottom <= top; ++bottom)
786    YYFPRINTF (stderr, " %d", *bottom);
787  YYFPRINTF (stderr, "\n");
788}
789
790# define YY_STACK_PRINT(Bottom, Top)				\
791do {								\
792  if (yydebug)							\
793    yy_stack_print ((Bottom), (Top));				\
794} while (YYID (0))
795
796
797/*------------------------------------------------.
798| Report that the YYRULE is going to be reduced.  |
799`------------------------------------------------*/
800
801#if (defined __STDC__ || defined __C99__FUNC__ \
802     || defined __cplusplus || defined _MSC_VER)
803static void
804yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
805#else
806static void
807yy_reduce_print (yyvsp, yyrule)
808    YYSTYPE *yyvsp;
809    int yyrule;
810#endif
811{
812  int yynrhs = yyr2[yyrule];
813  int yyi;
814  unsigned long int yylno = yyrline[yyrule];
815  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
816	     yyrule - 1, yylno);
817  /* The symbols being reduced.  */
818  for (yyi = 0; yyi < yynrhs; yyi++)
819    {
820      fprintf (stderr, "   $%d = ", yyi + 1);
821      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
822		       &(yyvsp[(yyi + 1) - (yynrhs)])
823		       		       );
824      fprintf (stderr, "\n");
825    }
826}
827
828# define YY_REDUCE_PRINT(Rule)		\
829do {					\
830  if (yydebug)				\
831    yy_reduce_print (yyvsp, Rule); \
832} while (YYID (0))
833
834/* Nonzero means print parse trace.  It is left uninitialized so that
835   multiple parsers can coexist.  */
836int yydebug;
837#else /* !YYDEBUG */
838# define YYDPRINTF(Args)
839# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
840# define YY_STACK_PRINT(Bottom, Top)
841# define YY_REDUCE_PRINT(Rule)
842#endif /* !YYDEBUG */
843
844
845/* YYINITDEPTH -- initial size of the parser's stacks.  */
846#ifndef	YYINITDEPTH
847# define YYINITDEPTH 200
848#endif
849
850/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
851   if the built-in stack extension method is used).
852
853   Do not make this value too large; the results are undefined if
854   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
855   evaluated with infinite-precision integer arithmetic.  */
856
857#ifndef YYMAXDEPTH
858# define YYMAXDEPTH 10000
859#endif
860
861
862
863#if YYERROR_VERBOSE
864
865# ifndef yystrlen
866#  if defined __GLIBC__ && defined _STRING_H
867#   define yystrlen strlen
868#  else
869/* Return the length of YYSTR.  */
870#if (defined __STDC__ || defined __C99__FUNC__ \
871     || defined __cplusplus || defined _MSC_VER)
872static YYSIZE_T
873yystrlen (const char *yystr)
874#else
875static YYSIZE_T
876yystrlen (yystr)
877    const char *yystr;
878#endif
879{
880  YYSIZE_T yylen;
881  for (yylen = 0; yystr[yylen]; yylen++)
882    continue;
883  return yylen;
884}
885#  endif
886# endif
887
888# ifndef yystpcpy
889#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
890#   define yystpcpy stpcpy
891#  else
892/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
893   YYDEST.  */
894#if (defined __STDC__ || defined __C99__FUNC__ \
895     || defined __cplusplus || defined _MSC_VER)
896static char *
897yystpcpy (char *yydest, const char *yysrc)
898#else
899static char *
900yystpcpy (yydest, yysrc)
901    char *yydest;
902    const char *yysrc;
903#endif
904{
905  char *yyd = yydest;
906  const char *yys = yysrc;
907
908  while ((*yyd++ = *yys++) != '\0')
909    continue;
910
911  return yyd - 1;
912}
913#  endif
914# endif
915
916# ifndef yytnamerr
917/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
918   quotes and backslashes, so that it's suitable for yyerror.  The
919   heuristic is that double-quoting is unnecessary unless the string
920   contains an apostrophe, a comma, or backslash (other than
921   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
922   null, do not copy; instead, return the length of what the result
923   would have been.  */
924static YYSIZE_T
925yytnamerr (char *yyres, const char *yystr)
926{
927  if (*yystr == '"')
928    {
929      YYSIZE_T yyn = 0;
930      char const *yyp = yystr;
931
932      for (;;)
933	switch (*++yyp)
934	  {
935	  case '\'':
936	  case ',':
937	    goto do_not_strip_quotes;
938
939	  case '\\':
940	    if (*++yyp != '\\')
941	      goto do_not_strip_quotes;
942	    /* Fall through.  */
943	  default:
944	    if (yyres)
945	      yyres[yyn] = *yyp;
946	    yyn++;
947	    break;
948
949	  case '"':
950	    if (yyres)
951	      yyres[yyn] = '\0';
952	    return yyn;
953	  }
954    do_not_strip_quotes: ;
955    }
956
957  if (! yyres)
958    return yystrlen (yystr);
959
960  return yystpcpy (yyres, yystr) - yyres;
961}
962# endif
963
964/* Copy into YYRESULT an error message about the unexpected token
965   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
966   including the terminating null byte.  If YYRESULT is null, do not
967   copy anything; just return the number of bytes that would be
968   copied.  As a special case, return 0 if an ordinary "syntax error"
969   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
970   size calculation.  */
971static YYSIZE_T
972yysyntax_error (char *yyresult, int yystate, int yychar)
973{
974  int yyn = yypact[yystate];
975
976  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
977    return 0;
978  else
979    {
980      int yytype = YYTRANSLATE (yychar);
981      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
982      YYSIZE_T yysize = yysize0;
983      YYSIZE_T yysize1;
984      int yysize_overflow = 0;
985      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
986      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
987      int yyx;
988
989# if 0
990      /* This is so xgettext sees the translatable formats that are
991	 constructed on the fly.  */
992      YY_("syntax error, unexpected %s");
993      YY_("syntax error, unexpected %s, expecting %s");
994      YY_("syntax error, unexpected %s, expecting %s or %s");
995      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
996      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
997# endif
998      char *yyfmt;
999      char const *yyf;
1000      static char const yyunexpected[] = "syntax error, unexpected %s";
1001      static char const yyexpecting[] = ", expecting %s";
1002      static char const yyor[] = " or %s";
1003      char yyformat[sizeof yyunexpected
1004		    + sizeof yyexpecting - 1
1005		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1006		       * (sizeof yyor - 1))];
1007      char const *yyprefix = yyexpecting;
1008
1009      /* Start YYX at -YYN if negative to avoid negative indexes in
1010	 YYCHECK.  */
1011      int yyxbegin = yyn < 0 ? -yyn : 0;
1012
1013      /* Stay within bounds of both yycheck and yytname.  */
1014      int yychecklim = YYLAST - yyn + 1;
1015      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1016      int yycount = 1;
1017
1018      yyarg[0] = yytname[yytype];
1019      yyfmt = yystpcpy (yyformat, yyunexpected);
1020
1021      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1022	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1023	  {
1024	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1025	      {
1026		yycount = 1;
1027		yysize = yysize0;
1028		yyformat[sizeof yyunexpected - 1] = '\0';
1029		break;
1030	      }
1031	    yyarg[yycount++] = yytname[yyx];
1032	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1033	    yysize_overflow |= (yysize1 < yysize);
1034	    yysize = yysize1;
1035	    yyfmt = yystpcpy (yyfmt, yyprefix);
1036	    yyprefix = yyor;
1037	  }
1038
1039      yyf = YY_(yyformat);
1040      yysize1 = yysize + yystrlen (yyf);
1041      yysize_overflow |= (yysize1 < yysize);
1042      yysize = yysize1;
1043
1044      if (yysize_overflow)
1045	return YYSIZE_MAXIMUM;
1046
1047      if (yyresult)
1048	{
1049	  /* Avoid sprintf, as that infringes on the user's name space.
1050	     Don't have undefined behavior even if the translation
1051	     produced a string with the wrong number of "%s"s.  */
1052	  char *yyp = yyresult;
1053	  int yyi = 0;
1054	  while ((*yyp = *yyf) != '\0')
1055	    {
1056	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1057		{
1058		  yyp += yytnamerr (yyp, yyarg[yyi++]);
1059		  yyf += 2;
1060		}
1061	      else
1062		{
1063		  yyp++;
1064		  yyf++;
1065		}
1066	    }
1067	}
1068      return yysize;
1069    }
1070}
1071#endif /* YYERROR_VERBOSE */
1072
1073
1074/*-----------------------------------------------.
1075| Release the memory associated to this symbol.  |
1076`-----------------------------------------------*/
1077
1078/*ARGSUSED*/
1079#if (defined __STDC__ || defined __C99__FUNC__ \
1080     || defined __cplusplus || defined _MSC_VER)
1081static void
1082yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1083#else
1084static void
1085yydestruct (yymsg, yytype, yyvaluep)
1086    const char *yymsg;
1087    int yytype;
1088    YYSTYPE *yyvaluep;
1089#endif
1090{
1091  YYUSE (yyvaluep);
1092
1093  if (!yymsg)
1094    yymsg = "Deleting";
1095  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1096
1097  switch (yytype)
1098    {
1099
1100      default:
1101	break;
1102    }
1103}
1104
1105
1106/* Prevent warnings from -Wmissing-prototypes.  */
1107
1108#ifdef YYPARSE_PARAM
1109#if defined __STDC__ || defined __cplusplus
1110int yyparse (void *YYPARSE_PARAM);
1111#else
1112int yyparse ();
1113#endif
1114#else /* ! YYPARSE_PARAM */
1115#if defined __STDC__ || defined __cplusplus
1116int yyparse (void);
1117#else
1118int yyparse ();
1119#endif
1120#endif /* ! YYPARSE_PARAM */
1121
1122
1123
1124/* The look-ahead symbol.  */
1125int yychar;
1126
1127/* The semantic value of the look-ahead symbol.  */
1128YYSTYPE yylval;
1129
1130/* Number of syntax errors so far.  */
1131int yynerrs;
1132
1133
1134
1135/*----------.
1136| yyparse.  |
1137`----------*/
1138
1139#ifdef YYPARSE_PARAM
1140#if (defined __STDC__ || defined __C99__FUNC__ \
1141     || defined __cplusplus || defined _MSC_VER)
1142int
1143yyparse (void *YYPARSE_PARAM)
1144#else
1145int
1146yyparse (YYPARSE_PARAM)
1147    void *YYPARSE_PARAM;
1148#endif
1149#else /* ! YYPARSE_PARAM */
1150#if (defined __STDC__ || defined __C99__FUNC__ \
1151     || defined __cplusplus || defined _MSC_VER)
1152int
1153yyparse (void)
1154#else
1155int
1156yyparse ()
1157
1158#endif
1159#endif
1160{
1161
1162  int yystate;
1163  int yyn;
1164  int yyresult;
1165  /* Number of tokens to shift before error messages enabled.  */
1166  int yyerrstatus;
1167  /* Look-ahead token as an internal (translated) token number.  */
1168  int yytoken = 0;
1169#if YYERROR_VERBOSE
1170  /* Buffer for error messages, and its allocated size.  */
1171  char yymsgbuf[128];
1172  char *yymsg = yymsgbuf;
1173  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1174#endif
1175
1176  /* Three stacks and their tools:
1177     `yyss': related to states,
1178     `yyvs': related to semantic values,
1179     `yyls': related to locations.
1180
1181     Refer to the stacks thru separate pointers, to allow yyoverflow
1182     to reallocate them elsewhere.  */
1183
1184  /* The state stack.  */
1185  yytype_int16 yyssa[YYINITDEPTH];
1186  yytype_int16 *yyss = yyssa;
1187  yytype_int16 *yyssp;
1188
1189  /* The semantic value stack.  */
1190  YYSTYPE yyvsa[YYINITDEPTH];
1191  YYSTYPE *yyvs = yyvsa;
1192  YYSTYPE *yyvsp;
1193
1194
1195
1196#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1197
1198  YYSIZE_T yystacksize = YYINITDEPTH;
1199
1200  /* The variables used to return semantic value and location from the
1201     action routines.  */
1202  YYSTYPE yyval;
1203
1204
1205  /* The number of symbols on the RHS of the reduced rule.
1206     Keep to zero when no symbol should be popped.  */
1207  int yylen = 0;
1208
1209  YYDPRINTF ((stderr, "Starting parse\n"));
1210
1211  yystate = 0;
1212  yyerrstatus = 0;
1213  yynerrs = 0;
1214  yychar = YYEMPTY;		/* Cause a token to be read.  */
1215
1216  /* Initialize stack pointers.
1217     Waste one element of value and location stack
1218     so that they stay on the same level as the state stack.
1219     The wasted elements are never initialized.  */
1220
1221  yyssp = yyss;
1222  yyvsp = yyvs;
1223
1224  goto yysetstate;
1225
1226/*------------------------------------------------------------.
1227| yynewstate -- Push a new state, which is found in yystate.  |
1228`------------------------------------------------------------*/
1229 yynewstate:
1230  /* In all cases, when you get here, the value and location stacks
1231     have just been pushed.  So pushing a state here evens the stacks.  */
1232  yyssp++;
1233
1234 yysetstate:
1235  *yyssp = yystate;
1236
1237  if (yyss + yystacksize - 1 <= yyssp)
1238    {
1239      /* Get the current used size of the three stacks, in elements.  */
1240      YYSIZE_T yysize = yyssp - yyss + 1;
1241
1242#ifdef yyoverflow
1243      {
1244	/* Give user a chance to reallocate the stack.  Use copies of
1245	   these so that the &'s don't force the real ones into
1246	   memory.  */
1247	YYSTYPE *yyvs1 = yyvs;
1248	yytype_int16 *yyss1 = yyss;
1249
1250
1251	/* Each stack pointer address is followed by the size of the
1252	   data in use in that stack, in bytes.  This used to be a
1253	   conditional around just the two extra args, but that might
1254	   be undefined if yyoverflow is a macro.  */
1255	yyoverflow (YY_("memory exhausted"),
1256		    &yyss1, yysize * sizeof (*yyssp),
1257		    &yyvs1, yysize * sizeof (*yyvsp),
1258
1259		    &yystacksize);
1260
1261	yyss = yyss1;
1262	yyvs = yyvs1;
1263      }
1264#else /* no yyoverflow */
1265# ifndef YYSTACK_RELOCATE
1266      goto yyexhaustedlab;
1267# else
1268      /* Extend the stack our own way.  */
1269      if (YYMAXDEPTH <= yystacksize)
1270	goto yyexhaustedlab;
1271      yystacksize *= 2;
1272      if (YYMAXDEPTH < yystacksize)
1273	yystacksize = YYMAXDEPTH;
1274
1275      {
1276	yytype_int16 *yyss1 = yyss;
1277	union yyalloc *yyptr =
1278	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1279	if (! yyptr)
1280	  goto yyexhaustedlab;
1281	YYSTACK_RELOCATE (yyss);
1282	YYSTACK_RELOCATE (yyvs);
1283
1284#  undef YYSTACK_RELOCATE
1285	if (yyss1 != yyssa)
1286	  YYSTACK_FREE (yyss1);
1287      }
1288# endif
1289#endif /* no yyoverflow */
1290
1291      yyssp = yyss + yysize - 1;
1292      yyvsp = yyvs + yysize - 1;
1293
1294
1295      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1296		  (unsigned long int) yystacksize));
1297
1298      if (yyss + yystacksize - 1 <= yyssp)
1299	YYABORT;
1300    }
1301
1302  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1303
1304  goto yybackup;
1305
1306/*-----------.
1307| yybackup.  |
1308`-----------*/
1309yybackup:
1310
1311  /* Do appropriate processing given the current state.  Read a
1312     look-ahead token if we need one and don't already have one.  */
1313
1314  /* First try to decide what to do without reference to look-ahead token.  */
1315  yyn = yypact[yystate];
1316  if (yyn == YYPACT_NINF)
1317    goto yydefault;
1318
1319  /* Not known => get a look-ahead token if don't already have one.  */
1320
1321  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1322  if (yychar == YYEMPTY)
1323    {
1324      YYDPRINTF ((stderr, "Reading a token: "));
1325      yychar = YYLEX;
1326    }
1327
1328  if (yychar <= YYEOF)
1329    {
1330      yychar = yytoken = YYEOF;
1331      YYDPRINTF ((stderr, "Now at end of input.\n"));
1332    }
1333  else
1334    {
1335      yytoken = YYTRANSLATE (yychar);
1336      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1337    }
1338
1339  /* If the proper action on seeing token YYTOKEN is to reduce or to
1340     detect an error, take that action.  */
1341  yyn += yytoken;
1342  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1343    goto yydefault;
1344  yyn = yytable[yyn];
1345  if (yyn <= 0)
1346    {
1347      if (yyn == 0 || yyn == YYTABLE_NINF)
1348	goto yyerrlab;
1349      yyn = -yyn;
1350      goto yyreduce;
1351    }
1352
1353  if (yyn == YYFINAL)
1354    YYACCEPT;
1355
1356  /* Count tokens shifted since error; after three, turn off error
1357     status.  */
1358  if (yyerrstatus)
1359    yyerrstatus--;
1360
1361  /* Shift the look-ahead token.  */
1362  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1363
1364  /* Discard the shifted token unless it is eof.  */
1365  if (yychar != YYEOF)
1366    yychar = YYEMPTY;
1367
1368  yystate = yyn;
1369  *++yyvsp = yylval;
1370
1371  goto yynewstate;
1372
1373
1374/*-----------------------------------------------------------.
1375| yydefault -- do the default action for the current state.  |
1376`-----------------------------------------------------------*/
1377yydefault:
1378  yyn = yydefact[yystate];
1379  if (yyn == 0)
1380    goto yyerrlab;
1381  goto yyreduce;
1382
1383
1384/*-----------------------------.
1385| yyreduce -- Do a reduction.  |
1386`-----------------------------*/
1387yyreduce:
1388  /* yyn is the number of a rule to reduce with.  */
1389  yylen = yyr2[yyn];
1390
1391  /* If YYLEN is nonzero, implement the default value of the action:
1392     `$$ = $1'.
1393
1394     Otherwise, the following line sets YYVAL to garbage.
1395     This behavior is undocumented and Bison
1396     users should not rely upon it.  Assigning to YYVAL
1397     unconditionally makes the parser a bit smaller, and it avoids a
1398     GCC warning that YYVAL may be used uninitialized.  */
1399  yyval = yyvsp[1-yylen];
1400
1401
1402  YY_REDUCE_PRINT (yyn);
1403  switch (yyn)
1404    {
1405        case 2:
1406#line 87 "cfgparse.y"
1407    { InterpretConfigs((yyvsp[(1) - (1)].entry)); }
1408    break;
1409
1410  case 3:
1411#line 91 "cfgparse.y"
1412    {
1413			    CfgEntryPtr tmp;
1414			    if ((yyvsp[(1) - (2)].entry)!=NULL) {
1415				for (tmp=(yyvsp[(1) - (2)].entry);tmp->next!=NULL;tmp=tmp->next) {
1416				    /* conditional does the work */
1417				}
1418				tmp->next= (yyvsp[(2) - (2)].entry);
1419				(yyval.entry)= (yyvsp[(1) - (2)].entry);
1420			    }
1421			    else (yyval.entry)= (yyvsp[(2) - (2)].entry);
1422			}
1423    break;
1424
1425  case 4:
1426#line 102 "cfgparse.y"
1427    { (yyval.entry)= (yyvsp[(1) - (1)].entry); }
1428    break;
1429
1430  case 5:
1431#line 106 "cfgparse.y"
1432    {
1433			    if (((yyvsp[(1) - (2)].entry))&&((yyvsp[(2) - (2)].act)))
1434				(yyvsp[(1) - (2)].entry)->action= *((yyvsp[(2) - (2)].act));
1435			    if ((yyvsp[(2) - (2)].act))
1436				free((yyvsp[(2) - (2)].act));
1437			    (yyval.entry)= (yyvsp[(1) - (2)].entry);
1438			}
1439    break;
1440
1441  case 6:
1442#line 113 "cfgparse.y"
1443    { (yyval.entry)= (yyvsp[(1) - (1)].entry); }
1444    break;
1445
1446  case 7:
1447#line 117 "cfgparse.y"
1448    {
1449			    CfgEntryPtr cfg;
1450			    cfg= calloc(1,sizeof(CfgEntryRec));
1451			    if (cfg) {
1452				cfg->entry_type= VariableDef;
1453				cfg->event_type= 0;
1454				cfg->name.str= (yyvsp[(1) - (3)].str);
1455				cfg->action.type= UnknownAction;
1456				cfg->action.text= (yyvsp[(3) - (3)].str);
1457				cfg->action.priv= 0;
1458				cfg->next= NULL;
1459			    }
1460			    (yyval.entry)= cfg;
1461			}
1462    break;
1463
1464  case 8:
1465#line 134 "cfgparse.y"
1466    {
1467			    CfgEntryPtr cfg;
1468			    cfg= calloc(1,sizeof(CfgEntryRec));
1469			    if (cfg) {
1470				cfg->entry_type= EventDef;
1471				cfg->event_type= (yyvsp[(1) - (4)].ival);
1472				cfg->name.str= (yyvsp[(3) - (4)].str);
1473				cfg->action.type= UnknownAction;
1474				cfg->action.text= NULL;
1475				cfg->action.priv= 0;
1476				cfg->next= NULL;
1477			    }
1478			    (yyval.entry)= cfg;
1479			}
1480    break;
1481
1482  case 9:
1483#line 150 "cfgparse.y"
1484    { (yyval.ival)= XkbBellNotify; }
1485    break;
1486
1487  case 10:
1488#line 151 "cfgparse.y"
1489    { (yyval.ival)= XkbAccessXNotify; }
1490    break;
1491
1492  case 11:
1493#line 152 "cfgparse.y"
1494    { (yyval.ival)= XkbActionMessage; }
1495    break;
1496
1497  case 12:
1498#line 156 "cfgparse.y"
1499    {
1500			    ActDefPtr act;
1501			    act= calloc(1,sizeof(ActDefRec));
1502			    if (act) {
1503				act->type= (yyvsp[(1) - (2)].ival);
1504				act->text= (yyvsp[(2) - (2)].str);
1505			    }
1506			    (yyval.act)= act;
1507			}
1508    break;
1509
1510  case 13:
1511#line 167 "cfgparse.y"
1512    { (yyval.ival) = NoAction; }
1513    break;
1514
1515  case 14:
1516#line 168 "cfgparse.y"
1517    { (yyval.ival) = NoAction; }
1518    break;
1519
1520  case 15:
1521#line 169 "cfgparse.y"
1522    { (yyval.ival) = EchoAction; }
1523    break;
1524
1525  case 16:
1526#line 170 "cfgparse.y"
1527    { (yyval.ival) = PrintEvAction; }
1528    break;
1529
1530  case 17:
1531#line 171 "cfgparse.y"
1532    { (yyval.ival) = ShellAction; }
1533    break;
1534
1535  case 18:
1536#line 172 "cfgparse.y"
1537    { (yyval.ival) = SoundAction; }
1538    break;
1539
1540  case 19:
1541#line 173 "cfgparse.y"
1542    { (yyval.ival) = UnknownAction; }
1543    break;
1544
1545  case 20:
1546#line 176 "cfgparse.y"
1547    { (yyval.str)= (yyvsp[(1) - (1)].str); }
1548    break;
1549
1550  case 21:
1551#line 177 "cfgparse.y"
1552    { (yyval.str)= NULL; }
1553    break;
1554
1555  case 22:
1556#line 180 "cfgparse.y"
1557    { (yyval.str)= (yyvsp[(1) - (1)].str); }
1558    break;
1559
1560  case 23:
1561#line 181 "cfgparse.y"
1562    { (yyval.str)= (yyvsp[(1) - (1)].str); }
1563    break;
1564
1565  case 24:
1566#line 184 "cfgparse.y"
1567    { (yyval.str)= scanStr; scanStr= NULL; }
1568    break;
1569
1570  case 25:
1571#line 187 "cfgparse.y"
1572    { (yyval.str)= (yyvsp[(1) - (1)].str); }
1573    break;
1574
1575  case 26:
1576#line 188 "cfgparse.y"
1577    { (yyval.str)= NULL; }
1578    break;
1579
1580  case 27:
1581#line 191 "cfgparse.y"
1582    { (yyval.str)= scanStr; scanStr= NULL; }
1583    break;
1584
1585
1586/* Line 1267 of yacc.c.  */
1587#line 1588 "cfgparse.c"
1588      default: break;
1589    }
1590  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1591
1592  YYPOPSTACK (yylen);
1593  yylen = 0;
1594  YY_STACK_PRINT (yyss, yyssp);
1595
1596  *++yyvsp = yyval;
1597
1598
1599  /* Now `shift' the result of the reduction.  Determine what state
1600     that goes to, based on the state we popped back to and the rule
1601     number reduced by.  */
1602
1603  yyn = yyr1[yyn];
1604
1605  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1606  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1607    yystate = yytable[yystate];
1608  else
1609    yystate = yydefgoto[yyn - YYNTOKENS];
1610
1611  goto yynewstate;
1612
1613
1614/*------------------------------------.
1615| yyerrlab -- here on detecting error |
1616`------------------------------------*/
1617yyerrlab:
1618  /* If not already recovering from an error, report this error.  */
1619  if (!yyerrstatus)
1620    {
1621      ++yynerrs;
1622#if ! YYERROR_VERBOSE
1623      yyerror (YY_("syntax error"));
1624#else
1625      {
1626	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1627	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1628	  {
1629	    YYSIZE_T yyalloc = 2 * yysize;
1630	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1631	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
1632	    if (yymsg != yymsgbuf)
1633	      YYSTACK_FREE (yymsg);
1634	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1635	    if (yymsg)
1636	      yymsg_alloc = yyalloc;
1637	    else
1638	      {
1639		yymsg = yymsgbuf;
1640		yymsg_alloc = sizeof yymsgbuf;
1641	      }
1642	  }
1643
1644	if (0 < yysize && yysize <= yymsg_alloc)
1645	  {
1646	    (void) yysyntax_error (yymsg, yystate, yychar);
1647	    yyerror (yymsg);
1648	  }
1649	else
1650	  {
1651	    yyerror (YY_("syntax error"));
1652	    if (yysize != 0)
1653	      goto yyexhaustedlab;
1654	  }
1655      }
1656#endif
1657    }
1658
1659
1660
1661  if (yyerrstatus == 3)
1662    {
1663      /* If just tried and failed to reuse look-ahead token after an
1664	 error, discard it.  */
1665
1666      if (yychar <= YYEOF)
1667	{
1668	  /* Return failure if at end of input.  */
1669	  if (yychar == YYEOF)
1670	    YYABORT;
1671	}
1672      else
1673	{
1674	  yydestruct ("Error: discarding",
1675		      yytoken, &yylval);
1676	  yychar = YYEMPTY;
1677	}
1678    }
1679
1680  /* Else will try to reuse look-ahead token after shifting the error
1681     token.  */
1682  goto yyerrlab1;
1683
1684
1685/*---------------------------------------------------.
1686| yyerrorlab -- error raised explicitly by YYERROR.  |
1687`---------------------------------------------------*/
1688yyerrorlab:
1689
1690  /* Pacify compilers like GCC when the user code never invokes
1691     YYERROR and the label yyerrorlab therefore never appears in user
1692     code.  */
1693  if (/*CONSTCOND*/ 0)
1694     goto yyerrorlab;
1695
1696  /* Do not reclaim the symbols of the rule which action triggered
1697     this YYERROR.  */
1698  YYPOPSTACK (yylen);
1699  yylen = 0;
1700  YY_STACK_PRINT (yyss, yyssp);
1701  yystate = *yyssp;
1702  goto yyerrlab1;
1703
1704
1705/*-------------------------------------------------------------.
1706| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1707`-------------------------------------------------------------*/
1708yyerrlab1:
1709  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
1710
1711  for (;;)
1712    {
1713      yyn = yypact[yystate];
1714      if (yyn != YYPACT_NINF)
1715	{
1716	  yyn += YYTERROR;
1717	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1718	    {
1719	      yyn = yytable[yyn];
1720	      if (0 < yyn)
1721		break;
1722	    }
1723	}
1724
1725      /* Pop the current state because it cannot handle the error token.  */
1726      if (yyssp == yyss)
1727	YYABORT;
1728
1729
1730      yydestruct ("Error: popping",
1731		  yystos[yystate], yyvsp);
1732      YYPOPSTACK (1);
1733      yystate = *yyssp;
1734      YY_STACK_PRINT (yyss, yyssp);
1735    }
1736
1737  if (yyn == YYFINAL)
1738    YYACCEPT;
1739
1740  *++yyvsp = yylval;
1741
1742
1743  /* Shift the error token.  */
1744  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1745
1746  yystate = yyn;
1747  goto yynewstate;
1748
1749
1750/*-------------------------------------.
1751| yyacceptlab -- YYACCEPT comes here.  |
1752`-------------------------------------*/
1753yyacceptlab:
1754  yyresult = 0;
1755  goto yyreturn;
1756
1757/*-----------------------------------.
1758| yyabortlab -- YYABORT comes here.  |
1759`-----------------------------------*/
1760yyabortlab:
1761  yyresult = 1;
1762  goto yyreturn;
1763
1764#ifndef yyoverflow
1765/*-------------------------------------------------.
1766| yyexhaustedlab -- memory exhaustion comes here.  |
1767`-------------------------------------------------*/
1768yyexhaustedlab:
1769  yyerror (YY_("memory exhausted"));
1770  yyresult = 2;
1771  /* Fall through.  */
1772#endif
1773
1774yyreturn:
1775  if (yychar != YYEOF && yychar != YYEMPTY)
1776     yydestruct ("Cleanup: discarding lookahead",
1777		 yytoken, &yylval);
1778  /* Do not reclaim the symbols of the rule which action triggered
1779     this YYABORT or YYACCEPT.  */
1780  YYPOPSTACK (yylen);
1781  YY_STACK_PRINT (yyss, yyssp);
1782  while (yyssp != yyss)
1783    {
1784      yydestruct ("Cleanup: popping",
1785		  yystos[*yyssp], yyvsp);
1786      YYPOPSTACK (1);
1787    }
1788#ifndef yyoverflow
1789  if (yyss != yyssa)
1790    YYSTACK_FREE (yyss);
1791#endif
1792#if YYERROR_VERBOSE
1793  if (yymsg != yymsgbuf)
1794    YYSTACK_FREE (yymsg);
1795#endif
1796  /* Make sure YYID is used.  */
1797  return YYID (yyresult);
1798}
1799
1800
1801#line 193 "cfgparse.y"
1802
1803int
1804yyerror(char *s)
1805{
1806    (void)fprintf(stderr,"%s: line %d of %s\n",s,lineNum,
1807					(scanFile?scanFile:"(unknown)"));
1808    if (scanStr)
1809	(void)fprintf(stderr,"last scanned symbol is: %s\n",scanStr);
1810    return 1;
1811}
1812
1813
1814int
1815yywrap(void)
1816{
1817   return 1;
1818}
1819
1820int
1821CFGParseFile(FILE *file)
1822{
1823    if (file) {
1824	yyin= file;
1825	if (yyparse()==0) {
1826	    return 1;
1827	}
1828	return 0;
1829    }
1830    return 1;
1831}
1832
1833