Changed selection boolean operator precedence.
[gromacs/rigid-bodies.git] / src / gmxlib / selection / parser.c
blob948bd084c9ed24336f138a9e014bd0199ad32f08
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
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.
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.
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. */
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.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
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. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 1
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse _gmx_sel_yybparse
63 #define yylex _gmx_sel_yyblex
64 #define yyerror _gmx_sel_yyberror
65 #define yylval _gmx_sel_yyblval
66 #define yychar _gmx_sel_yybchar
67 #define yydebug _gmx_sel_yybdebug
68 #define yynerrs _gmx_sel_yybnerrs
71 /* Tokens. */
72 #ifndef YYTOKENTYPE
73 # define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 INVALID = 258,
78 HELP = 259,
79 HELP_TOPIC = 260,
80 TOK_INT = 261,
81 TOK_REAL = 262,
82 STR = 263,
83 IDENTIFIER = 264,
84 CMD_SEP = 265,
85 GROUP = 266,
86 TO = 267,
87 VARIABLE_NUMERIC = 268,
88 VARIABLE_GROUP = 269,
89 VARIABLE_POS = 270,
90 KEYWORD_NUMERIC = 271,
91 KEYWORD_STR = 272,
92 KEYWORD_POS = 273,
93 KEYWORD_GROUP = 274,
94 METHOD_NUMERIC = 275,
95 METHOD_GROUP = 276,
96 METHOD_POS = 277,
97 MODIFIER = 278,
98 EMPTY_POSMOD = 279,
99 PARAM = 280,
100 END_OF_METHOD = 281,
101 OF = 282,
102 CMP_OP = 283,
103 PARAM_REDUCT = 284,
104 XOR = 285,
105 OR = 286,
106 AND = 287,
107 NOT = 288,
108 UNARY_NEG = 289
110 #endif
111 /* Tokens. */
112 #define INVALID 258
113 #define HELP 259
114 #define HELP_TOPIC 260
115 #define TOK_INT 261
116 #define TOK_REAL 262
117 #define STR 263
118 #define IDENTIFIER 264
119 #define CMD_SEP 265
120 #define GROUP 266
121 #define TO 267
122 #define VARIABLE_NUMERIC 268
123 #define VARIABLE_GROUP 269
124 #define VARIABLE_POS 270
125 #define KEYWORD_NUMERIC 271
126 #define KEYWORD_STR 272
127 #define KEYWORD_POS 273
128 #define KEYWORD_GROUP 274
129 #define METHOD_NUMERIC 275
130 #define METHOD_GROUP 276
131 #define METHOD_POS 277
132 #define MODIFIER 278
133 #define EMPTY_POSMOD 279
134 #define PARAM 280
135 #define END_OF_METHOD 281
136 #define OF 282
137 #define CMP_OP 283
138 #define PARAM_REDUCT 284
139 #define XOR 285
140 #define OR 286
141 #define AND 287
142 #define NOT 288
143 #define UNARY_NEG 289
148 /* Copy the first part of user declarations. */
149 #line 34 "parser.y"
151 /*! \internal \file parser.c
152 * \brief Generated (from parser.y by Bison) parser for the selection language.
154 /*! \internal \file parser.h
155 * \brief Generated (from parser.y by Bison) parser include file.
157 #ifdef HAVE_CONFIG_H
158 #include <config.h>
159 #endif
162 #include <string2.h>
164 #include "parsetree.h"
165 #include "selelem.h"
167 #include "scanner.h"
169 static t_selexpr_value *
170 process_value_list(t_selexpr_value *values, int *nr);
171 static t_selexpr_param *
172 process_param_list(t_selexpr_param *params);
174 static void
175 yyerror(yyscan_t, char const *s);
178 /* Enabling traces. */
179 #ifndef YYDEBUG
180 # define YYDEBUG 1
181 #endif
183 /* Enabling verbose error messages. */
184 #ifdef YYERROR_VERBOSE
185 # undef YYERROR_VERBOSE
186 # define YYERROR_VERBOSE 1
187 #else
188 # define YYERROR_VERBOSE 0
189 #endif
191 /* Enabling the token table. */
192 #ifndef YYTOKEN_TABLE
193 # define YYTOKEN_TABLE 0
194 #endif
196 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
197 typedef union YYSTYPE
198 #line 62 "parser.y"
200 int i;
201 real r;
202 char *str;
203 struct gmx_ana_selmethod_t *meth;
205 struct t_selelem *sel;
207 struct t_selexpr_value *val;
208 struct t_selexpr_param *param;
210 /* Line 187 of yacc.c. */
211 #line 212 "parser.c"
212 YYSTYPE;
213 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
214 # define YYSTYPE_IS_DECLARED 1
215 # define YYSTYPE_IS_TRIVIAL 1
216 #endif
220 /* Copy the second part of user declarations. */
223 /* Line 216 of yacc.c. */
224 #line 225 "parser.c"
226 #ifdef short
227 # undef short
228 #endif
230 #ifdef YYTYPE_UINT8
231 typedef YYTYPE_UINT8 yytype_uint8;
232 #else
233 typedef unsigned char yytype_uint8;
234 #endif
236 #ifdef YYTYPE_INT8
237 typedef YYTYPE_INT8 yytype_int8;
238 #elif (defined __STDC__ || defined __C99__FUNC__ \
239 || defined __cplusplus || defined _MSC_VER)
240 typedef signed char yytype_int8;
241 #else
242 typedef short int yytype_int8;
243 #endif
245 #ifdef YYTYPE_UINT16
246 typedef YYTYPE_UINT16 yytype_uint16;
247 #else
248 typedef unsigned short int yytype_uint16;
249 #endif
251 #ifdef YYTYPE_INT16
252 typedef YYTYPE_INT16 yytype_int16;
253 #else
254 typedef short int yytype_int16;
255 #endif
257 #ifndef YYSIZE_T
258 # ifdef __SIZE_TYPE__
259 # define YYSIZE_T __SIZE_TYPE__
260 # elif defined size_t
261 # define YYSIZE_T size_t
262 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
263 || defined __cplusplus || defined _MSC_VER)
264 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
265 # define YYSIZE_T size_t
266 # else
267 # define YYSIZE_T unsigned int
268 # endif
269 #endif
271 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
273 #ifndef YY_
274 # if YYENABLE_NLS
275 # if ENABLE_NLS
276 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
277 # define YY_(msgid) dgettext ("bison-runtime", msgid)
278 # endif
279 # endif
280 # ifndef YY_
281 # define YY_(msgid) msgid
282 # endif
283 #endif
285 /* Suppress unused-variable warnings by "using" E. */
286 #if ! defined lint || defined __GNUC__
287 # define YYUSE(e) ((void) (e))
288 #else
289 # define YYUSE(e) /* empty */
290 #endif
292 /* Identity function, used to suppress warnings about constant conditions. */
293 #ifndef lint
294 # define YYID(n) (n)
295 #else
296 #if (defined __STDC__ || defined __C99__FUNC__ \
297 || defined __cplusplus || defined _MSC_VER)
298 static int
299 YYID (int i)
300 #else
301 static int
302 YYID (i)
303 int i;
304 #endif
306 return i;
308 #endif
310 #if ! defined yyoverflow || YYERROR_VERBOSE
312 /* The parser invokes alloca or malloc; define the necessary symbols. */
314 # ifdef YYSTACK_USE_ALLOCA
315 # if YYSTACK_USE_ALLOCA
316 # ifdef __GNUC__
317 # define YYSTACK_ALLOC __builtin_alloca
318 # elif defined __BUILTIN_VA_ARG_INCR
319 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
320 # elif defined _AIX
321 # define YYSTACK_ALLOC __alloca
322 # elif defined _MSC_VER
323 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
324 # define alloca _alloca
325 # else
326 # define YYSTACK_ALLOC alloca
327 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
328 || defined __cplusplus || defined _MSC_VER)
329 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
330 # ifndef _STDLIB_H
331 # define _STDLIB_H 1
332 # endif
333 # endif
334 # endif
335 # endif
336 # endif
338 # ifdef YYSTACK_ALLOC
339 /* Pacify GCC's `empty if-body' warning. */
340 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
341 # ifndef YYSTACK_ALLOC_MAXIMUM
342 /* The OS might guarantee only one guard page at the bottom of the stack,
343 and a page size can be as small as 4096 bytes. So we cannot safely
344 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
345 to allow for a few compiler-allocated temporary stack slots. */
346 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
347 # endif
348 # else
349 # define YYSTACK_ALLOC YYMALLOC
350 # define YYSTACK_FREE YYFREE
351 # ifndef YYSTACK_ALLOC_MAXIMUM
352 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
353 # endif
354 # if (defined __cplusplus && ! defined _STDLIB_H \
355 && ! ((defined YYMALLOC || defined malloc) \
356 && (defined YYFREE || defined free)))
357 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
358 # ifndef _STDLIB_H
359 # define _STDLIB_H 1
360 # endif
361 # endif
362 # ifndef YYMALLOC
363 # define YYMALLOC malloc
364 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
365 || defined __cplusplus || defined _MSC_VER)
366 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
367 # endif
368 # endif
369 # ifndef YYFREE
370 # define YYFREE free
371 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
372 || defined __cplusplus || defined _MSC_VER)
373 void free (void *); /* INFRINGES ON USER NAME SPACE */
374 # endif
375 # endif
376 # endif
377 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
380 #if (! defined yyoverflow \
381 && (! defined __cplusplus \
382 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
384 /* A type that is properly aligned for any stack member. */
385 union yyalloc
387 yytype_int16 yyss;
388 YYSTYPE yyvs;
391 /* The size of the maximum gap between one aligned stack and the next. */
392 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
394 /* The size of an array large to enough to hold all stacks, each with
395 N elements. */
396 # define YYSTACK_BYTES(N) \
397 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
398 + YYSTACK_GAP_MAXIMUM)
400 /* Copy COUNT objects from FROM to TO. The source and destination do
401 not overlap. */
402 # ifndef YYCOPY
403 # if defined __GNUC__ && 1 < __GNUC__
404 # define YYCOPY(To, From, Count) \
405 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
406 # else
407 # define YYCOPY(To, From, Count) \
408 do \
410 YYSIZE_T yyi; \
411 for (yyi = 0; yyi < (Count); yyi++) \
412 (To)[yyi] = (From)[yyi]; \
414 while (YYID (0))
415 # endif
416 # endif
418 /* Relocate STACK from its old location to the new one. The
419 local variables YYSIZE and YYSTACKSIZE give the old and new number of
420 elements in the stack, and YYPTR gives the new location of the
421 stack. Advance YYPTR to a properly aligned location for the next
422 stack. */
423 # define YYSTACK_RELOCATE(Stack) \
424 do \
426 YYSIZE_T yynewbytes; \
427 YYCOPY (&yyptr->Stack, Stack, yysize); \
428 Stack = &yyptr->Stack; \
429 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
430 yyptr += yynewbytes / sizeof (*yyptr); \
432 while (YYID (0))
434 #endif
436 /* YYFINAL -- State number of the termination state. */
437 #define YYFINAL 2
438 /* YYLAST -- Last index in YYTABLE. */
439 #define YYLAST 329
441 /* YYNTOKENS -- Number of terminals. */
442 #define YYNTOKENS 44
443 /* YYNNTS -- Number of nonterminals. */
444 #define YYNNTS 20
445 /* YYNRULES -- Number of rules. */
446 #define YYNRULES 76
447 /* YYNRULES -- Number of states. */
448 #define YYNSTATES 125
450 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
451 #define YYUNDEFTOK 2
452 #define YYMAXUTOK 289
454 #define YYTRANSLATE(YYX) \
455 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
457 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
458 static const yytype_uint8 yytranslate[] =
460 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 41, 42, 36, 34, 43, 35, 2, 37, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 40, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 39, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
486 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
487 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
488 25, 26, 27, 28, 29, 30, 31, 32, 33, 38
491 #if YYDEBUG
492 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
493 YYRHS. */
494 static const yytype_uint8 yyprhs[] =
496 0, 0, 3, 4, 7, 10, 13, 14, 16, 18,
497 20, 22, 25, 29, 33, 37, 39, 41, 44, 47,
498 49, 51, 55, 59, 61, 63, 65, 67, 70, 74,
499 78, 82, 86, 89, 92, 94, 96, 99, 103, 107,
500 111, 113, 115, 118, 122, 126, 130, 134, 138, 141,
501 145, 149, 151, 154, 162, 166, 169, 173, 175, 177,
502 179, 181, 184, 185, 188, 191, 192, 194, 196, 199,
503 203, 205, 207, 209, 211, 215, 219
506 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
507 static const yytype_int8 yyrhs[] =
509 45, 0, -1, -1, 45, 46, -1, 47, 10, -1,
510 1, 10, -1, -1, 48, -1, 6, -1, 52, -1,
511 50, -1, 52, 50, -1, 9, 40, 53, -1, 9,
512 40, 55, -1, 9, 40, 57, -1, 4, -1, 49,
513 -1, 4, 5, -1, 49, 5, -1, 57, -1, 53,
514 -1, 41, 50, 42, -1, 50, 23, 58, -1, 6,
515 -1, 7, -1, 8, -1, 9, -1, 33, 53, -1,
516 53, 32, 53, -1, 53, 31, 53, -1, 41, 53,
517 42, -1, 55, 28, 55, -1, 11, 52, -1, 11,
518 6, -1, 24, -1, 18, -1, 54, 19, -1, 54,
519 17, 62, -1, 54, 16, 62, -1, 54, 21, 58,
520 -1, 6, -1, 7, -1, 54, 16, -1, 54, 20,
521 58, -1, 55, 34, 55, -1, 55, 35, 55, -1,
522 55, 36, 55, -1, 55, 37, 55, -1, 35, 55,
523 -1, 55, 39, 55, -1, 41, 55, 42, -1, 52,
524 -1, 54, 17, -1, 41, 51, 43, 51, 43, 51,
525 42, -1, 41, 57, 42, -1, 22, 58, -1, 18,
526 27, 53, -1, 14, -1, 13, -1, 15, -1, 59,
527 -1, 59, 26, -1, -1, 59, 60, -1, 25, 61,
528 -1, -1, 62, -1, 63, -1, 62, 63, -1, 62,
529 43, 63, -1, 53, -1, 57, -1, 55, -1, 56,
530 -1, 6, 12, 6, -1, 6, 12, 7, -1, 7,
531 12, 51, -1
534 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
535 static const yytype_uint16 yyrline[] =
537 0, 173, 173, 174, 183, 184, 204, 208, 209, 218,
538 228, 230, 232, 234, 236, 242, 243, 246, 247, 251,
539 252, 257, 258, 269, 270, 273, 274, 282, 288, 294,
540 306, 310, 318, 324, 332, 333, 337, 342, 347, 355,
541 367, 374, 384, 389, 397, 399, 401, 403, 405, 407,
542 409, 416, 423, 435, 440, 444, 452, 463, 467, 471,
543 480, 482, 487, 488, 493, 500, 501, 505, 506, 508,
544 512, 514, 516, 518, 520, 525, 530
546 #endif
548 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
549 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
550 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
551 static const char *const yytname[] =
553 "$end", "error", "$undefined", "INVALID", "HELP", "HELP_TOPIC",
554 "TOK_INT", "TOK_REAL", "STR", "IDENTIFIER", "CMD_SEP", "GROUP", "TO",
555 "VARIABLE_NUMERIC", "VARIABLE_GROUP", "VARIABLE_POS", "KEYWORD_NUMERIC",
556 "KEYWORD_STR", "KEYWORD_POS", "KEYWORD_GROUP", "METHOD_NUMERIC",
557 "METHOD_GROUP", "METHOD_POS", "MODIFIER", "EMPTY_POSMOD", "PARAM",
558 "END_OF_METHOD", "OF", "CMP_OP", "PARAM_REDUCT", "XOR", "OR", "AND",
559 "NOT", "'+'", "'-'", "'*'", "'/'", "UNARY_NEG", "'^'", "'='", "'('",
560 "')'", "','", "$accept", "commands", "command", "cmd_plain",
561 "help_request", "help_topic", "selection", "number", "string",
562 "sel_expr", "pos_mod", "num_expr", "str_expr", "pos_expr",
563 "method_params", "method_param_list", "method_param", "value_list",
564 "value_list_nonempty", "value_item", 0
566 #endif
568 # ifdef YYPRINT
569 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
570 token YYLEX-NUM. */
571 static const yytype_uint16 yytoknum[] =
573 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
574 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
575 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
576 285, 286, 287, 288, 43, 45, 42, 47, 289, 94,
577 61, 40, 41, 44
579 # endif
581 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
582 static const yytype_uint8 yyr1[] =
584 0, 44, 45, 45, 46, 46, 47, 47, 47, 47,
585 47, 47, 47, 47, 47, 48, 48, 49, 49, 50,
586 50, 50, 50, 51, 51, 52, 52, 53, 53, 53,
587 53, 53, 53, 53, 54, 54, 53, 53, 53, 53,
588 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
589 55, 56, 56, 57, 57, 57, 57, 53, 55, 57,
590 58, 58, 59, 59, 60, 61, 61, 62, 62, 62,
591 63, 63, 63, 63, 63, 63, 63
594 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
595 static const yytype_uint8 yyr2[] =
597 0, 2, 0, 2, 2, 2, 0, 1, 1, 1,
598 1, 2, 3, 3, 3, 1, 1, 2, 2, 1,
599 1, 3, 3, 1, 1, 1, 1, 2, 3, 3,
600 3, 3, 2, 2, 1, 1, 2, 3, 3, 3,
601 1, 1, 2, 3, 3, 3, 3, 3, 2, 3,
602 3, 1, 2, 7, 3, 2, 3, 1, 1, 1,
603 1, 2, 0, 2, 2, 0, 1, 1, 2, 3,
604 1, 1, 1, 1, 3, 3, 3
607 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
608 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
609 means the default is an error. */
610 static const yytype_uint8 yydefact[] =
612 2, 0, 1, 0, 15, 40, 41, 25, 26, 0,
613 58, 57, 59, 35, 62, 34, 0, 0, 0, 3,
614 0, 7, 16, 10, 9, 20, 0, 0, 19, 5,
615 17, 0, 33, 26, 32, 0, 55, 60, 40, 35,
616 0, 27, 0, 0, 48, 40, 41, 0, 0, 20,
617 0, 19, 4, 18, 62, 11, 0, 0, 42, 0,
618 36, 62, 62, 0, 0, 0, 0, 0, 0, 0,
619 12, 13, 14, 56, 65, 61, 63, 0, 0, 42,
620 21, 0, 30, 50, 54, 22, 29, 28, 40, 41,
621 51, 70, 0, 72, 73, 71, 38, 67, 37, 43,
622 39, 31, 44, 45, 46, 47, 49, 0, 64, 66,
623 23, 24, 0, 0, 0, 52, 0, 68, 0, 74,
624 75, 76, 69, 0, 53
627 /* YYDEFGOTO[NTERM-NUM]. */
628 static const yytype_int8 yydefgoto[] =
630 -1, 1, 19, 20, 21, 22, 23, 48, 90, 91,
631 26, 93, 94, 95, 36, 37, 76, 108, 98, 97
634 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
635 STATE-NUM. */
636 #define YYPACT_NINF -87
637 static const yytype_int16 yypact[] =
639 -87, 124, -87, -1, 6, 8, -87, -87, 12, 56,
640 -87, -87, -87, 17, -87, -87, 278, 288, 200, -87,
641 53, -87, 75, 66, 225, 0, 133, 84, -87, -87,
642 -87, 239, -87, -87, -87, 278, -87, 57, -87, -87,
643 278, -87, 288, -14, 55, 54, 58, -16, 63, -18,
644 68, 69, -87, -87, -87, 66, 278, 278, 186, 186,
645 -87, -87, -87, 288, 288, 288, 288, 288, 288, 264,
646 0, 84, -87, 0, 186, -87, -87, -18, 51, -87,
647 -87, 102, -87, -87, -87, -87, 83, -87, 110, 114,
648 -87, 0, 164, 19, -87, -87, 155, -87, 155, -87,
649 -87, 19, 38, 38, 55, 55, 55, 69, -87, 155,
650 -87, -87, 93, 107, 102, 186, 186, -87, 102, -87,
651 -87, -87, -87, 85, -87
654 /* YYPGOTO[NTERM-NUM]. */
655 static const yytype_int8 yypgoto[] =
657 -87, -87, -87, -87, -87, -87, 15, -78, 28, 60,
658 -17, 3, -87, 4, -46, -87, -87, -87, -57, -86
661 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
662 positive, shift that token. If negative, reduce the rule which
663 number is the opposite. If zero, do what YYDEFACT says.
664 If YYTABLE_NINF, syntax error. */
665 #define YYTABLE_NINF -25
666 static const yytype_int8 yytable[] =
668 43, 96, 79, 112, 27, 28, 61, 54, 85, 29,
669 117, 30, 117, 56, 57, 99, 100, 109, -8, 27,
670 44, 50, 51, 117, 82, 43, 80, 27, 28, 24,
671 122, 56, 57, 47, 71, 72, 121, 34, 27, 55,
672 123, 92, 92, 50, 35, 78, 43, 43, 43, 43,
673 43, 43, 31, 64, 65, 66, 67, 92, 68, 27,
674 27, 25, 32, 52, 7, 33, 101, 102, 103, 104,
675 105, 106, 50, 107, 66, 67, 41, 68, 49, 92,
676 53, 92, 74, 75, 25, 64, 65, 66, 67, 54,
677 68, 70, 92, 83, 68, 73, 63, -23, 92, 92,
678 77, -24, 64, 65, 66, 67, 81, 68, 110, 111,
679 83, 84, 63, 119, 120, 57, 86, 87, 64, 65,
680 66, 67, 113, 68, 2, 3, 114, 124, 4, 77,
681 5, 6, 7, 8, -6, 9, 118, 10, 11, 12,
682 0, 0, 13, 0, 0, 0, 14, 0, 15, 58,
683 59, 0, 60, 61, 62, 0, 0, 16, 0, 17,
684 0, 88, 89, 7, 33, 18, 9, 0, 10, 11,
685 12, 0, 0, 13, 0, 0, 0, 14, 0, 15,
686 58, 115, 0, 60, 61, 62, 0, 0, 16, 0,
687 17, 0, 88, 89, 7, 33, 69, 9, 116, 10,
688 11, 12, 0, 0, 13, 0, 45, 46, 14, 0,
689 15, 9, 0, 10, 11, 12, 0, 0, 13, 16,
690 0, 17, 14, 0, 15, 0, 0, 69, 0, 0,
691 0, 38, 6, 16, 0, 17, 9, 0, 10, 11,
692 12, 18, 0, 13, 0, 38, 6, 14, 0, 15,
693 9, 0, 10, 11, 12, 0, 0, 13, 16, 0,
694 17, 14, 0, 15, 0, 0, 18, 0, 0, 0,
695 45, 46, 16, 0, 17, 9, 0, 10, 11, 12,
696 69, 0, 13, 0, 38, 6, 14, 0, 15, 9,
697 0, 10, 11, 0, 38, 6, 39, 16, 0, 17,
698 0, 10, 15, 0, 0, 69, 39, 0, 0, 0,
699 0, 16, 15, 17, 0, 0, 0, 0, 0, 40,
700 0, 0, 0, 17, 0, 0, 0, 0, 0, 42
703 static const yytype_int8 yycheck[] =
705 17, 58, 16, 81, 1, 1, 20, 23, 54, 10,
706 96, 5, 98, 31, 32, 61, 62, 74, 10, 16,
707 17, 18, 18, 109, 42, 42, 42, 24, 24, 1,
708 116, 31, 32, 18, 31, 31, 114, 9, 35, 24,
709 118, 58, 59, 40, 27, 42, 63, 64, 65, 66,
710 67, 68, 40, 34, 35, 36, 37, 74, 39, 56,
711 57, 1, 6, 10, 8, 9, 63, 64, 65, 66,
712 67, 68, 69, 69, 36, 37, 16, 39, 18, 96,
713 5, 98, 25, 26, 24, 34, 35, 36, 37, 23,
714 39, 31, 109, 42, 39, 35, 28, 43, 115, 116,
715 40, 43, 34, 35, 36, 37, 43, 39, 6, 7,
716 42, 42, 28, 6, 7, 32, 56, 57, 34, 35,
717 36, 37, 12, 39, 0, 1, 12, 42, 4, 69,
718 6, 7, 8, 9, 10, 11, 43, 13, 14, 15,
719 -1, -1, 18, -1, -1, -1, 22, -1, 24, 16,
720 17, -1, 19, 20, 21, -1, -1, 33, -1, 35,
721 -1, 6, 7, 8, 9, 41, 11, -1, 13, 14,
722 15, -1, -1, 18, -1, -1, -1, 22, -1, 24,
723 16, 17, -1, 19, 20, 21, -1, -1, 33, -1,
724 35, -1, 6, 7, 8, 9, 41, 11, 43, 13,
725 14, 15, -1, -1, 18, -1, 6, 7, 22, -1,
726 24, 11, -1, 13, 14, 15, -1, -1, 18, 33,
727 -1, 35, 22, -1, 24, -1, -1, 41, -1, -1,
728 -1, 6, 7, 33, -1, 35, 11, -1, 13, 14,
729 15, 41, -1, 18, -1, 6, 7, 22, -1, 24,
730 11, -1, 13, 14, 15, -1, -1, 18, 33, -1,
731 35, 22, -1, 24, -1, -1, 41, -1, -1, -1,
732 6, 7, 33, -1, 35, 11, -1, 13, 14, 15,
733 41, -1, 18, -1, 6, 7, 22, -1, 24, 11,
734 -1, 13, 14, -1, 6, 7, 18, 33, -1, 35,
735 -1, 13, 24, -1, -1, 41, 18, -1, -1, -1,
736 -1, 33, 24, 35, -1, -1, -1, -1, -1, 41,
737 -1, -1, -1, 35, -1, -1, -1, -1, -1, 41
740 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
741 symbol of state STATE-NUM. */
742 static const yytype_uint8 yystos[] =
744 0, 45, 0, 1, 4, 6, 7, 8, 9, 11,
745 13, 14, 15, 18, 22, 24, 33, 35, 41, 46,
746 47, 48, 49, 50, 52, 53, 54, 55, 57, 10,
747 5, 40, 6, 9, 52, 27, 58, 59, 6, 18,
748 41, 53, 41, 54, 55, 6, 7, 50, 51, 53,
749 55, 57, 10, 5, 23, 50, 31, 32, 16, 17,
750 19, 20, 21, 28, 34, 35, 36, 37, 39, 41,
751 53, 55, 57, 53, 25, 26, 60, 53, 55, 16,
752 42, 43, 42, 42, 42, 58, 53, 53, 6, 7,
753 52, 53, 54, 55, 56, 57, 62, 63, 62, 58,
754 58, 55, 55, 55, 55, 55, 55, 57, 61, 62,
755 6, 7, 51, 12, 12, 17, 43, 63, 43, 6,
756 7, 51, 63, 51, 42
759 #define yyerrok (yyerrstatus = 0)
760 #define yyclearin (yychar = YYEMPTY)
761 #define YYEMPTY (-2)
762 #define YYEOF 0
764 #define YYACCEPT goto yyacceptlab
765 #define YYABORT goto yyabortlab
766 #define YYERROR goto yyerrorlab
769 /* Like YYERROR except do call yyerror. This remains here temporarily
770 to ease the transition to the new meaning of YYERROR, for GCC.
771 Once GCC version 2 has supplanted version 1, this can go. */
773 #define YYFAIL goto yyerrlab
775 #define YYRECOVERING() (!!yyerrstatus)
777 #define YYBACKUP(Token, Value) \
778 do \
779 if (yychar == YYEMPTY && yylen == 1) \
781 yychar = (Token); \
782 yylval = (Value); \
783 yytoken = YYTRANSLATE (yychar); \
784 YYPOPSTACK (1); \
785 goto yybackup; \
787 else \
789 yyerror (scanner, YY_("syntax error: cannot back up")); \
790 YYERROR; \
792 while (YYID (0))
795 #define YYTERROR 1
796 #define YYERRCODE 256
799 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
800 If N is 0, then set CURRENT to the empty location which ends
801 the previous symbol: RHS[0] (always defined). */
803 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
804 #ifndef YYLLOC_DEFAULT
805 # define YYLLOC_DEFAULT(Current, Rhs, N) \
806 do \
807 if (YYID (N)) \
809 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
810 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
811 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
812 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
814 else \
816 (Current).first_line = (Current).last_line = \
817 YYRHSLOC (Rhs, 0).last_line; \
818 (Current).first_column = (Current).last_column = \
819 YYRHSLOC (Rhs, 0).last_column; \
821 while (YYID (0))
822 #endif
825 /* YY_LOCATION_PRINT -- Print the location on the stream.
826 This macro was not mandated originally: define only if we know
827 we won't break user code: when these are the locations we know. */
829 #ifndef YY_LOCATION_PRINT
830 # if YYLTYPE_IS_TRIVIAL
831 # define YY_LOCATION_PRINT(File, Loc) \
832 fprintf (File, "%d.%d-%d.%d", \
833 (Loc).first_line, (Loc).first_column, \
834 (Loc).last_line, (Loc).last_column)
835 # else
836 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
837 # endif
838 #endif
841 /* YYLEX -- calling `yylex' with the right arguments. */
843 #ifdef YYLEX_PARAM
844 # define YYLEX yylex (&yylval, YYLEX_PARAM)
845 #else
846 # define YYLEX yylex (&yylval, scanner)
847 #endif
849 /* Enable debugging if requested. */
850 #if YYDEBUG
852 # ifndef YYFPRINTF
853 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
854 # define YYFPRINTF fprintf
855 # endif
857 # define YYDPRINTF(Args) \
858 do { \
859 if (yydebug) \
860 YYFPRINTF Args; \
861 } while (YYID (0))
863 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
864 do { \
865 if (yydebug) \
867 YYFPRINTF (stderr, "%s ", Title); \
868 yy_symbol_print (stderr, \
869 Type, Value, scanner); \
870 YYFPRINTF (stderr, "\n"); \
872 } while (YYID (0))
875 /*--------------------------------.
876 | Print this symbol on YYOUTPUT. |
877 `--------------------------------*/
879 /*ARGSUSED*/
880 #if (defined __STDC__ || defined __C99__FUNC__ \
881 || defined __cplusplus || defined _MSC_VER)
882 static void
883 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t scanner)
884 #else
885 static void
886 yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner)
887 FILE *yyoutput;
888 int yytype;
889 YYSTYPE const * const yyvaluep;
890 yyscan_t scanner;
891 #endif
893 if (!yyvaluep)
894 return;
895 YYUSE (scanner);
896 # ifdef YYPRINT
897 if (yytype < YYNTOKENS)
898 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
899 # else
900 YYUSE (yyoutput);
901 # endif
902 switch (yytype)
904 default:
905 break;
910 /*--------------------------------.
911 | Print this symbol on YYOUTPUT. |
912 `--------------------------------*/
914 #if (defined __STDC__ || defined __C99__FUNC__ \
915 || defined __cplusplus || defined _MSC_VER)
916 static void
917 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t scanner)
918 #else
919 static void
920 yy_symbol_print (yyoutput, yytype, yyvaluep, scanner)
921 FILE *yyoutput;
922 int yytype;
923 YYSTYPE const * const yyvaluep;
924 yyscan_t scanner;
925 #endif
927 if (yytype < YYNTOKENS)
928 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
929 else
930 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
932 yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner);
933 YYFPRINTF (yyoutput, ")");
936 /*------------------------------------------------------------------.
937 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
938 | TOP (included). |
939 `------------------------------------------------------------------*/
941 #if (defined __STDC__ || defined __C99__FUNC__ \
942 || defined __cplusplus || defined _MSC_VER)
943 static void
944 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
945 #else
946 static void
947 yy_stack_print (bottom, top)
948 yytype_int16 *bottom;
949 yytype_int16 *top;
950 #endif
952 YYFPRINTF (stderr, "Stack now");
953 for (; bottom <= top; ++bottom)
954 YYFPRINTF (stderr, " %d", *bottom);
955 YYFPRINTF (stderr, "\n");
958 # define YY_STACK_PRINT(Bottom, Top) \
959 do { \
960 if (yydebug) \
961 yy_stack_print ((Bottom), (Top)); \
962 } while (YYID (0))
965 /*------------------------------------------------.
966 | Report that the YYRULE is going to be reduced. |
967 `------------------------------------------------*/
969 #if (defined __STDC__ || defined __C99__FUNC__ \
970 || defined __cplusplus || defined _MSC_VER)
971 static void
972 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, yyscan_t scanner)
973 #else
974 static void
975 yy_reduce_print (yyvsp, yyrule, scanner)
976 YYSTYPE *yyvsp;
977 int yyrule;
978 yyscan_t scanner;
979 #endif
981 int yynrhs = yyr2[yyrule];
982 int yyi;
983 unsigned long int yylno = yyrline[yyrule];
984 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
985 yyrule - 1, yylno);
986 /* The symbols being reduced. */
987 for (yyi = 0; yyi < yynrhs; yyi++)
989 fprintf (stderr, " $%d = ", yyi + 1);
990 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
991 &(yyvsp[(yyi + 1) - (yynrhs)])
992 , scanner);
993 fprintf (stderr, "\n");
997 # define YY_REDUCE_PRINT(Rule) \
998 do { \
999 if (yydebug) \
1000 yy_reduce_print (yyvsp, Rule, scanner); \
1001 } while (YYID (0))
1003 /* Nonzero means print parse trace. It is left uninitialized so that
1004 multiple parsers can coexist. */
1005 int yydebug;
1006 #else /* !YYDEBUG */
1007 # define YYDPRINTF(Args)
1008 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1009 # define YY_STACK_PRINT(Bottom, Top)
1010 # define YY_REDUCE_PRINT(Rule)
1011 #endif /* !YYDEBUG */
1014 /* YYINITDEPTH -- initial size of the parser's stacks. */
1015 #ifndef YYINITDEPTH
1016 # define YYINITDEPTH 200
1017 #endif
1019 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1020 if the built-in stack extension method is used).
1022 Do not make this value too large; the results are undefined if
1023 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1024 evaluated with infinite-precision integer arithmetic. */
1026 #ifndef YYMAXDEPTH
1027 # define YYMAXDEPTH 10000
1028 #endif
1032 #if YYERROR_VERBOSE
1034 # ifndef yystrlen
1035 # if defined __GLIBC__ && defined _STRING_H
1036 # define yystrlen strlen
1037 # else
1038 /* Return the length of YYSTR. */
1039 #if (defined __STDC__ || defined __C99__FUNC__ \
1040 || defined __cplusplus || defined _MSC_VER)
1041 static YYSIZE_T
1042 yystrlen (const char *yystr)
1043 #else
1044 static YYSIZE_T
1045 yystrlen (yystr)
1046 const char *yystr;
1047 #endif
1049 YYSIZE_T yylen;
1050 for (yylen = 0; yystr[yylen]; yylen++)
1051 continue;
1052 return yylen;
1054 # endif
1055 # endif
1057 # ifndef yystpcpy
1058 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1059 # define yystpcpy stpcpy
1060 # else
1061 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1062 YYDEST. */
1063 #if (defined __STDC__ || defined __C99__FUNC__ \
1064 || defined __cplusplus || defined _MSC_VER)
1065 static char *
1066 yystpcpy (char *yydest, const char *yysrc)
1067 #else
1068 static char *
1069 yystpcpy (yydest, yysrc)
1070 char *yydest;
1071 const char *yysrc;
1072 #endif
1074 char *yyd = yydest;
1075 const char *yys = yysrc;
1077 while ((*yyd++ = *yys++) != '\0')
1078 continue;
1080 return yyd - 1;
1082 # endif
1083 # endif
1085 # ifndef yytnamerr
1086 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1087 quotes and backslashes, so that it's suitable for yyerror. The
1088 heuristic is that double-quoting is unnecessary unless the string
1089 contains an apostrophe, a comma, or backslash (other than
1090 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1091 null, do not copy; instead, return the length of what the result
1092 would have been. */
1093 static YYSIZE_T
1094 yytnamerr (char *yyres, const char *yystr)
1096 if (*yystr == '"')
1098 YYSIZE_T yyn = 0;
1099 char const *yyp = yystr;
1101 for (;;)
1102 switch (*++yyp)
1104 case '\'':
1105 case ',':
1106 goto do_not_strip_quotes;
1108 case '\\':
1109 if (*++yyp != '\\')
1110 goto do_not_strip_quotes;
1111 /* Fall through. */
1112 default:
1113 if (yyres)
1114 yyres[yyn] = *yyp;
1115 yyn++;
1116 break;
1118 case '"':
1119 if (yyres)
1120 yyres[yyn] = '\0';
1121 return yyn;
1123 do_not_strip_quotes: ;
1126 if (! yyres)
1127 return yystrlen (yystr);
1129 return yystpcpy (yyres, yystr) - yyres;
1131 # endif
1133 /* Copy into YYRESULT an error message about the unexpected token
1134 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1135 including the terminating null byte. If YYRESULT is null, do not
1136 copy anything; just return the number of bytes that would be
1137 copied. As a special case, return 0 if an ordinary "syntax error"
1138 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1139 size calculation. */
1140 static YYSIZE_T
1141 yysyntax_error (char *yyresult, int yystate, int yychar)
1143 int yyn = yypact[yystate];
1145 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1146 return 0;
1147 else
1149 int yytype = YYTRANSLATE (yychar);
1150 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1151 YYSIZE_T yysize = yysize0;
1152 YYSIZE_T yysize1;
1153 int yysize_overflow = 0;
1154 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1155 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1156 int yyx;
1158 # if 0
1159 /* This is so xgettext sees the translatable formats that are
1160 constructed on the fly. */
1161 YY_("syntax error, unexpected %s");
1162 YY_("syntax error, unexpected %s, expecting %s");
1163 YY_("syntax error, unexpected %s, expecting %s or %s");
1164 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1165 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1166 # endif
1167 char *yyfmt;
1168 char const *yyf;
1169 static char const yyunexpected[] = "syntax error, unexpected %s";
1170 static char const yyexpecting[] = ", expecting %s";
1171 static char const yyor[] = " or %s";
1172 char yyformat[sizeof yyunexpected
1173 + sizeof yyexpecting - 1
1174 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1175 * (sizeof yyor - 1))];
1176 char const *yyprefix = yyexpecting;
1178 /* Start YYX at -YYN if negative to avoid negative indexes in
1179 YYCHECK. */
1180 int yyxbegin = yyn < 0 ? -yyn : 0;
1182 /* Stay within bounds of both yycheck and yytname. */
1183 int yychecklim = YYLAST - yyn + 1;
1184 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1185 int yycount = 1;
1187 yyarg[0] = yytname[yytype];
1188 yyfmt = yystpcpy (yyformat, yyunexpected);
1190 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1191 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1193 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1195 yycount = 1;
1196 yysize = yysize0;
1197 yyformat[sizeof yyunexpected - 1] = '\0';
1198 break;
1200 yyarg[yycount++] = yytname[yyx];
1201 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1202 yysize_overflow |= (yysize1 < yysize);
1203 yysize = yysize1;
1204 yyfmt = yystpcpy (yyfmt, yyprefix);
1205 yyprefix = yyor;
1208 yyf = YY_(yyformat);
1209 yysize1 = yysize + yystrlen (yyf);
1210 yysize_overflow |= (yysize1 < yysize);
1211 yysize = yysize1;
1213 if (yysize_overflow)
1214 return YYSIZE_MAXIMUM;
1216 if (yyresult)
1218 /* Avoid sprintf, as that infringes on the user's name space.
1219 Don't have undefined behavior even if the translation
1220 produced a string with the wrong number of "%s"s. */
1221 char *yyp = yyresult;
1222 int yyi = 0;
1223 while ((*yyp = *yyf) != '\0')
1225 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1227 yyp += yytnamerr (yyp, yyarg[yyi++]);
1228 yyf += 2;
1230 else
1232 yyp++;
1233 yyf++;
1237 return yysize;
1240 #endif /* YYERROR_VERBOSE */
1243 /*-----------------------------------------------.
1244 | Release the memory associated to this symbol. |
1245 `-----------------------------------------------*/
1247 /*ARGSUSED*/
1248 #if (defined __STDC__ || defined __C99__FUNC__ \
1249 || defined __cplusplus || defined _MSC_VER)
1250 static void
1251 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t scanner)
1252 #else
1253 static void
1254 yydestruct (yymsg, yytype, yyvaluep, scanner)
1255 const char *yymsg;
1256 int yytype;
1257 YYSTYPE *yyvaluep;
1258 yyscan_t scanner;
1259 #endif
1261 YYUSE (yyvaluep);
1262 YYUSE (scanner);
1264 if (!yymsg)
1265 yymsg = "Deleting";
1266 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1268 switch (yytype)
1270 case 5: /* "HELP_TOPIC" */
1271 #line 153 "parser.y"
1272 { free((yyvaluep->str)); };
1273 #line 1274 "parser.c"
1274 break;
1275 case 8: /* "STR" */
1276 #line 153 "parser.y"
1277 { free((yyvaluep->str)); };
1278 #line 1279 "parser.c"
1279 break;
1280 case 9: /* "IDENTIFIER" */
1281 #line 153 "parser.y"
1282 { free((yyvaluep->str)); };
1283 #line 1284 "parser.c"
1284 break;
1285 case 25: /* "PARAM" */
1286 #line 154 "parser.y"
1287 { if((yyvaluep->str)) free((yyvaluep->str)); };
1288 #line 1289 "parser.c"
1289 break;
1290 case 28: /* "CMP_OP" */
1291 #line 153 "parser.y"
1292 { free((yyvaluep->str)); };
1293 #line 1294 "parser.c"
1294 break;
1295 case 46: /* "command" */
1296 #line 155 "parser.y"
1297 { if((yyvaluep->sel)) _gmx_selelem_free((yyvaluep->sel)); };
1298 #line 1299 "parser.c"
1299 break;
1300 case 47: /* "cmd_plain" */
1301 #line 155 "parser.y"
1302 { if((yyvaluep->sel)) _gmx_selelem_free((yyvaluep->sel)); };
1303 #line 1304 "parser.c"
1304 break;
1305 case 50: /* "selection" */
1306 #line 156 "parser.y"
1307 { _gmx_selelem_free_chain((yyvaluep->sel)); };
1308 #line 1309 "parser.c"
1309 break;
1310 case 52: /* "string" */
1311 #line 153 "parser.y"
1312 { free((yyvaluep->str)); };
1313 #line 1314 "parser.c"
1314 break;
1315 case 53: /* "sel_expr" */
1316 #line 157 "parser.y"
1317 { _gmx_selelem_free((yyvaluep->sel)); };
1318 #line 1319 "parser.c"
1319 break;
1320 case 55: /* "num_expr" */
1321 #line 157 "parser.y"
1322 { _gmx_selelem_free((yyvaluep->sel)); };
1323 #line 1324 "parser.c"
1324 break;
1325 case 56: /* "str_expr" */
1326 #line 157 "parser.y"
1327 { _gmx_selelem_free((yyvaluep->sel)); };
1328 #line 1329 "parser.c"
1329 break;
1330 case 57: /* "pos_expr" */
1331 #line 157 "parser.y"
1332 { _gmx_selelem_free((yyvaluep->sel)); };
1333 #line 1334 "parser.c"
1334 break;
1335 case 58: /* "method_params" */
1336 #line 158 "parser.y"
1337 { _gmx_selexpr_free_params((yyvaluep->param)); };
1338 #line 1339 "parser.c"
1339 break;
1340 case 59: /* "method_param_list" */
1341 #line 158 "parser.y"
1342 { _gmx_selexpr_free_params((yyvaluep->param)); };
1343 #line 1344 "parser.c"
1344 break;
1345 case 60: /* "method_param" */
1346 #line 158 "parser.y"
1347 { _gmx_selexpr_free_params((yyvaluep->param)); };
1348 #line 1349 "parser.c"
1349 break;
1350 case 61: /* "value_list" */
1351 #line 159 "parser.y"
1352 { _gmx_selexpr_free_values((yyvaluep->val)); };
1353 #line 1354 "parser.c"
1354 break;
1355 case 62: /* "value_list_nonempty" */
1356 #line 159 "parser.y"
1357 { _gmx_selexpr_free_values((yyvaluep->val)); };
1358 #line 1359 "parser.c"
1359 break;
1360 case 63: /* "value_item" */
1361 #line 159 "parser.y"
1362 { _gmx_selexpr_free_values((yyvaluep->val)); };
1363 #line 1364 "parser.c"
1364 break;
1366 default:
1367 break;
1372 /* Prevent warnings from -Wmissing-prototypes. */
1374 #ifdef YYPARSE_PARAM
1375 #if defined __STDC__ || defined __cplusplus
1376 int yyparse (void *YYPARSE_PARAM);
1377 #else
1378 int yyparse ();
1379 #endif
1380 #else /* ! YYPARSE_PARAM */
1381 #if defined __STDC__ || defined __cplusplus
1382 int yyparse (yyscan_t scanner);
1383 #else
1384 int yyparse ();
1385 #endif
1386 #endif /* ! YYPARSE_PARAM */
1393 /*----------.
1394 | yyparse. |
1395 `----------*/
1397 #ifdef YYPARSE_PARAM
1398 #if (defined __STDC__ || defined __C99__FUNC__ \
1399 || defined __cplusplus || defined _MSC_VER)
1401 yyparse (void *YYPARSE_PARAM)
1402 #else
1404 yyparse (YYPARSE_PARAM)
1405 void *YYPARSE_PARAM;
1406 #endif
1407 #else /* ! YYPARSE_PARAM */
1408 #if (defined __STDC__ || defined __C99__FUNC__ \
1409 || defined __cplusplus || defined _MSC_VER)
1411 yyparse (yyscan_t scanner)
1412 #else
1414 yyparse (scanner)
1415 yyscan_t scanner;
1416 #endif
1417 #endif
1419 /* The look-ahead symbol. */
1420 int yychar;
1422 /* The semantic value of the look-ahead symbol. */
1423 YYSTYPE yylval;
1425 /* Number of syntax errors so far. */
1426 int yynerrs;
1428 int yystate;
1429 int yyn;
1430 int yyresult;
1431 /* Number of tokens to shift before error messages enabled. */
1432 int yyerrstatus;
1433 /* Look-ahead token as an internal (translated) token number. */
1434 int yytoken = 0;
1435 #if YYERROR_VERBOSE
1436 /* Buffer for error messages, and its allocated size. */
1437 char yymsgbuf[128];
1438 char *yymsg = yymsgbuf;
1439 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1440 #endif
1442 /* Three stacks and their tools:
1443 `yyss': related to states,
1444 `yyvs': related to semantic values,
1445 `yyls': related to locations.
1447 Refer to the stacks thru separate pointers, to allow yyoverflow
1448 to reallocate them elsewhere. */
1450 /* The state stack. */
1451 yytype_int16 yyssa[YYINITDEPTH];
1452 yytype_int16 *yyss = yyssa;
1453 yytype_int16 *yyssp;
1455 /* The semantic value stack. */
1456 YYSTYPE yyvsa[YYINITDEPTH];
1457 YYSTYPE *yyvs = yyvsa;
1458 YYSTYPE *yyvsp;
1462 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1464 YYSIZE_T yystacksize = YYINITDEPTH;
1466 /* The variables used to return semantic value and location from the
1467 action routines. */
1468 YYSTYPE yyval;
1471 /* The number of symbols on the RHS of the reduced rule.
1472 Keep to zero when no symbol should be popped. */
1473 int yylen = 0;
1475 YYDPRINTF ((stderr, "Starting parse\n"));
1477 yystate = 0;
1478 yyerrstatus = 0;
1479 yynerrs = 0;
1480 yychar = YYEMPTY; /* Cause a token to be read. */
1482 /* Initialize stack pointers.
1483 Waste one element of value and location stack
1484 so that they stay on the same level as the state stack.
1485 The wasted elements are never initialized. */
1487 yyssp = yyss;
1488 yyvsp = yyvs;
1490 goto yysetstate;
1492 /*------------------------------------------------------------.
1493 | yynewstate -- Push a new state, which is found in yystate. |
1494 `------------------------------------------------------------*/
1495 yynewstate:
1496 /* In all cases, when you get here, the value and location stacks
1497 have just been pushed. So pushing a state here evens the stacks. */
1498 yyssp++;
1500 yysetstate:
1501 *yyssp = yystate;
1503 if (yyss + yystacksize - 1 <= yyssp)
1505 /* Get the current used size of the three stacks, in elements. */
1506 YYSIZE_T yysize = yyssp - yyss + 1;
1508 #ifdef yyoverflow
1510 /* Give user a chance to reallocate the stack. Use copies of
1511 these so that the &'s don't force the real ones into
1512 memory. */
1513 YYSTYPE *yyvs1 = yyvs;
1514 yytype_int16 *yyss1 = yyss;
1517 /* Each stack pointer address is followed by the size of the
1518 data in use in that stack, in bytes. This used to be a
1519 conditional around just the two extra args, but that might
1520 be undefined if yyoverflow is a macro. */
1521 yyoverflow (YY_("memory exhausted"),
1522 &yyss1, yysize * sizeof (*yyssp),
1523 &yyvs1, yysize * sizeof (*yyvsp),
1525 &yystacksize);
1527 yyss = yyss1;
1528 yyvs = yyvs1;
1530 #else /* no yyoverflow */
1531 # ifndef YYSTACK_RELOCATE
1532 goto yyexhaustedlab;
1533 # else
1534 /* Extend the stack our own way. */
1535 if (YYMAXDEPTH <= yystacksize)
1536 goto yyexhaustedlab;
1537 yystacksize *= 2;
1538 if (YYMAXDEPTH < yystacksize)
1539 yystacksize = YYMAXDEPTH;
1542 yytype_int16 *yyss1 = yyss;
1543 union yyalloc *yyptr =
1544 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1545 if (! yyptr)
1546 goto yyexhaustedlab;
1547 YYSTACK_RELOCATE (yyss);
1548 YYSTACK_RELOCATE (yyvs);
1550 # undef YYSTACK_RELOCATE
1551 if (yyss1 != yyssa)
1552 YYSTACK_FREE (yyss1);
1554 # endif
1555 #endif /* no yyoverflow */
1557 yyssp = yyss + yysize - 1;
1558 yyvsp = yyvs + yysize - 1;
1561 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1562 (unsigned long int) yystacksize));
1564 if (yyss + yystacksize - 1 <= yyssp)
1565 YYABORT;
1568 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1570 goto yybackup;
1572 /*-----------.
1573 | yybackup. |
1574 `-----------*/
1575 yybackup:
1577 /* Do appropriate processing given the current state. Read a
1578 look-ahead token if we need one and don't already have one. */
1580 /* First try to decide what to do without reference to look-ahead token. */
1581 yyn = yypact[yystate];
1582 if (yyn == YYPACT_NINF)
1583 goto yydefault;
1585 /* Not known => get a look-ahead token if don't already have one. */
1587 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1588 if (yychar == YYEMPTY)
1590 YYDPRINTF ((stderr, "Reading a token: "));
1591 yychar = YYLEX;
1594 if (yychar <= YYEOF)
1596 yychar = yytoken = YYEOF;
1597 YYDPRINTF ((stderr, "Now at end of input.\n"));
1599 else
1601 yytoken = YYTRANSLATE (yychar);
1602 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1605 /* If the proper action on seeing token YYTOKEN is to reduce or to
1606 detect an error, take that action. */
1607 yyn += yytoken;
1608 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1609 goto yydefault;
1610 yyn = yytable[yyn];
1611 if (yyn <= 0)
1613 if (yyn == 0 || yyn == YYTABLE_NINF)
1614 goto yyerrlab;
1615 yyn = -yyn;
1616 goto yyreduce;
1619 if (yyn == YYFINAL)
1620 YYACCEPT;
1622 /* Count tokens shifted since error; after three, turn off error
1623 status. */
1624 if (yyerrstatus)
1625 yyerrstatus--;
1627 /* Shift the look-ahead token. */
1628 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1630 /* Discard the shifted token unless it is eof. */
1631 if (yychar != YYEOF)
1632 yychar = YYEMPTY;
1634 yystate = yyn;
1635 *++yyvsp = yylval;
1637 goto yynewstate;
1640 /*-----------------------------------------------------------.
1641 | yydefault -- do the default action for the current state. |
1642 `-----------------------------------------------------------*/
1643 yydefault:
1644 yyn = yydefact[yystate];
1645 if (yyn == 0)
1646 goto yyerrlab;
1647 goto yyreduce;
1650 /*-----------------------------.
1651 | yyreduce -- Do a reduction. |
1652 `-----------------------------*/
1653 yyreduce:
1654 /* yyn is the number of a rule to reduce with. */
1655 yylen = yyr2[yyn];
1657 /* If YYLEN is nonzero, implement the default value of the action:
1658 `$$ = $1'.
1660 Otherwise, the following line sets YYVAL to garbage.
1661 This behavior is undocumented and Bison
1662 users should not rely upon it. Assigning to YYVAL
1663 unconditionally makes the parser a bit smaller, and it avoids a
1664 GCC warning that YYVAL may be used uninitialized. */
1665 yyval = yyvsp[1-yylen];
1668 YY_REDUCE_PRINT (yyn);
1669 switch (yyn)
1671 case 2:
1672 #line 173 "parser.y"
1673 { (yyval.sel) = NULL ;}
1674 break;
1676 case 3:
1677 #line 175 "parser.y"
1679 (yyval.sel) = _gmx_sel_append_selection((yyvsp[(2) - (2)].sel), (yyvsp[(1) - (2)].sel), scanner);
1680 if (_gmx_sel_parser_should_finish(scanner))
1681 YYACCEPT;
1683 break;
1685 case 4:
1686 #line 183 "parser.y"
1687 { (yyval.sel) = (yyvsp[(1) - (2)].sel); ;}
1688 break;
1690 case 5:
1691 #line 185 "parser.y"
1693 (yyval.sel) = NULL;
1694 _gmx_selparser_error("invalid selection '%s'",
1695 _gmx_sel_lexer_pselstr(scanner));
1696 _gmx_sel_lexer_clear_method_stack(scanner);
1697 if (_gmx_sel_is_lexer_interactive(scanner))
1699 _gmx_sel_lexer_clear_pselstr(scanner);
1700 yyerrok;
1702 else
1704 YYABORT;
1707 break;
1709 case 6:
1710 #line 204 "parser.y"
1712 (yyval.sel) = NULL;
1713 _gmx_sel_handle_empty_cmd(scanner);
1715 break;
1717 case 7:
1718 #line 208 "parser.y"
1719 { (yyval.sel) = NULL; ;}
1720 break;
1722 case 8:
1723 #line 210 "parser.y"
1725 t_selelem *s, *p;
1726 s = _gmx_sel_init_group_by_id((yyvsp[(1) - (1)].i), scanner);
1727 if (s == NULL) YYERROR;
1728 p = _gmx_sel_init_position(s, NULL, scanner);
1729 if (p == NULL) YYERROR;
1730 (yyval.sel) = _gmx_sel_init_selection(strdup(s->name), p, scanner);
1732 break;
1734 case 9:
1735 #line 219 "parser.y"
1737 t_selelem *s, *p;
1738 s = _gmx_sel_init_group_by_name((yyvsp[(1) - (1)].str), scanner);
1739 free((yyvsp[(1) - (1)].str));
1740 if (s == NULL) YYERROR;
1741 p = _gmx_sel_init_position(s, NULL, scanner);
1742 if (p == NULL) YYERROR;
1743 (yyval.sel) = _gmx_sel_init_selection(strdup(s->name), p, scanner);
1745 break;
1747 case 10:
1748 #line 229 "parser.y"
1749 { (yyval.sel) = _gmx_sel_init_selection(NULL, (yyvsp[(1) - (1)].sel), scanner); ;}
1750 break;
1752 case 11:
1753 #line 231 "parser.y"
1754 { (yyval.sel) = _gmx_sel_init_selection((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].sel), scanner); ;}
1755 break;
1757 case 12:
1758 #line 233 "parser.y"
1759 { (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
1760 break;
1762 case 13:
1763 #line 235 "parser.y"
1764 { (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
1765 break;
1767 case 14:
1768 #line 237 "parser.y"
1769 { (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
1770 break;
1772 case 15:
1773 #line 242 "parser.y"
1774 { _gmx_sel_handle_help_cmd(NULL, scanner); ;}
1775 break;
1777 case 17:
1778 #line 246 "parser.y"
1779 { _gmx_sel_handle_help_cmd((yyvsp[(2) - (2)].str), scanner); ;}
1780 break;
1782 case 18:
1783 #line 247 "parser.y"
1784 { _gmx_sel_handle_help_cmd((yyvsp[(2) - (2)].str), scanner); ;}
1785 break;
1787 case 19:
1788 #line 251 "parser.y"
1789 { (yyval.sel) = (yyvsp[(1) - (1)].sel); ;}
1790 break;
1792 case 20:
1793 #line 253 "parser.y"
1795 (yyval.sel) = _gmx_sel_init_position((yyvsp[(1) - (1)].sel), NULL, scanner);
1796 if ((yyval.sel) == NULL) YYERROR;
1798 break;
1800 case 21:
1801 #line 257 "parser.y"
1802 { (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
1803 break;
1805 case 22:
1806 #line 259 "parser.y"
1808 (yyval.sel) = _gmx_sel_init_modifier((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].sel), scanner);
1809 if ((yyval.sel) == NULL) YYERROR;
1811 break;
1813 case 23:
1814 #line 269 "parser.y"
1815 { (yyval.r) = (yyvsp[(1) - (1)].i); ;}
1816 break;
1818 case 24:
1819 #line 270 "parser.y"
1820 { (yyval.r) = (yyvsp[(1) - (1)].r); ;}
1821 break;
1823 case 25:
1824 #line 273 "parser.y"
1825 { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
1826 break;
1828 case 26:
1829 #line 274 "parser.y"
1830 { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
1831 break;
1833 case 27:
1834 #line 283 "parser.y"
1836 (yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
1837 (yyval.sel)->u.boolt = BOOL_NOT;
1838 (yyval.sel)->child = (yyvsp[(2) - (2)].sel);
1840 break;
1842 case 28:
1843 #line 289 "parser.y"
1845 (yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
1846 (yyval.sel)->u.boolt = BOOL_AND;
1847 (yyval.sel)->child = (yyvsp[(1) - (3)].sel); (yyval.sel)->child->next = (yyvsp[(3) - (3)].sel);
1849 break;
1851 case 29:
1852 #line 295 "parser.y"
1854 (yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
1855 (yyval.sel)->u.boolt = BOOL_OR;
1856 (yyval.sel)->child = (yyvsp[(1) - (3)].sel); (yyval.sel)->child->next = (yyvsp[(3) - (3)].sel);
1858 break;
1860 case 30:
1861 #line 306 "parser.y"
1862 { (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
1863 break;
1865 case 31:
1866 #line 311 "parser.y"
1868 (yyval.sel) = _gmx_sel_init_comparison((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), (yyvsp[(2) - (3)].str), scanner);
1869 if ((yyval.sel) == NULL) YYERROR;
1871 break;
1873 case 32:
1874 #line 319 "parser.y"
1876 (yyval.sel) = _gmx_sel_init_group_by_name((yyvsp[(2) - (2)].str), scanner);
1877 free((yyvsp[(2) - (2)].str));
1878 if ((yyval.sel) == NULL) YYERROR;
1880 break;
1882 case 33:
1883 #line 325 "parser.y"
1885 (yyval.sel) = _gmx_sel_init_group_by_id((yyvsp[(2) - (2)].i), scanner);
1886 if ((yyval.sel) == NULL) YYERROR;
1888 break;
1890 case 34:
1891 #line 332 "parser.y"
1892 { (yyval.str) = NULL; ;}
1893 break;
1895 case 35:
1896 #line 333 "parser.y"
1897 { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
1898 break;
1900 case 36:
1901 #line 338 "parser.y"
1903 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
1904 if ((yyval.sel) == NULL) YYERROR;
1906 break;
1908 case 37:
1909 #line 343 "parser.y"
1911 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (3)].meth), process_value_list((yyvsp[(3) - (3)].val), NULL), (yyvsp[(1) - (3)].str), scanner);
1912 if ((yyval.sel) == NULL) YYERROR;
1914 break;
1916 case 38:
1917 #line 348 "parser.y"
1919 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (3)].meth), process_value_list((yyvsp[(3) - (3)].val), NULL), (yyvsp[(1) - (3)].str), scanner);
1920 if ((yyval.sel) == NULL) YYERROR;
1922 break;
1924 case 39:
1925 #line 356 "parser.y"
1927 (yyval.sel) = _gmx_sel_init_method((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].str), scanner);
1928 if ((yyval.sel) == NULL) YYERROR;
1930 break;
1932 case 40:
1933 #line 368 "parser.y"
1935 (yyval.sel) = _gmx_selelem_create(SEL_CONST);
1936 _gmx_selelem_set_vtype((yyval.sel), INT_VALUE);
1937 _gmx_selvalue_reserve(&(yyval.sel)->v, 1);
1938 (yyval.sel)->v.u.i[0] = (yyvsp[(1) - (1)].i);
1940 break;
1942 case 41:
1943 #line 375 "parser.y"
1945 (yyval.sel) = _gmx_selelem_create(SEL_CONST);
1946 _gmx_selelem_set_vtype((yyval.sel), REAL_VALUE);
1947 _gmx_selvalue_reserve(&(yyval.sel)->v, 1);
1948 (yyval.sel)->v.u.r[0] = (yyvsp[(1) - (1)].r);
1950 break;
1952 case 42:
1953 #line 385 "parser.y"
1955 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
1956 if ((yyval.sel) == NULL) YYERROR;
1958 break;
1960 case 43:
1961 #line 390 "parser.y"
1963 (yyval.sel) = _gmx_sel_init_method((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].str), scanner);
1964 if ((yyval.sel) == NULL) YYERROR;
1966 break;
1968 case 44:
1969 #line 398 "parser.y"
1970 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '+', scanner); ;}
1971 break;
1973 case 45:
1974 #line 400 "parser.y"
1975 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '-', scanner); ;}
1976 break;
1978 case 46:
1979 #line 402 "parser.y"
1980 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '*', scanner); ;}
1981 break;
1983 case 47:
1984 #line 404 "parser.y"
1985 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '/', scanner); ;}
1986 break;
1988 case 48:
1989 #line 406 "parser.y"
1990 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(2) - (2)].sel), NULL, '-', scanner); ;}
1991 break;
1993 case 49:
1994 #line 408 "parser.y"
1995 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '^', scanner); ;}
1996 break;
1998 case 50:
1999 #line 409 "parser.y"
2000 { (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
2001 break;
2003 case 51:
2004 #line 417 "parser.y"
2006 (yyval.sel) = _gmx_selelem_create(SEL_CONST);
2007 _gmx_selelem_set_vtype((yyval.sel), STR_VALUE);
2008 _gmx_selvalue_reserve(&(yyval.sel)->v, 1);
2009 (yyval.sel)->v.u.s[0] = (yyvsp[(1) - (1)].str);
2011 break;
2013 case 52:
2014 #line 424 "parser.y"
2016 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
2017 if ((yyval.sel) == NULL) YYERROR;
2019 break;
2021 case 53:
2022 #line 436 "parser.y"
2023 { (yyval.sel) = _gmx_sel_init_const_position((yyvsp[(2) - (7)].r), (yyvsp[(4) - (7)].r), (yyvsp[(6) - (7)].r)); ;}
2024 break;
2026 case 54:
2027 #line 440 "parser.y"
2028 { (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
2029 break;
2031 case 55:
2032 #line 445 "parser.y"
2034 (yyval.sel) = _gmx_sel_init_method((yyvsp[(1) - (2)].meth), (yyvsp[(2) - (2)].param), NULL, scanner);
2035 if ((yyval.sel) == NULL) YYERROR;
2037 break;
2039 case 56:
2040 #line 453 "parser.y"
2042 (yyval.sel) = _gmx_sel_init_position((yyvsp[(3) - (3)].sel), (yyvsp[(1) - (3)].str), scanner);
2043 if ((yyval.sel) == NULL) YYERROR;
2045 break;
2047 case 57:
2048 #line 464 "parser.y"
2049 { (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
2050 break;
2052 case 58:
2053 #line 468 "parser.y"
2054 { (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
2055 break;
2057 case 59:
2058 #line 472 "parser.y"
2059 { (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
2060 break;
2062 case 60:
2063 #line 481 "parser.y"
2064 { (yyval.param) = process_param_list((yyvsp[(1) - (1)].param)); ;}
2065 break;
2067 case 61:
2068 #line 483 "parser.y"
2069 { (yyval.param) = process_param_list((yyvsp[(1) - (2)].param)); ;}
2070 break;
2072 case 62:
2073 #line 487 "parser.y"
2074 { (yyval.param) = NULL; ;}
2075 break;
2077 case 63:
2078 #line 489 "parser.y"
2079 { (yyvsp[(2) - (2)].param)->next = (yyvsp[(1) - (2)].param); (yyval.param) = (yyvsp[(2) - (2)].param); ;}
2080 break;
2082 case 64:
2083 #line 494 "parser.y"
2085 (yyval.param) = _gmx_selexpr_create_param((yyvsp[(1) - (2)].str));
2086 (yyval.param)->value = process_value_list((yyvsp[(2) - (2)].val), &(yyval.param)->nval);
2088 break;
2090 case 65:
2091 #line 500 "parser.y"
2092 { (yyval.val) = NULL; ;}
2093 break;
2095 case 66:
2096 #line 501 "parser.y"
2097 { (yyval.val) = (yyvsp[(1) - (1)].val); ;}
2098 break;
2100 case 67:
2101 #line 505 "parser.y"
2102 { (yyval.val) = (yyvsp[(1) - (1)].val); ;}
2103 break;
2105 case 68:
2106 #line 507 "parser.y"
2107 { (yyvsp[(2) - (2)].val)->next = (yyvsp[(1) - (2)].val); (yyval.val) = (yyvsp[(2) - (2)].val); ;}
2108 break;
2110 case 69:
2111 #line 509 "parser.y"
2112 { (yyvsp[(3) - (3)].val)->next = (yyvsp[(1) - (3)].val); (yyval.val) = (yyvsp[(3) - (3)].val); ;}
2113 break;
2115 case 70:
2116 #line 513 "parser.y"
2117 { (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
2118 break;
2120 case 71:
2121 #line 515 "parser.y"
2122 { (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
2123 break;
2125 case 72:
2126 #line 517 "parser.y"
2127 { (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
2128 break;
2130 case 73:
2131 #line 519 "parser.y"
2132 { (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
2133 break;
2135 case 74:
2136 #line 521 "parser.y"
2138 (yyval.val) = _gmx_selexpr_create_value(INT_VALUE);
2139 (yyval.val)->u.i.i1 = (yyvsp[(1) - (3)].i); (yyval.val)->u.i.i2 = (yyvsp[(3) - (3)].i);
2141 break;
2143 case 75:
2144 #line 526 "parser.y"
2146 (yyval.val) = _gmx_selexpr_create_value(REAL_VALUE);
2147 (yyval.val)->u.r.r1 = (yyvsp[(1) - (3)].i); (yyval.val)->u.r.r2 = (yyvsp[(3) - (3)].r);
2149 break;
2151 case 76:
2152 #line 531 "parser.y"
2154 (yyval.val) = _gmx_selexpr_create_value(REAL_VALUE);
2155 (yyval.val)->u.r.r1 = (yyvsp[(1) - (3)].r); (yyval.val)->u.r.r2 = (yyvsp[(3) - (3)].r);
2157 break;
2160 /* Line 1267 of yacc.c. */
2161 #line 2162 "parser.c"
2162 default: break;
2164 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2166 YYPOPSTACK (yylen);
2167 yylen = 0;
2168 YY_STACK_PRINT (yyss, yyssp);
2170 *++yyvsp = yyval;
2173 /* Now `shift' the result of the reduction. Determine what state
2174 that goes to, based on the state we popped back to and the rule
2175 number reduced by. */
2177 yyn = yyr1[yyn];
2179 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2180 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2181 yystate = yytable[yystate];
2182 else
2183 yystate = yydefgoto[yyn - YYNTOKENS];
2185 goto yynewstate;
2188 /*------------------------------------.
2189 | yyerrlab -- here on detecting error |
2190 `------------------------------------*/
2191 yyerrlab:
2192 /* If not already recovering from an error, report this error. */
2193 if (!yyerrstatus)
2195 ++yynerrs;
2196 #if ! YYERROR_VERBOSE
2197 yyerror (scanner, YY_("syntax error"));
2198 #else
2200 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2201 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2203 YYSIZE_T yyalloc = 2 * yysize;
2204 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2205 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2206 if (yymsg != yymsgbuf)
2207 YYSTACK_FREE (yymsg);
2208 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2209 if (yymsg)
2210 yymsg_alloc = yyalloc;
2211 else
2213 yymsg = yymsgbuf;
2214 yymsg_alloc = sizeof yymsgbuf;
2218 if (0 < yysize && yysize <= yymsg_alloc)
2220 (void) yysyntax_error (yymsg, yystate, yychar);
2221 yyerror (scanner, yymsg);
2223 else
2225 yyerror (scanner, YY_("syntax error"));
2226 if (yysize != 0)
2227 goto yyexhaustedlab;
2230 #endif
2235 if (yyerrstatus == 3)
2237 /* If just tried and failed to reuse look-ahead token after an
2238 error, discard it. */
2240 if (yychar <= YYEOF)
2242 /* Return failure if at end of input. */
2243 if (yychar == YYEOF)
2244 YYABORT;
2246 else
2248 yydestruct ("Error: discarding",
2249 yytoken, &yylval, scanner);
2250 yychar = YYEMPTY;
2254 /* Else will try to reuse look-ahead token after shifting the error
2255 token. */
2256 goto yyerrlab1;
2259 /*---------------------------------------------------.
2260 | yyerrorlab -- error raised explicitly by YYERROR. |
2261 `---------------------------------------------------*/
2262 yyerrorlab:
2264 /* Pacify compilers like GCC when the user code never invokes
2265 YYERROR and the label yyerrorlab therefore never appears in user
2266 code. */
2267 if (/*CONSTCOND*/ 0)
2268 goto yyerrorlab;
2270 /* Do not reclaim the symbols of the rule which action triggered
2271 this YYERROR. */
2272 YYPOPSTACK (yylen);
2273 yylen = 0;
2274 YY_STACK_PRINT (yyss, yyssp);
2275 yystate = *yyssp;
2276 goto yyerrlab1;
2279 /*-------------------------------------------------------------.
2280 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2281 `-------------------------------------------------------------*/
2282 yyerrlab1:
2283 yyerrstatus = 3; /* Each real token shifted decrements this. */
2285 for (;;)
2287 yyn = yypact[yystate];
2288 if (yyn != YYPACT_NINF)
2290 yyn += YYTERROR;
2291 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2293 yyn = yytable[yyn];
2294 if (0 < yyn)
2295 break;
2299 /* Pop the current state because it cannot handle the error token. */
2300 if (yyssp == yyss)
2301 YYABORT;
2304 yydestruct ("Error: popping",
2305 yystos[yystate], yyvsp, scanner);
2306 YYPOPSTACK (1);
2307 yystate = *yyssp;
2308 YY_STACK_PRINT (yyss, yyssp);
2311 if (yyn == YYFINAL)
2312 YYACCEPT;
2314 *++yyvsp = yylval;
2317 /* Shift the error token. */
2318 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2320 yystate = yyn;
2321 goto yynewstate;
2324 /*-------------------------------------.
2325 | yyacceptlab -- YYACCEPT comes here. |
2326 `-------------------------------------*/
2327 yyacceptlab:
2328 yyresult = 0;
2329 goto yyreturn;
2331 /*-----------------------------------.
2332 | yyabortlab -- YYABORT comes here. |
2333 `-----------------------------------*/
2334 yyabortlab:
2335 yyresult = 1;
2336 goto yyreturn;
2338 #ifndef yyoverflow
2339 /*-------------------------------------------------.
2340 | yyexhaustedlab -- memory exhaustion comes here. |
2341 `-------------------------------------------------*/
2342 yyexhaustedlab:
2343 yyerror (scanner, YY_("memory exhausted"));
2344 yyresult = 2;
2345 /* Fall through. */
2346 #endif
2348 yyreturn:
2349 if (yychar != YYEOF && yychar != YYEMPTY)
2350 yydestruct ("Cleanup: discarding lookahead",
2351 yytoken, &yylval, scanner);
2352 /* Do not reclaim the symbols of the rule which action triggered
2353 this YYABORT or YYACCEPT. */
2354 YYPOPSTACK (yylen);
2355 YY_STACK_PRINT (yyss, yyssp);
2356 while (yyssp != yyss)
2358 yydestruct ("Cleanup: popping",
2359 yystos[*yyssp], yyvsp, scanner);
2360 YYPOPSTACK (1);
2362 #ifndef yyoverflow
2363 if (yyss != yyssa)
2364 YYSTACK_FREE (yyss);
2365 #endif
2366 #if YYERROR_VERBOSE
2367 if (yymsg != yymsgbuf)
2368 YYSTACK_FREE (yymsg);
2369 #endif
2370 /* Make sure YYID is used. */
2371 return YYID (yyresult);
2375 #line 537 "parser.y"
2378 static t_selexpr_value *
2379 process_value_list(t_selexpr_value *values, int *nr)
2381 t_selexpr_value *val, *pval, *nval;
2383 /* Count values (if needed) and reverse list */
2384 if (nr)
2386 *nr = 0;
2388 pval = NULL;
2389 val = values;
2390 while (val)
2392 if (nr)
2394 ++*nr;
2396 nval = val->next;
2397 val->next = pval;
2398 pval = val;
2399 val = nval;
2401 values = pval;
2403 return values;
2406 static t_selexpr_param *
2407 process_param_list(t_selexpr_param *params)
2409 t_selexpr_param *par, *ppar, *npar;
2411 /* Reverse list */
2412 ppar = NULL;
2413 par = params;
2414 while (par)
2416 npar = par->next;
2417 par->next = ppar;
2418 ppar = par;
2419 par = npar;
2421 params = ppar;
2423 return params;
2426 static void
2427 yyerror(yyscan_t scanner, char const *s)
2429 _gmx_selparser_error("%s", s);