Merge branch 'master' of git://git.gromacs.org/gromacs
[gromacs/adressmacs.git] / src / gmxlib / selection / parser.c
blob3e57a98218e146464191d14b3073035b2f722fbc
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,
109 NUM_REDUCT = 290
111 #endif
112 /* Tokens. */
113 #define INVALID 258
114 #define HELP 259
115 #define HELP_TOPIC 260
116 #define TOK_INT 261
117 #define TOK_REAL 262
118 #define STR 263
119 #define IDENTIFIER 264
120 #define CMD_SEP 265
121 #define GROUP 266
122 #define TO 267
123 #define VARIABLE_NUMERIC 268
124 #define VARIABLE_GROUP 269
125 #define VARIABLE_POS 270
126 #define KEYWORD_NUMERIC 271
127 #define KEYWORD_STR 272
128 #define KEYWORD_POS 273
129 #define KEYWORD_GROUP 274
130 #define METHOD_NUMERIC 275
131 #define METHOD_GROUP 276
132 #define METHOD_POS 277
133 #define MODIFIER 278
134 #define EMPTY_POSMOD 279
135 #define PARAM 280
136 #define END_OF_METHOD 281
137 #define OF 282
138 #define CMP_OP 283
139 #define PARAM_REDUCT 284
140 #define XOR 285
141 #define OR 286
142 #define AND 287
143 #define NOT 288
144 #define UNARY_NEG 289
145 #define NUM_REDUCT 290
150 /* Copy the first part of user declarations. */
151 #line 34 "parser.y"
153 /*! \internal \file parser.c
154 * \brief Generated (from parser.y by Bison) parser for the selection language.
156 /*! \internal \file parser.h
157 * \brief Generated (from parser.y by Bison) parser include file.
159 #ifdef HAVE_CONFIG_H
160 #include <config.h>
161 #endif
164 #include <string2.h>
166 #include "parsetree.h"
167 #include "selelem.h"
169 #include "scanner.h"
171 static t_selexpr_value *
172 process_value_list(t_selexpr_value *values, int *nr);
173 static t_selexpr_param *
174 process_param_list(t_selexpr_param *params);
176 static void
177 yyerror(yyscan_t, char const *s);
180 /* Enabling traces. */
181 #ifndef YYDEBUG
182 # define YYDEBUG 1
183 #endif
185 /* Enabling verbose error messages. */
186 #ifdef YYERROR_VERBOSE
187 # undef YYERROR_VERBOSE
188 # define YYERROR_VERBOSE 1
189 #else
190 # define YYERROR_VERBOSE 0
191 #endif
193 /* Enabling the token table. */
194 #ifndef YYTOKEN_TABLE
195 # define YYTOKEN_TABLE 0
196 #endif
198 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
199 typedef union YYSTYPE
200 #line 62 "parser.y"
202 int i;
203 real r;
204 char *str;
205 struct gmx_ana_selmethod_t *meth;
207 struct t_selelem *sel;
209 struct t_selexpr_value *val;
210 struct t_selexpr_param *param;
212 /* Line 187 of yacc.c. */
213 #line 214 "parser.c"
214 YYSTYPE;
215 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
216 # define YYSTYPE_IS_DECLARED 1
217 # define YYSTYPE_IS_TRIVIAL 1
218 #endif
222 /* Copy the second part of user declarations. */
225 /* Line 216 of yacc.c. */
226 #line 227 "parser.c"
228 #ifdef short
229 # undef short
230 #endif
232 #ifdef YYTYPE_UINT8
233 typedef YYTYPE_UINT8 yytype_uint8;
234 #else
235 typedef unsigned char yytype_uint8;
236 #endif
238 #ifdef YYTYPE_INT8
239 typedef YYTYPE_INT8 yytype_int8;
240 #elif (defined __STDC__ || defined __C99__FUNC__ \
241 || defined __cplusplus || defined _MSC_VER)
242 typedef signed char yytype_int8;
243 #else
244 typedef short int yytype_int8;
245 #endif
247 #ifdef YYTYPE_UINT16
248 typedef YYTYPE_UINT16 yytype_uint16;
249 #else
250 typedef unsigned short int yytype_uint16;
251 #endif
253 #ifdef YYTYPE_INT16
254 typedef YYTYPE_INT16 yytype_int16;
255 #else
256 typedef short int yytype_int16;
257 #endif
259 #ifndef YYSIZE_T
260 # ifdef __SIZE_TYPE__
261 # define YYSIZE_T __SIZE_TYPE__
262 # elif defined size_t
263 # define YYSIZE_T size_t
264 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
265 || defined __cplusplus || defined _MSC_VER)
266 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
267 # define YYSIZE_T size_t
268 # else
269 # define YYSIZE_T unsigned int
270 # endif
271 #endif
273 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
275 #ifndef YY_
276 # if YYENABLE_NLS
277 # if ENABLE_NLS
278 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
279 # define YY_(msgid) dgettext ("bison-runtime", msgid)
280 # endif
281 # endif
282 # ifndef YY_
283 # define YY_(msgid) msgid
284 # endif
285 #endif
287 /* Suppress unused-variable warnings by "using" E. */
288 #if ! defined lint || defined __GNUC__
289 # define YYUSE(e) ((void) (e))
290 #else
291 # define YYUSE(e) /* empty */
292 #endif
294 /* Identity function, used to suppress warnings about constant conditions. */
295 #ifndef lint
296 # define YYID(n) (n)
297 #else
298 #if (defined __STDC__ || defined __C99__FUNC__ \
299 || defined __cplusplus || defined _MSC_VER)
300 static int
301 YYID (int i)
302 #else
303 static int
304 YYID (i)
305 int i;
306 #endif
308 return i;
310 #endif
312 #if ! defined yyoverflow || YYERROR_VERBOSE
314 /* The parser invokes alloca or malloc; define the necessary symbols. */
316 # ifdef YYSTACK_USE_ALLOCA
317 # if YYSTACK_USE_ALLOCA
318 # ifdef __GNUC__
319 # define YYSTACK_ALLOC __builtin_alloca
320 # elif defined __BUILTIN_VA_ARG_INCR
321 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
322 # elif defined _AIX
323 # define YYSTACK_ALLOC __alloca
324 # elif defined _MSC_VER
325 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
326 # define alloca _alloca
327 # else
328 # define YYSTACK_ALLOC alloca
329 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
330 || defined __cplusplus || defined _MSC_VER)
331 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
332 # ifndef _STDLIB_H
333 # define _STDLIB_H 1
334 # endif
335 # endif
336 # endif
337 # endif
338 # endif
340 # ifdef YYSTACK_ALLOC
341 /* Pacify GCC's `empty if-body' warning. */
342 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
343 # ifndef YYSTACK_ALLOC_MAXIMUM
344 /* The OS might guarantee only one guard page at the bottom of the stack,
345 and a page size can be as small as 4096 bytes. So we cannot safely
346 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
347 to allow for a few compiler-allocated temporary stack slots. */
348 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
349 # endif
350 # else
351 # define YYSTACK_ALLOC YYMALLOC
352 # define YYSTACK_FREE YYFREE
353 # ifndef YYSTACK_ALLOC_MAXIMUM
354 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
355 # endif
356 # if (defined __cplusplus && ! defined _STDLIB_H \
357 && ! ((defined YYMALLOC || defined malloc) \
358 && (defined YYFREE || defined free)))
359 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
360 # ifndef _STDLIB_H
361 # define _STDLIB_H 1
362 # endif
363 # endif
364 # ifndef YYMALLOC
365 # define YYMALLOC malloc
366 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
367 || defined __cplusplus || defined _MSC_VER)
368 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
369 # endif
370 # endif
371 # ifndef YYFREE
372 # define YYFREE free
373 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
374 || defined __cplusplus || defined _MSC_VER)
375 void free (void *); /* INFRINGES ON USER NAME SPACE */
376 # endif
377 # endif
378 # endif
379 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
382 #if (! defined yyoverflow \
383 && (! defined __cplusplus \
384 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
386 /* A type that is properly aligned for any stack member. */
387 union yyalloc
389 yytype_int16 yyss;
390 YYSTYPE yyvs;
393 /* The size of the maximum gap between one aligned stack and the next. */
394 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
396 /* The size of an array large to enough to hold all stacks, each with
397 N elements. */
398 # define YYSTACK_BYTES(N) \
399 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
400 + YYSTACK_GAP_MAXIMUM)
402 /* Copy COUNT objects from FROM to TO. The source and destination do
403 not overlap. */
404 # ifndef YYCOPY
405 # if defined __GNUC__ && 1 < __GNUC__
406 # define YYCOPY(To, From, Count) \
407 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
408 # else
409 # define YYCOPY(To, From, Count) \
410 do \
412 YYSIZE_T yyi; \
413 for (yyi = 0; yyi < (Count); yyi++) \
414 (To)[yyi] = (From)[yyi]; \
416 while (YYID (0))
417 # endif
418 # endif
420 /* Relocate STACK from its old location to the new one. The
421 local variables YYSIZE and YYSTACKSIZE give the old and new number of
422 elements in the stack, and YYPTR gives the new location of the
423 stack. Advance YYPTR to a properly aligned location for the next
424 stack. */
425 # define YYSTACK_RELOCATE(Stack) \
426 do \
428 YYSIZE_T yynewbytes; \
429 YYCOPY (&yyptr->Stack, Stack, yysize); \
430 Stack = &yyptr->Stack; \
431 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
432 yyptr += yynewbytes / sizeof (*yyptr); \
434 while (YYID (0))
436 #endif
438 /* YYFINAL -- State number of the termination state. */
439 #define YYFINAL 2
440 /* YYLAST -- Last index in YYTABLE. */
441 #define YYLAST 417
443 /* YYNTOKENS -- Number of terminals. */
444 #define YYNTOKENS 49
445 /* YYNNTS -- Number of nonterminals. */
446 #define YYNNTS 26
447 /* YYNRULES -- Number of rules. */
448 #define YYNRULES 91
449 /* YYNRULES -- Number of states. */
450 #define YYNSTATES 150
452 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
453 #define YYUNDEFTOK 2
454 #define YYMAXUTOK 290
456 #define YYTRANSLATE(YYX) \
457 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
459 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
460 static const yytype_uint8 yytranslate[] =
462 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 42, 43, 36, 34, 45, 35, 2, 37, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 41, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 44, 2, 46, 39, 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, 47, 2, 48, 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, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
488 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
489 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
490 25, 26, 27, 28, 29, 30, 31, 32, 33, 38,
494 #if YYDEBUG
495 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
496 YYRHS. */
497 static const yytype_uint16 yyprhs[] =
499 0, 0, 3, 4, 7, 10, 13, 14, 16, 18,
500 20, 22, 25, 29, 33, 37, 39, 41, 44, 47,
501 49, 51, 55, 59, 61, 64, 66, 69, 71, 73,
502 75, 77, 80, 84, 88, 92, 96, 99, 102, 104,
503 106, 109, 113, 117, 121, 123, 125, 128, 132, 136,
504 140, 144, 148, 151, 155, 159, 161, 164, 172, 176,
505 179, 183, 185, 187, 189, 191, 194, 195, 198, 201,
506 202, 204, 208, 210, 213, 217, 219, 223, 225, 228,
507 232, 234, 236, 238, 240, 242, 244, 246, 248, 250,
508 254, 258
511 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
512 static const yytype_int8 yyrhs[] =
514 50, 0, -1, -1, 50, 51, -1, 52, 10, -1,
515 1, 10, -1, -1, 53, -1, 6, -1, 59, -1,
516 55, -1, 59, 55, -1, 9, 41, 60, -1, 9,
517 41, 62, -1, 9, 41, 64, -1, 4, -1, 54,
518 -1, 4, 5, -1, 54, 5, -1, 64, -1, 60,
519 -1, 42, 55, 43, -1, 55, 23, 65, -1, 6,
520 -1, 35, 6, -1, 7, -1, 35, 7, -1, 56,
521 -1, 57, -1, 8, -1, 9, -1, 33, 60, -1,
522 60, 32, 60, -1, 60, 31, 60, -1, 42, 60,
523 43, -1, 62, 28, 62, -1, 11, 59, -1, 11,
524 6, -1, 24, -1, 18, -1, 61, 19, -1, 61,
525 17, 70, -1, 61, 16, 70, -1, 61, 21, 65,
526 -1, 6, -1, 7, -1, 61, 16, -1, 61, 20,
527 65, -1, 62, 34, 62, -1, 62, 35, 62, -1,
528 62, 36, 62, -1, 62, 37, 62, -1, 35, 62,
529 -1, 62, 39, 62, -1, 42, 62, 43, -1, 59,
530 -1, 61, 17, -1, 44, 58, 45, 58, 45, 58,
531 46, -1, 42, 64, 43, -1, 22, 65, -1, 18,
532 27, 60, -1, 14, -1, 13, -1, 15, -1, 66,
533 -1, 66, 26, -1, -1, 66, 67, -1, 25, 68,
534 -1, -1, 69, -1, 47, 69, 48, -1, 72, -1,
535 69, 72, -1, 69, 45, 72, -1, 71, -1, 47,
536 71, 48, -1, 73, -1, 71, 73, -1, 71, 45,
537 73, -1, 60, -1, 64, -1, 62, -1, 63, -1,
538 74, -1, 56, -1, 57, -1, 59, -1, 74, -1,
539 56, 12, 56, -1, 56, 12, 57, -1, 57, 12,
540 58, -1
543 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
544 static const yytype_uint16 yyrline[] =
546 0, 182, 182, 183, 192, 193, 213, 217, 218, 227,
547 237, 239, 241, 243, 245, 251, 252, 255, 256, 260,
548 261, 266, 267, 279, 280, 284, 285, 288, 289, 292,
549 293, 301, 307, 313, 325, 329, 337, 343, 351, 352,
550 356, 361, 366, 374, 386, 393, 403, 408, 416, 418,
551 420, 422, 424, 426, 428, 435, 442, 454, 459, 463,
552 471, 482, 486, 490, 499, 501, 506, 507, 512, 519,
553 520, 521, 525, 526, 528, 533, 534, 538, 539, 541,
554 545, 547, 549, 551, 553, 557, 562, 567, 572, 576,
555 581, 586
557 #endif
559 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
560 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
561 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
562 static const char *const yytname[] =
564 "$end", "error", "$undefined", "INVALID", "HELP", "HELP_TOPIC",
565 "TOK_INT", "TOK_REAL", "STR", "IDENTIFIER", "CMD_SEP", "GROUP", "TO",
566 "VARIABLE_NUMERIC", "VARIABLE_GROUP", "VARIABLE_POS", "KEYWORD_NUMERIC",
567 "KEYWORD_STR", "KEYWORD_POS", "KEYWORD_GROUP", "METHOD_NUMERIC",
568 "METHOD_GROUP", "METHOD_POS", "MODIFIER", "EMPTY_POSMOD", "PARAM",
569 "END_OF_METHOD", "OF", "CMP_OP", "PARAM_REDUCT", "XOR", "OR", "AND",
570 "NOT", "'+'", "'-'", "'*'", "'/'", "UNARY_NEG", "'^'", "NUM_REDUCT",
571 "'='", "'('", "')'", "'['", "','", "']'", "'{'", "'}'", "$accept",
572 "commands", "command", "cmd_plain", "help_request", "help_topic",
573 "selection", "integer_number", "real_number", "number", "string",
574 "sel_expr", "pos_mod", "num_expr", "str_expr", "pos_expr",
575 "method_params", "method_param_list", "method_param", "value_list",
576 "value_list_contents", "basic_value_list", "basic_value_list_contents",
577 "value_item", "basic_value_item", "value_item_range", 0
579 #endif
581 # ifdef YYPRINT
582 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
583 token YYLEX-NUM. */
584 static const yytype_uint16 yytoknum[] =
586 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
587 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
588 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
589 285, 286, 287, 288, 43, 45, 42, 47, 289, 94,
590 290, 61, 40, 41, 91, 44, 93, 123, 125
592 # endif
594 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
595 static const yytype_uint8 yyr1[] =
597 0, 49, 50, 50, 51, 51, 52, 52, 52, 52,
598 52, 52, 52, 52, 52, 53, 53, 54, 54, 55,
599 55, 55, 55, 56, 56, 57, 57, 58, 58, 59,
600 59, 60, 60, 60, 60, 60, 60, 60, 61, 61,
601 60, 60, 60, 60, 62, 62, 62, 62, 62, 62,
602 62, 62, 62, 62, 62, 63, 63, 64, 64, 64,
603 64, 60, 62, 64, 65, 65, 66, 66, 67, 68,
604 68, 68, 69, 69, 69, 70, 70, 71, 71, 71,
605 72, 72, 72, 72, 72, 73, 73, 73, 73, 74,
606 74, 74
609 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
610 static const yytype_uint8 yyr2[] =
612 0, 2, 0, 2, 2, 2, 0, 1, 1, 1,
613 1, 2, 3, 3, 3, 1, 1, 2, 2, 1,
614 1, 3, 3, 1, 2, 1, 2, 1, 1, 1,
615 1, 2, 3, 3, 3, 3, 2, 2, 1, 1,
616 2, 3, 3, 3, 1, 1, 2, 3, 3, 3,
617 3, 3, 2, 3, 3, 1, 2, 7, 3, 2,
618 3, 1, 1, 1, 1, 2, 0, 2, 2, 0,
619 1, 3, 1, 2, 3, 1, 3, 1, 2, 3,
620 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
621 3, 3
624 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
625 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
626 means the default is an error. */
627 static const yytype_uint8 yydefact[] =
629 2, 0, 1, 0, 15, 44, 45, 29, 30, 0,
630 62, 61, 63, 39, 66, 38, 0, 0, 0, 0,
631 3, 0, 7, 16, 10, 9, 20, 0, 0, 19,
632 5, 17, 0, 37, 30, 36, 0, 59, 64, 44,
633 39, 0, 31, 0, 0, 52, 0, 20, 0, 19,
634 23, 25, 0, 27, 28, 0, 4, 18, 66, 11,
635 0, 0, 46, 0, 40, 66, 66, 0, 0, 0,
636 0, 0, 0, 0, 12, 13, 14, 60, 69, 65,
637 67, 0, 0, 46, 21, 34, 54, 58, 24, 26,
638 0, 22, 33, 32, 0, 85, 86, 87, 42, 75,
639 77, 88, 41, 47, 43, 35, 48, 49, 50, 51,
640 53, 0, 44, 45, 0, 0, 0, 0, 55, 80,
641 0, 82, 83, 81, 68, 70, 72, 84, 0, 0,
642 0, 0, 0, 78, 44, 45, 0, 56, 0, 73,
643 0, 76, 89, 90, 91, 79, 71, 74, 0, 57
646 /* YYDEFGOTO[NTERM-NUM]. */
647 static const yytype_int8 yydefgoto[] =
649 -1, 1, 20, 21, 22, 23, 24, 95, 96, 55,
650 97, 119, 27, 28, 122, 123, 37, 38, 80, 124,
651 125, 102, 99, 126, 100, 101
654 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
655 STATE-NUM. */
656 #define YYPACT_NINF -93
657 static const yytype_int16 yypact[] =
659 -93, 155, -93, 10, 19, 26, -93, -93, -3, 73,
660 -93, -93, -93, 22, -93, -93, 356, 372, 317, 11,
661 -93, 79, -93, 86, 70, 317, 29, 384, 180, -93,
662 -93, -93, 342, -93, -93, -93, 356, -93, 6, -93,
663 -93, 356, -93, 372, -10, 57, -20, -17, 256, 54,
664 -93, -93, 88, -93, -93, 55, -93, -93, -93, 70,
665 356, 356, 197, 174, -93, -93, -93, 372, 372, 372,
666 372, 372, 372, 342, 29, 180, -93, 29, 221, -93,
667 -93, -17, 223, -93, -93, -93, -93, -93, -93, -93,
668 11, -93, 69, -93, 78, 90, 94, -93, -93, 244,
669 -93, -93, -93, -93, -93, 267, 36, 36, 57, 57,
670 57, 54, 95, 96, 375, 303, 90, 94, -93, 29,
671 392, 267, -93, -93, -93, 263, -93, -93, 71, 35,
672 11, 11, 78, -93, 105, 106, 178, 174, 303, -93,
673 11, -93, -93, -93, -93, -93, -93, -93, 80, -93
676 /* YYPGOTO[NTERM-NUM]. */
677 static const yytype_int8 yypgoto[] =
679 -93, -93, -93, -93, -93, -93, -13, 0, 14, -81,
680 -1, 87, -4, -16, -93, 3, -36, -93, -93, -93,
681 12, 81, 39, -91, -92, -67
684 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
685 positive, shift that token. If negative, reduce the rule which
686 number is the opposite. If zero, do what YYDEFACT says.
687 If YYTABLE_NINF, syntax error. */
688 #define YYTABLE_NINF -27
689 static const yytype_int16 yytable[] =
691 25, 45, 48, 58, 29, 46, 83, 133, 35, 128,
692 65, 127, 59, 44, 60, 61, 75, 50, 51, 53,
693 30, 49, 91, 84, 31, 48, 85, 82, 29, 103,
694 104, 78, 79, 54, 139, 76, -8, 133, 32, 44,
695 145, 50, 51, 7, 34, 139, 52, 147, 127, 36,
696 144, 105, 106, 107, 108, 109, 110, 48, 127, 148,
697 60, 61, 121, 44, 44, 44, 44, 44, 44, 127,
698 52, 127, 70, 71, 120, 72, 111, 118, 116, 33,
699 132, 7, 34, 141, 50, 51, 7, 34, 26, 56,
700 53, 57, 117, 58, 88, 89, 72, 87, 45, 121,
701 90, 61, 130, 42, 54, 47, 131, -23, -25, 121,
702 44, 120, 26, 52, 118, 116, 140, -24, -26, 74,
703 121, 120, 121, 77, 118, 116, 149, 136, 81, 117,
704 142, 53, 120, 129, 120, 118, 116, 118, 116, 117,
705 53, 0, 0, 98, 143, 54, 0, 92, 93, 0,
706 117, 0, 117, 0, 54, 2, 3, 0, 0, 4,
707 81, 5, 6, 7, 8, -6, 9, 0, 10, 11,
708 12, 0, 0, 13, 0, 0, 0, 14, 0, 15,
709 50, 51, 7, 34, 112, 113, 7, 34, 16, 9,
710 17, 10, 11, 12, 0, 0, 13, 18, 0, 19,
711 14, 0, 15, 50, 51, 7, 34, 0, 67, 52,
712 0, 16, 0, 114, 68, 69, 70, 71, 0, 72,
713 73, 94, 19, 138, 0, 0, 146, 112, 113, 7,
714 34, 0, 9, 0, 10, 11, 12, 0, 0, 13,
715 0, 0, 0, 14, 94, 15, 0, 0, 0, 0,
716 50, 51, 7, 34, 16, 0, 114, 68, 69, 70,
717 71, 0, 72, 73, 0, 19, 86, 0, 115, 112,
718 113, 7, 34, 0, 9, 0, 10, 11, 12, 52,
719 0, 13, 0, 0, 67, 14, 0, 15, 0, 132,
720 68, 69, 70, 71, 0, 72, 16, 0, 114, 86,
721 0, 68, 69, 70, 71, 73, 72, 19, 138, 112,
722 113, 7, 34, 0, 9, 0, 10, 11, 12, 0,
723 0, 13, 0, 39, 6, 14, 0, 15, 9, 0,
724 10, 11, 12, 0, 0, 13, 16, 0, 114, 14,
725 0, 15, 0, 0, 0, 73, 0, 19, 39, 6,
726 16, 0, 17, 9, 0, 10, 11, 12, 0, 18,
727 13, 19, 39, 6, 14, 0, 15, 9, 0, 10,
728 11, 0, 0, 0, 40, 16, 0, 17, 39, 6,
729 15, 134, 135, 0, 73, 10, 19, 0, 10, 16,
730 40, 17, 0, 40, 0, 0, 15, 0, 41, 15,
731 62, 63, 0, 64, 65, 66, 0, 17, 62, 137,
732 17, 64, 65, 66, 43, 0, 0, 43
735 static const yytype_int16 yycheck[] =
737 1, 17, 18, 23, 1, 18, 16, 99, 9, 90,
738 20, 78, 25, 17, 31, 32, 32, 6, 7, 19,
739 10, 18, 58, 43, 5, 41, 43, 43, 25, 65,
740 66, 25, 26, 19, 125, 32, 10, 129, 41, 43,
741 132, 6, 7, 8, 9, 136, 35, 138, 115, 27,
742 131, 67, 68, 69, 70, 71, 72, 73, 125, 140,
743 31, 32, 78, 67, 68, 69, 70, 71, 72, 136,
744 35, 138, 36, 37, 78, 39, 73, 78, 78, 6,
745 45, 8, 9, 48, 6, 7, 8, 9, 1, 10,
746 90, 5, 78, 23, 6, 7, 39, 43, 114, 115,
747 45, 32, 12, 16, 90, 18, 12, 12, 12, 125,
748 114, 115, 25, 35, 115, 115, 45, 12, 12, 32,
749 136, 125, 138, 36, 125, 125, 46, 115, 41, 115,
750 130, 131, 136, 94, 138, 136, 136, 138, 138, 125,
751 140, -1, -1, 62, 130, 131, -1, 60, 61, -1,
752 136, -1, 138, -1, 140, 0, 1, -1, -1, 4,
753 73, 6, 7, 8, 9, 10, 11, -1, 13, 14,
754 15, -1, -1, 18, -1, -1, -1, 22, -1, 24,
755 6, 7, 8, 9, 6, 7, 8, 9, 33, 11,
756 35, 13, 14, 15, -1, -1, 18, 42, -1, 44,
757 22, -1, 24, 6, 7, 8, 9, -1, 28, 35,
758 -1, 33, -1, 35, 34, 35, 36, 37, -1, 39,
759 42, 47, 44, 45, -1, -1, 48, 6, 7, 8,
760 9, -1, 11, -1, 13, 14, 15, -1, -1, 18,
761 -1, -1, -1, 22, 47, 24, -1, -1, -1, -1,
762 6, 7, 8, 9, 33, -1, 35, 34, 35, 36,
763 37, -1, 39, 42, -1, 44, 43, -1, 47, 6,
764 7, 8, 9, -1, 11, -1, 13, 14, 15, 35,
765 -1, 18, -1, -1, 28, 22, -1, 24, -1, 45,
766 34, 35, 36, 37, -1, 39, 33, -1, 35, 43,
767 -1, 34, 35, 36, 37, 42, 39, 44, 45, 6,
768 7, 8, 9, -1, 11, -1, 13, 14, 15, -1,
769 -1, 18, -1, 6, 7, 22, -1, 24, 11, -1,
770 13, 14, 15, -1, -1, 18, 33, -1, 35, 22,
771 -1, 24, -1, -1, -1, 42, -1, 44, 6, 7,
772 33, -1, 35, 11, -1, 13, 14, 15, -1, 42,
773 18, 44, 6, 7, 22, -1, 24, 11, -1, 13,
774 14, -1, -1, -1, 18, 33, -1, 35, 6, 7,
775 24, 6, 7, -1, 42, 13, 44, -1, 13, 33,
776 18, 35, -1, 18, -1, -1, 24, -1, 42, 24,
777 16, 17, -1, 19, 20, 21, -1, 35, 16, 17,
778 35, 19, 20, 21, 42, -1, -1, 42
781 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
782 symbol of state STATE-NUM. */
783 static const yytype_uint8 yystos[] =
785 0, 50, 0, 1, 4, 6, 7, 8, 9, 11,
786 13, 14, 15, 18, 22, 24, 33, 35, 42, 44,
787 51, 52, 53, 54, 55, 59, 60, 61, 62, 64,
788 10, 5, 41, 6, 9, 59, 27, 65, 66, 6,
789 18, 42, 60, 42, 61, 62, 55, 60, 62, 64,
790 6, 7, 35, 56, 57, 58, 10, 5, 23, 55,
791 31, 32, 16, 17, 19, 20, 21, 28, 34, 35,
792 36, 37, 39, 42, 60, 62, 64, 60, 25, 26,
793 67, 60, 62, 16, 43, 43, 43, 43, 6, 7,
794 45, 65, 60, 60, 47, 56, 57, 59, 70, 71,
795 73, 74, 70, 65, 65, 62, 62, 62, 62, 62,
796 62, 64, 6, 7, 35, 47, 56, 57, 59, 60,
797 61, 62, 63, 64, 68, 69, 72, 74, 58, 71,
798 12, 12, 45, 73, 6, 7, 69, 17, 45, 72,
799 45, 48, 56, 57, 58, 73, 48, 72, 58, 46
802 #define yyerrok (yyerrstatus = 0)
803 #define yyclearin (yychar = YYEMPTY)
804 #define YYEMPTY (-2)
805 #define YYEOF 0
807 #define YYACCEPT goto yyacceptlab
808 #define YYABORT goto yyabortlab
809 #define YYERROR goto yyerrorlab
812 /* Like YYERROR except do call yyerror. This remains here temporarily
813 to ease the transition to the new meaning of YYERROR, for GCC.
814 Once GCC version 2 has supplanted version 1, this can go. */
816 #define YYFAIL goto yyerrlab
818 #define YYRECOVERING() (!!yyerrstatus)
820 #define YYBACKUP(Token, Value) \
821 do \
822 if (yychar == YYEMPTY && yylen == 1) \
824 yychar = (Token); \
825 yylval = (Value); \
826 yytoken = YYTRANSLATE (yychar); \
827 YYPOPSTACK (1); \
828 goto yybackup; \
830 else \
832 yyerror (scanner, YY_("syntax error: cannot back up")); \
833 YYERROR; \
835 while (YYID (0))
838 #define YYTERROR 1
839 #define YYERRCODE 256
842 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
843 If N is 0, then set CURRENT to the empty location which ends
844 the previous symbol: RHS[0] (always defined). */
846 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
847 #ifndef YYLLOC_DEFAULT
848 # define YYLLOC_DEFAULT(Current, Rhs, N) \
849 do \
850 if (YYID (N)) \
852 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
853 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
854 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
855 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
857 else \
859 (Current).first_line = (Current).last_line = \
860 YYRHSLOC (Rhs, 0).last_line; \
861 (Current).first_column = (Current).last_column = \
862 YYRHSLOC (Rhs, 0).last_column; \
864 while (YYID (0))
865 #endif
868 /* YY_LOCATION_PRINT -- Print the location on the stream.
869 This macro was not mandated originally: define only if we know
870 we won't break user code: when these are the locations we know. */
872 #ifndef YY_LOCATION_PRINT
873 # if YYLTYPE_IS_TRIVIAL
874 # define YY_LOCATION_PRINT(File, Loc) \
875 fprintf (File, "%d.%d-%d.%d", \
876 (Loc).first_line, (Loc).first_column, \
877 (Loc).last_line, (Loc).last_column)
878 # else
879 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
880 # endif
881 #endif
884 /* YYLEX -- calling `yylex' with the right arguments. */
886 #ifdef YYLEX_PARAM
887 # define YYLEX yylex (&yylval, YYLEX_PARAM)
888 #else
889 # define YYLEX yylex (&yylval, scanner)
890 #endif
892 /* Enable debugging if requested. */
893 #if YYDEBUG
895 # ifndef YYFPRINTF
896 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
897 # define YYFPRINTF fprintf
898 # endif
900 # define YYDPRINTF(Args) \
901 do { \
902 if (yydebug) \
903 YYFPRINTF Args; \
904 } while (YYID (0))
906 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
907 do { \
908 if (yydebug) \
910 YYFPRINTF (stderr, "%s ", Title); \
911 yy_symbol_print (stderr, \
912 Type, Value, scanner); \
913 YYFPRINTF (stderr, "\n"); \
915 } while (YYID (0))
918 /*--------------------------------.
919 | Print this symbol on YYOUTPUT. |
920 `--------------------------------*/
922 /*ARGSUSED*/
923 #if (defined __STDC__ || defined __C99__FUNC__ \
924 || defined __cplusplus || defined _MSC_VER)
925 static void
926 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t scanner)
927 #else
928 static void
929 yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner)
930 FILE *yyoutput;
931 int yytype;
932 YYSTYPE const * const yyvaluep;
933 yyscan_t scanner;
934 #endif
936 if (!yyvaluep)
937 return;
938 YYUSE (scanner);
939 # ifdef YYPRINT
940 if (yytype < YYNTOKENS)
941 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
942 # else
943 YYUSE (yyoutput);
944 # endif
945 switch (yytype)
947 default:
948 break;
953 /*--------------------------------.
954 | Print this symbol on YYOUTPUT. |
955 `--------------------------------*/
957 #if (defined __STDC__ || defined __C99__FUNC__ \
958 || defined __cplusplus || defined _MSC_VER)
959 static void
960 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t scanner)
961 #else
962 static void
963 yy_symbol_print (yyoutput, yytype, yyvaluep, scanner)
964 FILE *yyoutput;
965 int yytype;
966 YYSTYPE const * const yyvaluep;
967 yyscan_t scanner;
968 #endif
970 if (yytype < YYNTOKENS)
971 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
972 else
973 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
975 yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner);
976 YYFPRINTF (yyoutput, ")");
979 /*------------------------------------------------------------------.
980 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
981 | TOP (included). |
982 `------------------------------------------------------------------*/
984 #if (defined __STDC__ || defined __C99__FUNC__ \
985 || defined __cplusplus || defined _MSC_VER)
986 static void
987 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
988 #else
989 static void
990 yy_stack_print (bottom, top)
991 yytype_int16 *bottom;
992 yytype_int16 *top;
993 #endif
995 YYFPRINTF (stderr, "Stack now");
996 for (; bottom <= top; ++bottom)
997 YYFPRINTF (stderr, " %d", *bottom);
998 YYFPRINTF (stderr, "\n");
1001 # define YY_STACK_PRINT(Bottom, Top) \
1002 do { \
1003 if (yydebug) \
1004 yy_stack_print ((Bottom), (Top)); \
1005 } while (YYID (0))
1008 /*------------------------------------------------.
1009 | Report that the YYRULE is going to be reduced. |
1010 `------------------------------------------------*/
1012 #if (defined __STDC__ || defined __C99__FUNC__ \
1013 || defined __cplusplus || defined _MSC_VER)
1014 static void
1015 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, yyscan_t scanner)
1016 #else
1017 static void
1018 yy_reduce_print (yyvsp, yyrule, scanner)
1019 YYSTYPE *yyvsp;
1020 int yyrule;
1021 yyscan_t scanner;
1022 #endif
1024 int yynrhs = yyr2[yyrule];
1025 int yyi;
1026 unsigned long int yylno = yyrline[yyrule];
1027 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1028 yyrule - 1, yylno);
1029 /* The symbols being reduced. */
1030 for (yyi = 0; yyi < yynrhs; yyi++)
1032 fprintf (stderr, " $%d = ", yyi + 1);
1033 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1034 &(yyvsp[(yyi + 1) - (yynrhs)])
1035 , scanner);
1036 fprintf (stderr, "\n");
1040 # define YY_REDUCE_PRINT(Rule) \
1041 do { \
1042 if (yydebug) \
1043 yy_reduce_print (yyvsp, Rule, scanner); \
1044 } while (YYID (0))
1046 /* Nonzero means print parse trace. It is left uninitialized so that
1047 multiple parsers can coexist. */
1048 int yydebug;
1049 #else /* !YYDEBUG */
1050 # define YYDPRINTF(Args)
1051 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1052 # define YY_STACK_PRINT(Bottom, Top)
1053 # define YY_REDUCE_PRINT(Rule)
1054 #endif /* !YYDEBUG */
1057 /* YYINITDEPTH -- initial size of the parser's stacks. */
1058 #ifndef YYINITDEPTH
1059 # define YYINITDEPTH 200
1060 #endif
1062 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1063 if the built-in stack extension method is used).
1065 Do not make this value too large; the results are undefined if
1066 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1067 evaluated with infinite-precision integer arithmetic. */
1069 #ifndef YYMAXDEPTH
1070 # define YYMAXDEPTH 10000
1071 #endif
1075 #if YYERROR_VERBOSE
1077 # ifndef yystrlen
1078 # if defined __GLIBC__ && defined _STRING_H
1079 # define yystrlen strlen
1080 # else
1081 /* Return the length of YYSTR. */
1082 #if (defined __STDC__ || defined __C99__FUNC__ \
1083 || defined __cplusplus || defined _MSC_VER)
1084 static YYSIZE_T
1085 yystrlen (const char *yystr)
1086 #else
1087 static YYSIZE_T
1088 yystrlen (yystr)
1089 const char *yystr;
1090 #endif
1092 YYSIZE_T yylen;
1093 for (yylen = 0; yystr[yylen]; yylen++)
1094 continue;
1095 return yylen;
1097 # endif
1098 # endif
1100 # ifndef yystpcpy
1101 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1102 # define yystpcpy stpcpy
1103 # else
1104 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1105 YYDEST. */
1106 #if (defined __STDC__ || defined __C99__FUNC__ \
1107 || defined __cplusplus || defined _MSC_VER)
1108 static char *
1109 yystpcpy (char *yydest, const char *yysrc)
1110 #else
1111 static char *
1112 yystpcpy (yydest, yysrc)
1113 char *yydest;
1114 const char *yysrc;
1115 #endif
1117 char *yyd = yydest;
1118 const char *yys = yysrc;
1120 while ((*yyd++ = *yys++) != '\0')
1121 continue;
1123 return yyd - 1;
1125 # endif
1126 # endif
1128 # ifndef yytnamerr
1129 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1130 quotes and backslashes, so that it's suitable for yyerror. The
1131 heuristic is that double-quoting is unnecessary unless the string
1132 contains an apostrophe, a comma, or backslash (other than
1133 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1134 null, do not copy; instead, return the length of what the result
1135 would have been. */
1136 static YYSIZE_T
1137 yytnamerr (char *yyres, const char *yystr)
1139 if (*yystr == '"')
1141 YYSIZE_T yyn = 0;
1142 char const *yyp = yystr;
1144 for (;;)
1145 switch (*++yyp)
1147 case '\'':
1148 case ',':
1149 goto do_not_strip_quotes;
1151 case '\\':
1152 if (*++yyp != '\\')
1153 goto do_not_strip_quotes;
1154 /* Fall through. */
1155 default:
1156 if (yyres)
1157 yyres[yyn] = *yyp;
1158 yyn++;
1159 break;
1161 case '"':
1162 if (yyres)
1163 yyres[yyn] = '\0';
1164 return yyn;
1166 do_not_strip_quotes: ;
1169 if (! yyres)
1170 return yystrlen (yystr);
1172 return yystpcpy (yyres, yystr) - yyres;
1174 # endif
1176 /* Copy into YYRESULT an error message about the unexpected token
1177 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1178 including the terminating null byte. If YYRESULT is null, do not
1179 copy anything; just return the number of bytes that would be
1180 copied. As a special case, return 0 if an ordinary "syntax error"
1181 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1182 size calculation. */
1183 static YYSIZE_T
1184 yysyntax_error (char *yyresult, int yystate, int yychar)
1186 int yyn = yypact[yystate];
1188 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1189 return 0;
1190 else
1192 int yytype = YYTRANSLATE (yychar);
1193 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1194 YYSIZE_T yysize = yysize0;
1195 YYSIZE_T yysize1;
1196 int yysize_overflow = 0;
1197 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1198 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1199 int yyx;
1201 # if 0
1202 /* This is so xgettext sees the translatable formats that are
1203 constructed on the fly. */
1204 YY_("syntax error, unexpected %s");
1205 YY_("syntax error, unexpected %s, expecting %s");
1206 YY_("syntax error, unexpected %s, expecting %s or %s");
1207 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1208 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1209 # endif
1210 char *yyfmt;
1211 char const *yyf;
1212 static char const yyunexpected[] = "syntax error, unexpected %s";
1213 static char const yyexpecting[] = ", expecting %s";
1214 static char const yyor[] = " or %s";
1215 char yyformat[sizeof yyunexpected
1216 + sizeof yyexpecting - 1
1217 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1218 * (sizeof yyor - 1))];
1219 char const *yyprefix = yyexpecting;
1221 /* Start YYX at -YYN if negative to avoid negative indexes in
1222 YYCHECK. */
1223 int yyxbegin = yyn < 0 ? -yyn : 0;
1225 /* Stay within bounds of both yycheck and yytname. */
1226 int yychecklim = YYLAST - yyn + 1;
1227 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1228 int yycount = 1;
1230 yyarg[0] = yytname[yytype];
1231 yyfmt = yystpcpy (yyformat, yyunexpected);
1233 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1234 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1236 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1238 yycount = 1;
1239 yysize = yysize0;
1240 yyformat[sizeof yyunexpected - 1] = '\0';
1241 break;
1243 yyarg[yycount++] = yytname[yyx];
1244 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1245 yysize_overflow |= (yysize1 < yysize);
1246 yysize = yysize1;
1247 yyfmt = yystpcpy (yyfmt, yyprefix);
1248 yyprefix = yyor;
1251 yyf = YY_(yyformat);
1252 yysize1 = yysize + yystrlen (yyf);
1253 yysize_overflow |= (yysize1 < yysize);
1254 yysize = yysize1;
1256 if (yysize_overflow)
1257 return YYSIZE_MAXIMUM;
1259 if (yyresult)
1261 /* Avoid sprintf, as that infringes on the user's name space.
1262 Don't have undefined behavior even if the translation
1263 produced a string with the wrong number of "%s"s. */
1264 char *yyp = yyresult;
1265 int yyi = 0;
1266 while ((*yyp = *yyf) != '\0')
1268 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1270 yyp += yytnamerr (yyp, yyarg[yyi++]);
1271 yyf += 2;
1273 else
1275 yyp++;
1276 yyf++;
1280 return yysize;
1283 #endif /* YYERROR_VERBOSE */
1286 /*-----------------------------------------------.
1287 | Release the memory associated to this symbol. |
1288 `-----------------------------------------------*/
1290 /*ARGSUSED*/
1291 #if (defined __STDC__ || defined __C99__FUNC__ \
1292 || defined __cplusplus || defined _MSC_VER)
1293 static void
1294 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t scanner)
1295 #else
1296 static void
1297 yydestruct (yymsg, yytype, yyvaluep, scanner)
1298 const char *yymsg;
1299 int yytype;
1300 YYSTYPE *yyvaluep;
1301 yyscan_t scanner;
1302 #endif
1304 YYUSE (yyvaluep);
1305 YYUSE (scanner);
1307 if (!yymsg)
1308 yymsg = "Deleting";
1309 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1311 switch (yytype)
1313 case 5: /* "HELP_TOPIC" */
1314 #line 161 "parser.y"
1315 { free((yyvaluep->str)); };
1316 #line 1317 "parser.c"
1317 break;
1318 case 8: /* "STR" */
1319 #line 161 "parser.y"
1320 { free((yyvaluep->str)); };
1321 #line 1322 "parser.c"
1322 break;
1323 case 9: /* "IDENTIFIER" */
1324 #line 161 "parser.y"
1325 { free((yyvaluep->str)); };
1326 #line 1327 "parser.c"
1327 break;
1328 case 25: /* "PARAM" */
1329 #line 162 "parser.y"
1330 { if((yyvaluep->str)) free((yyvaluep->str)); };
1331 #line 1332 "parser.c"
1332 break;
1333 case 28: /* "CMP_OP" */
1334 #line 161 "parser.y"
1335 { free((yyvaluep->str)); };
1336 #line 1337 "parser.c"
1337 break;
1338 case 51: /* "command" */
1339 #line 163 "parser.y"
1340 { if((yyvaluep->sel)) _gmx_selelem_free((yyvaluep->sel)); };
1341 #line 1342 "parser.c"
1342 break;
1343 case 52: /* "cmd_plain" */
1344 #line 163 "parser.y"
1345 { if((yyvaluep->sel)) _gmx_selelem_free((yyvaluep->sel)); };
1346 #line 1347 "parser.c"
1347 break;
1348 case 55: /* "selection" */
1349 #line 164 "parser.y"
1350 { _gmx_selelem_free_chain((yyvaluep->sel)); };
1351 #line 1352 "parser.c"
1352 break;
1353 case 59: /* "string" */
1354 #line 161 "parser.y"
1355 { free((yyvaluep->str)); };
1356 #line 1357 "parser.c"
1357 break;
1358 case 60: /* "sel_expr" */
1359 #line 165 "parser.y"
1360 { _gmx_selelem_free((yyvaluep->sel)); };
1361 #line 1362 "parser.c"
1362 break;
1363 case 62: /* "num_expr" */
1364 #line 165 "parser.y"
1365 { _gmx_selelem_free((yyvaluep->sel)); };
1366 #line 1367 "parser.c"
1367 break;
1368 case 63: /* "str_expr" */
1369 #line 165 "parser.y"
1370 { _gmx_selelem_free((yyvaluep->sel)); };
1371 #line 1372 "parser.c"
1372 break;
1373 case 64: /* "pos_expr" */
1374 #line 165 "parser.y"
1375 { _gmx_selelem_free((yyvaluep->sel)); };
1376 #line 1377 "parser.c"
1377 break;
1378 case 65: /* "method_params" */
1379 #line 166 "parser.y"
1380 { _gmx_selexpr_free_params((yyvaluep->param)); };
1381 #line 1382 "parser.c"
1382 break;
1383 case 66: /* "method_param_list" */
1384 #line 166 "parser.y"
1385 { _gmx_selexpr_free_params((yyvaluep->param)); };
1386 #line 1387 "parser.c"
1387 break;
1388 case 67: /* "method_param" */
1389 #line 166 "parser.y"
1390 { _gmx_selexpr_free_params((yyvaluep->param)); };
1391 #line 1392 "parser.c"
1392 break;
1393 case 68: /* "value_list" */
1394 #line 167 "parser.y"
1395 { _gmx_selexpr_free_values((yyvaluep->val)); };
1396 #line 1397 "parser.c"
1397 break;
1398 case 69: /* "value_list_contents" */
1399 #line 167 "parser.y"
1400 { _gmx_selexpr_free_values((yyvaluep->val)); };
1401 #line 1402 "parser.c"
1402 break;
1403 case 70: /* "basic_value_list" */
1404 #line 168 "parser.y"
1405 { _gmx_selexpr_free_values((yyvaluep->val)); };
1406 #line 1407 "parser.c"
1407 break;
1408 case 71: /* "basic_value_list_contents" */
1409 #line 168 "parser.y"
1410 { _gmx_selexpr_free_values((yyvaluep->val)); };
1411 #line 1412 "parser.c"
1412 break;
1413 case 72: /* "value_item" */
1414 #line 167 "parser.y"
1415 { _gmx_selexpr_free_values((yyvaluep->val)); };
1416 #line 1417 "parser.c"
1417 break;
1418 case 73: /* "basic_value_item" */
1419 #line 168 "parser.y"
1420 { _gmx_selexpr_free_values((yyvaluep->val)); };
1421 #line 1422 "parser.c"
1422 break;
1423 case 74: /* "value_item_range" */
1424 #line 167 "parser.y"
1425 { _gmx_selexpr_free_values((yyvaluep->val)); };
1426 #line 1427 "parser.c"
1427 break;
1429 default:
1430 break;
1435 /* Prevent warnings from -Wmissing-prototypes. */
1437 #ifdef YYPARSE_PARAM
1438 #if defined __STDC__ || defined __cplusplus
1439 int yyparse (void *YYPARSE_PARAM);
1440 #else
1441 int yyparse ();
1442 #endif
1443 #else /* ! YYPARSE_PARAM */
1444 #if defined __STDC__ || defined __cplusplus
1445 int yyparse (yyscan_t scanner);
1446 #else
1447 int yyparse ();
1448 #endif
1449 #endif /* ! YYPARSE_PARAM */
1456 /*----------.
1457 | yyparse. |
1458 `----------*/
1460 #ifdef YYPARSE_PARAM
1461 #if (defined __STDC__ || defined __C99__FUNC__ \
1462 || defined __cplusplus || defined _MSC_VER)
1464 yyparse (void *YYPARSE_PARAM)
1465 #else
1467 yyparse (YYPARSE_PARAM)
1468 void *YYPARSE_PARAM;
1469 #endif
1470 #else /* ! YYPARSE_PARAM */
1471 #if (defined __STDC__ || defined __C99__FUNC__ \
1472 || defined __cplusplus || defined _MSC_VER)
1474 yyparse (yyscan_t scanner)
1475 #else
1477 yyparse (scanner)
1478 yyscan_t scanner;
1479 #endif
1480 #endif
1482 /* The look-ahead symbol. */
1483 int yychar;
1485 /* The semantic value of the look-ahead symbol. */
1486 YYSTYPE yylval;
1488 /* Number of syntax errors so far. */
1489 int yynerrs;
1491 int yystate;
1492 int yyn;
1493 int yyresult;
1494 /* Number of tokens to shift before error messages enabled. */
1495 int yyerrstatus;
1496 /* Look-ahead token as an internal (translated) token number. */
1497 int yytoken = 0;
1498 #if YYERROR_VERBOSE
1499 /* Buffer for error messages, and its allocated size. */
1500 char yymsgbuf[128];
1501 char *yymsg = yymsgbuf;
1502 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1503 #endif
1505 /* Three stacks and their tools:
1506 `yyss': related to states,
1507 `yyvs': related to semantic values,
1508 `yyls': related to locations.
1510 Refer to the stacks thru separate pointers, to allow yyoverflow
1511 to reallocate them elsewhere. */
1513 /* The state stack. */
1514 yytype_int16 yyssa[YYINITDEPTH];
1515 yytype_int16 *yyss = yyssa;
1516 yytype_int16 *yyssp;
1518 /* The semantic value stack. */
1519 YYSTYPE yyvsa[YYINITDEPTH];
1520 YYSTYPE *yyvs = yyvsa;
1521 YYSTYPE *yyvsp;
1525 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1527 YYSIZE_T yystacksize = YYINITDEPTH;
1529 /* The variables used to return semantic value and location from the
1530 action routines. */
1531 YYSTYPE yyval;
1534 /* The number of symbols on the RHS of the reduced rule.
1535 Keep to zero when no symbol should be popped. */
1536 int yylen = 0;
1538 YYDPRINTF ((stderr, "Starting parse\n"));
1540 yystate = 0;
1541 yyerrstatus = 0;
1542 yynerrs = 0;
1543 yychar = YYEMPTY; /* Cause a token to be read. */
1545 /* Initialize stack pointers.
1546 Waste one element of value and location stack
1547 so that they stay on the same level as the state stack.
1548 The wasted elements are never initialized. */
1550 yyssp = yyss;
1551 yyvsp = yyvs;
1553 goto yysetstate;
1555 /*------------------------------------------------------------.
1556 | yynewstate -- Push a new state, which is found in yystate. |
1557 `------------------------------------------------------------*/
1558 yynewstate:
1559 /* In all cases, when you get here, the value and location stacks
1560 have just been pushed. So pushing a state here evens the stacks. */
1561 yyssp++;
1563 yysetstate:
1564 *yyssp = yystate;
1566 if (yyss + yystacksize - 1 <= yyssp)
1568 /* Get the current used size of the three stacks, in elements. */
1569 YYSIZE_T yysize = yyssp - yyss + 1;
1571 #ifdef yyoverflow
1573 /* Give user a chance to reallocate the stack. Use copies of
1574 these so that the &'s don't force the real ones into
1575 memory. */
1576 YYSTYPE *yyvs1 = yyvs;
1577 yytype_int16 *yyss1 = yyss;
1580 /* Each stack pointer address is followed by the size of the
1581 data in use in that stack, in bytes. This used to be a
1582 conditional around just the two extra args, but that might
1583 be undefined if yyoverflow is a macro. */
1584 yyoverflow (YY_("memory exhausted"),
1585 &yyss1, yysize * sizeof (*yyssp),
1586 &yyvs1, yysize * sizeof (*yyvsp),
1588 &yystacksize);
1590 yyss = yyss1;
1591 yyvs = yyvs1;
1593 #else /* no yyoverflow */
1594 # ifndef YYSTACK_RELOCATE
1595 goto yyexhaustedlab;
1596 # else
1597 /* Extend the stack our own way. */
1598 if (YYMAXDEPTH <= yystacksize)
1599 goto yyexhaustedlab;
1600 yystacksize *= 2;
1601 if (YYMAXDEPTH < yystacksize)
1602 yystacksize = YYMAXDEPTH;
1605 yytype_int16 *yyss1 = yyss;
1606 union yyalloc *yyptr =
1607 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1608 if (! yyptr)
1609 goto yyexhaustedlab;
1610 YYSTACK_RELOCATE (yyss);
1611 YYSTACK_RELOCATE (yyvs);
1613 # undef YYSTACK_RELOCATE
1614 if (yyss1 != yyssa)
1615 YYSTACK_FREE (yyss1);
1617 # endif
1618 #endif /* no yyoverflow */
1620 yyssp = yyss + yysize - 1;
1621 yyvsp = yyvs + yysize - 1;
1624 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1625 (unsigned long int) yystacksize));
1627 if (yyss + yystacksize - 1 <= yyssp)
1628 YYABORT;
1631 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1633 goto yybackup;
1635 /*-----------.
1636 | yybackup. |
1637 `-----------*/
1638 yybackup:
1640 /* Do appropriate processing given the current state. Read a
1641 look-ahead token if we need one and don't already have one. */
1643 /* First try to decide what to do without reference to look-ahead token. */
1644 yyn = yypact[yystate];
1645 if (yyn == YYPACT_NINF)
1646 goto yydefault;
1648 /* Not known => get a look-ahead token if don't already have one. */
1650 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1651 if (yychar == YYEMPTY)
1653 YYDPRINTF ((stderr, "Reading a token: "));
1654 yychar = YYLEX;
1657 if (yychar <= YYEOF)
1659 yychar = yytoken = YYEOF;
1660 YYDPRINTF ((stderr, "Now at end of input.\n"));
1662 else
1664 yytoken = YYTRANSLATE (yychar);
1665 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1668 /* If the proper action on seeing token YYTOKEN is to reduce or to
1669 detect an error, take that action. */
1670 yyn += yytoken;
1671 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1672 goto yydefault;
1673 yyn = yytable[yyn];
1674 if (yyn <= 0)
1676 if (yyn == 0 || yyn == YYTABLE_NINF)
1677 goto yyerrlab;
1678 yyn = -yyn;
1679 goto yyreduce;
1682 if (yyn == YYFINAL)
1683 YYACCEPT;
1685 /* Count tokens shifted since error; after three, turn off error
1686 status. */
1687 if (yyerrstatus)
1688 yyerrstatus--;
1690 /* Shift the look-ahead token. */
1691 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1693 /* Discard the shifted token unless it is eof. */
1694 if (yychar != YYEOF)
1695 yychar = YYEMPTY;
1697 yystate = yyn;
1698 *++yyvsp = yylval;
1700 goto yynewstate;
1703 /*-----------------------------------------------------------.
1704 | yydefault -- do the default action for the current state. |
1705 `-----------------------------------------------------------*/
1706 yydefault:
1707 yyn = yydefact[yystate];
1708 if (yyn == 0)
1709 goto yyerrlab;
1710 goto yyreduce;
1713 /*-----------------------------.
1714 | yyreduce -- Do a reduction. |
1715 `-----------------------------*/
1716 yyreduce:
1717 /* yyn is the number of a rule to reduce with. */
1718 yylen = yyr2[yyn];
1720 /* If YYLEN is nonzero, implement the default value of the action:
1721 `$$ = $1'.
1723 Otherwise, the following line sets YYVAL to garbage.
1724 This behavior is undocumented and Bison
1725 users should not rely upon it. Assigning to YYVAL
1726 unconditionally makes the parser a bit smaller, and it avoids a
1727 GCC warning that YYVAL may be used uninitialized. */
1728 yyval = yyvsp[1-yylen];
1731 YY_REDUCE_PRINT (yyn);
1732 switch (yyn)
1734 case 2:
1735 #line 182 "parser.y"
1736 { (yyval.sel) = NULL ;}
1737 break;
1739 case 3:
1740 #line 184 "parser.y"
1742 (yyval.sel) = _gmx_sel_append_selection((yyvsp[(2) - (2)].sel), (yyvsp[(1) - (2)].sel), scanner);
1743 if (_gmx_sel_parser_should_finish(scanner))
1744 YYACCEPT;
1746 break;
1748 case 4:
1749 #line 192 "parser.y"
1750 { (yyval.sel) = (yyvsp[(1) - (2)].sel); ;}
1751 break;
1753 case 5:
1754 #line 194 "parser.y"
1756 (yyval.sel) = NULL;
1757 _gmx_selparser_error("invalid selection '%s'",
1758 _gmx_sel_lexer_pselstr(scanner));
1759 _gmx_sel_lexer_clear_method_stack(scanner);
1760 if (_gmx_sel_is_lexer_interactive(scanner))
1762 _gmx_sel_lexer_clear_pselstr(scanner);
1763 yyerrok;
1765 else
1767 YYABORT;
1770 break;
1772 case 6:
1773 #line 213 "parser.y"
1775 (yyval.sel) = NULL;
1776 _gmx_sel_handle_empty_cmd(scanner);
1778 break;
1780 case 7:
1781 #line 217 "parser.y"
1782 { (yyval.sel) = NULL; ;}
1783 break;
1785 case 8:
1786 #line 219 "parser.y"
1788 t_selelem *s, *p;
1789 s = _gmx_sel_init_group_by_id((yyvsp[(1) - (1)].i), scanner);
1790 if (s == NULL) YYERROR;
1791 p = _gmx_sel_init_position(s, NULL, scanner);
1792 if (p == NULL) YYERROR;
1793 (yyval.sel) = _gmx_sel_init_selection(strdup(s->name), p, scanner);
1795 break;
1797 case 9:
1798 #line 228 "parser.y"
1800 t_selelem *s, *p;
1801 s = _gmx_sel_init_group_by_name((yyvsp[(1) - (1)].str), scanner);
1802 free((yyvsp[(1) - (1)].str));
1803 if (s == NULL) YYERROR;
1804 p = _gmx_sel_init_position(s, NULL, scanner);
1805 if (p == NULL) YYERROR;
1806 (yyval.sel) = _gmx_sel_init_selection(strdup(s->name), p, scanner);
1808 break;
1810 case 10:
1811 #line 238 "parser.y"
1812 { (yyval.sel) = _gmx_sel_init_selection(NULL, (yyvsp[(1) - (1)].sel), scanner); ;}
1813 break;
1815 case 11:
1816 #line 240 "parser.y"
1817 { (yyval.sel) = _gmx_sel_init_selection((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].sel), scanner); ;}
1818 break;
1820 case 12:
1821 #line 242 "parser.y"
1822 { (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
1823 break;
1825 case 13:
1826 #line 244 "parser.y"
1827 { (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
1828 break;
1830 case 14:
1831 #line 246 "parser.y"
1832 { (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
1833 break;
1835 case 15:
1836 #line 251 "parser.y"
1837 { _gmx_sel_handle_help_cmd(NULL, scanner); ;}
1838 break;
1840 case 17:
1841 #line 255 "parser.y"
1842 { _gmx_sel_handle_help_cmd((yyvsp[(2) - (2)].str), scanner); ;}
1843 break;
1845 case 18:
1846 #line 256 "parser.y"
1847 { _gmx_sel_handle_help_cmd((yyvsp[(2) - (2)].str), scanner); ;}
1848 break;
1850 case 19:
1851 #line 260 "parser.y"
1852 { (yyval.sel) = (yyvsp[(1) - (1)].sel); ;}
1853 break;
1855 case 20:
1856 #line 262 "parser.y"
1858 (yyval.sel) = _gmx_sel_init_position((yyvsp[(1) - (1)].sel), NULL, scanner);
1859 if ((yyval.sel) == NULL) YYERROR;
1861 break;
1863 case 21:
1864 #line 266 "parser.y"
1865 { (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
1866 break;
1868 case 22:
1869 #line 268 "parser.y"
1871 (yyval.sel) = _gmx_sel_init_modifier((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].sel), scanner);
1872 if ((yyval.sel) == NULL) YYERROR;
1874 break;
1876 case 23:
1877 #line 279 "parser.y"
1878 { (yyval.r) = (yyvsp[(1) - (1)].i); ;}
1879 break;
1881 case 24:
1882 #line 280 "parser.y"
1883 { (yyval.r) = -(yyvsp[(2) - (2)].i); ;}
1884 break;
1886 case 25:
1887 #line 284 "parser.y"
1888 { (yyval.r) = (yyvsp[(1) - (1)].r); ;}
1889 break;
1891 case 26:
1892 #line 285 "parser.y"
1893 { (yyval.r) = -(yyvsp[(2) - (2)].r); ;}
1894 break;
1896 case 27:
1897 #line 288 "parser.y"
1898 { (yyval.r) = (yyvsp[(1) - (1)].r); ;}
1899 break;
1901 case 28:
1902 #line 289 "parser.y"
1903 { (yyval.r) = (yyvsp[(1) - (1)].r); ;}
1904 break;
1906 case 29:
1907 #line 292 "parser.y"
1908 { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
1909 break;
1911 case 30:
1912 #line 293 "parser.y"
1913 { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
1914 break;
1916 case 31:
1917 #line 302 "parser.y"
1919 (yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
1920 (yyval.sel)->u.boolt = BOOL_NOT;
1921 (yyval.sel)->child = (yyvsp[(2) - (2)].sel);
1923 break;
1925 case 32:
1926 #line 308 "parser.y"
1928 (yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
1929 (yyval.sel)->u.boolt = BOOL_AND;
1930 (yyval.sel)->child = (yyvsp[(1) - (3)].sel); (yyval.sel)->child->next = (yyvsp[(3) - (3)].sel);
1932 break;
1934 case 33:
1935 #line 314 "parser.y"
1937 (yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
1938 (yyval.sel)->u.boolt = BOOL_OR;
1939 (yyval.sel)->child = (yyvsp[(1) - (3)].sel); (yyval.sel)->child->next = (yyvsp[(3) - (3)].sel);
1941 break;
1943 case 34:
1944 #line 325 "parser.y"
1945 { (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
1946 break;
1948 case 35:
1949 #line 330 "parser.y"
1951 (yyval.sel) = _gmx_sel_init_comparison((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), (yyvsp[(2) - (3)].str), scanner);
1952 if ((yyval.sel) == NULL) YYERROR;
1954 break;
1956 case 36:
1957 #line 338 "parser.y"
1959 (yyval.sel) = _gmx_sel_init_group_by_name((yyvsp[(2) - (2)].str), scanner);
1960 free((yyvsp[(2) - (2)].str));
1961 if ((yyval.sel) == NULL) YYERROR;
1963 break;
1965 case 37:
1966 #line 344 "parser.y"
1968 (yyval.sel) = _gmx_sel_init_group_by_id((yyvsp[(2) - (2)].i), scanner);
1969 if ((yyval.sel) == NULL) YYERROR;
1971 break;
1973 case 38:
1974 #line 351 "parser.y"
1975 { (yyval.str) = NULL; ;}
1976 break;
1978 case 39:
1979 #line 352 "parser.y"
1980 { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
1981 break;
1983 case 40:
1984 #line 357 "parser.y"
1986 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
1987 if ((yyval.sel) == NULL) YYERROR;
1989 break;
1991 case 41:
1992 #line 362 "parser.y"
1994 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (3)].meth), process_value_list((yyvsp[(3) - (3)].val), NULL), (yyvsp[(1) - (3)].str), scanner);
1995 if ((yyval.sel) == NULL) YYERROR;
1997 break;
1999 case 42:
2000 #line 367 "parser.y"
2002 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (3)].meth), process_value_list((yyvsp[(3) - (3)].val), NULL), (yyvsp[(1) - (3)].str), scanner);
2003 if ((yyval.sel) == NULL) YYERROR;
2005 break;
2007 case 43:
2008 #line 375 "parser.y"
2010 (yyval.sel) = _gmx_sel_init_method((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].str), scanner);
2011 if ((yyval.sel) == NULL) YYERROR;
2013 break;
2015 case 44:
2016 #line 387 "parser.y"
2018 (yyval.sel) = _gmx_selelem_create(SEL_CONST);
2019 _gmx_selelem_set_vtype((yyval.sel), INT_VALUE);
2020 _gmx_selvalue_reserve(&(yyval.sel)->v, 1);
2021 (yyval.sel)->v.u.i[0] = (yyvsp[(1) - (1)].i);
2023 break;
2025 case 45:
2026 #line 394 "parser.y"
2028 (yyval.sel) = _gmx_selelem_create(SEL_CONST);
2029 _gmx_selelem_set_vtype((yyval.sel), REAL_VALUE);
2030 _gmx_selvalue_reserve(&(yyval.sel)->v, 1);
2031 (yyval.sel)->v.u.r[0] = (yyvsp[(1) - (1)].r);
2033 break;
2035 case 46:
2036 #line 404 "parser.y"
2038 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
2039 if ((yyval.sel) == NULL) YYERROR;
2041 break;
2043 case 47:
2044 #line 409 "parser.y"
2046 (yyval.sel) = _gmx_sel_init_method((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].str), scanner);
2047 if ((yyval.sel) == NULL) YYERROR;
2049 break;
2051 case 48:
2052 #line 417 "parser.y"
2053 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '+', scanner); ;}
2054 break;
2056 case 49:
2057 #line 419 "parser.y"
2058 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '-', scanner); ;}
2059 break;
2061 case 50:
2062 #line 421 "parser.y"
2063 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '*', scanner); ;}
2064 break;
2066 case 51:
2067 #line 423 "parser.y"
2068 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '/', scanner); ;}
2069 break;
2071 case 52:
2072 #line 425 "parser.y"
2073 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(2) - (2)].sel), NULL, '-', scanner); ;}
2074 break;
2076 case 53:
2077 #line 427 "parser.y"
2078 { (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '^', scanner); ;}
2079 break;
2081 case 54:
2082 #line 428 "parser.y"
2083 { (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
2084 break;
2086 case 55:
2087 #line 436 "parser.y"
2089 (yyval.sel) = _gmx_selelem_create(SEL_CONST);
2090 _gmx_selelem_set_vtype((yyval.sel), STR_VALUE);
2091 _gmx_selvalue_reserve(&(yyval.sel)->v, 1);
2092 (yyval.sel)->v.u.s[0] = (yyvsp[(1) - (1)].str);
2094 break;
2096 case 56:
2097 #line 443 "parser.y"
2099 (yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
2100 if ((yyval.sel) == NULL) YYERROR;
2102 break;
2104 case 57:
2105 #line 455 "parser.y"
2106 { (yyval.sel) = _gmx_sel_init_const_position((yyvsp[(2) - (7)].r), (yyvsp[(4) - (7)].r), (yyvsp[(6) - (7)].r)); ;}
2107 break;
2109 case 58:
2110 #line 459 "parser.y"
2111 { (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
2112 break;
2114 case 59:
2115 #line 464 "parser.y"
2117 (yyval.sel) = _gmx_sel_init_method((yyvsp[(1) - (2)].meth), (yyvsp[(2) - (2)].param), NULL, scanner);
2118 if ((yyval.sel) == NULL) YYERROR;
2120 break;
2122 case 60:
2123 #line 472 "parser.y"
2125 (yyval.sel) = _gmx_sel_init_position((yyvsp[(3) - (3)].sel), (yyvsp[(1) - (3)].str), scanner);
2126 if ((yyval.sel) == NULL) YYERROR;
2128 break;
2130 case 61:
2131 #line 483 "parser.y"
2132 { (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
2133 break;
2135 case 62:
2136 #line 487 "parser.y"
2137 { (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
2138 break;
2140 case 63:
2141 #line 491 "parser.y"
2142 { (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
2143 break;
2145 case 64:
2146 #line 500 "parser.y"
2147 { (yyval.param) = process_param_list((yyvsp[(1) - (1)].param)); ;}
2148 break;
2150 case 65:
2151 #line 502 "parser.y"
2152 { (yyval.param) = process_param_list((yyvsp[(1) - (2)].param)); ;}
2153 break;
2155 case 66:
2156 #line 506 "parser.y"
2157 { (yyval.param) = NULL; ;}
2158 break;
2160 case 67:
2161 #line 508 "parser.y"
2162 { (yyvsp[(2) - (2)].param)->next = (yyvsp[(1) - (2)].param); (yyval.param) = (yyvsp[(2) - (2)].param); ;}
2163 break;
2165 case 68:
2166 #line 513 "parser.y"
2168 (yyval.param) = _gmx_selexpr_create_param((yyvsp[(1) - (2)].str));
2169 (yyval.param)->value = process_value_list((yyvsp[(2) - (2)].val), &(yyval.param)->nval);
2171 break;
2173 case 69:
2174 #line 519 "parser.y"
2175 { (yyval.val) = NULL; ;}
2176 break;
2178 case 70:
2179 #line 520 "parser.y"
2180 { (yyval.val) = (yyvsp[(1) - (1)].val); ;}
2181 break;
2183 case 71:
2184 #line 521 "parser.y"
2185 { (yyval.val) = (yyvsp[(2) - (3)].val); ;}
2186 break;
2188 case 72:
2189 #line 525 "parser.y"
2190 { (yyval.val) = (yyvsp[(1) - (1)].val); ;}
2191 break;
2193 case 73:
2194 #line 527 "parser.y"
2195 { (yyvsp[(2) - (2)].val)->next = (yyvsp[(1) - (2)].val); (yyval.val) = (yyvsp[(2) - (2)].val); ;}
2196 break;
2198 case 74:
2199 #line 529 "parser.y"
2200 { (yyvsp[(3) - (3)].val)->next = (yyvsp[(1) - (3)].val); (yyval.val) = (yyvsp[(3) - (3)].val); ;}
2201 break;
2203 case 75:
2204 #line 533 "parser.y"
2205 { (yyval.val) = (yyvsp[(1) - (1)].val); ;}
2206 break;
2208 case 76:
2209 #line 534 "parser.y"
2210 { (yyval.val) = (yyvsp[(2) - (3)].val); ;}
2211 break;
2213 case 77:
2214 #line 538 "parser.y"
2215 { (yyval.val) = (yyvsp[(1) - (1)].val); ;}
2216 break;
2218 case 78:
2219 #line 540 "parser.y"
2220 { (yyvsp[(2) - (2)].val)->next = (yyvsp[(1) - (2)].val); (yyval.val) = (yyvsp[(2) - (2)].val); ;}
2221 break;
2223 case 79:
2224 #line 542 "parser.y"
2225 { (yyvsp[(3) - (3)].val)->next = (yyvsp[(1) - (3)].val); (yyval.val) = (yyvsp[(3) - (3)].val); ;}
2226 break;
2228 case 80:
2229 #line 546 "parser.y"
2230 { (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
2231 break;
2233 case 81:
2234 #line 548 "parser.y"
2235 { (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
2236 break;
2238 case 82:
2239 #line 550 "parser.y"
2240 { (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
2241 break;
2243 case 83:
2244 #line 552 "parser.y"
2245 { (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
2246 break;
2248 case 84:
2249 #line 553 "parser.y"
2250 { (yyval.val) = (yyvsp[(1) - (1)].val); ;}
2251 break;
2253 case 85:
2254 #line 558 "parser.y"
2256 (yyval.val) = _gmx_selexpr_create_value(INT_VALUE);
2257 (yyval.val)->u.i.i1 = (yyval.val)->u.i.i2 = (yyvsp[(1) - (1)].r);
2259 break;
2261 case 86:
2262 #line 563 "parser.y"
2264 (yyval.val) = _gmx_selexpr_create_value(REAL_VALUE);
2265 (yyval.val)->u.r.r1 = (yyval.val)->u.r.r2 = (yyvsp[(1) - (1)].r);
2267 break;
2269 case 87:
2270 #line 568 "parser.y"
2272 (yyval.val) = _gmx_selexpr_create_value(STR_VALUE);
2273 (yyval.val)->u.s = (yyvsp[(1) - (1)].str);
2275 break;
2277 case 88:
2278 #line 572 "parser.y"
2279 { (yyval.val) = (yyvsp[(1) - (1)].val); ;}
2280 break;
2282 case 89:
2283 #line 577 "parser.y"
2285 (yyval.val) = _gmx_selexpr_create_value(INT_VALUE);
2286 (yyval.val)->u.i.i1 = (yyvsp[(1) - (3)].r); (yyval.val)->u.i.i2 = (yyvsp[(3) - (3)].r);
2288 break;
2290 case 90:
2291 #line 582 "parser.y"
2293 (yyval.val) = _gmx_selexpr_create_value(REAL_VALUE);
2294 (yyval.val)->u.r.r1 = (yyvsp[(1) - (3)].r); (yyval.val)->u.r.r2 = (yyvsp[(3) - (3)].r);
2296 break;
2298 case 91:
2299 #line 587 "parser.y"
2301 (yyval.val) = _gmx_selexpr_create_value(REAL_VALUE);
2302 (yyval.val)->u.r.r1 = (yyvsp[(1) - (3)].r); (yyval.val)->u.r.r2 = (yyvsp[(3) - (3)].r);
2304 break;
2307 /* Line 1267 of yacc.c. */
2308 #line 2309 "parser.c"
2309 default: break;
2311 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2313 YYPOPSTACK (yylen);
2314 yylen = 0;
2315 YY_STACK_PRINT (yyss, yyssp);
2317 *++yyvsp = yyval;
2320 /* Now `shift' the result of the reduction. Determine what state
2321 that goes to, based on the state we popped back to and the rule
2322 number reduced by. */
2324 yyn = yyr1[yyn];
2326 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2327 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2328 yystate = yytable[yystate];
2329 else
2330 yystate = yydefgoto[yyn - YYNTOKENS];
2332 goto yynewstate;
2335 /*------------------------------------.
2336 | yyerrlab -- here on detecting error |
2337 `------------------------------------*/
2338 yyerrlab:
2339 /* If not already recovering from an error, report this error. */
2340 if (!yyerrstatus)
2342 ++yynerrs;
2343 #if ! YYERROR_VERBOSE
2344 yyerror (scanner, YY_("syntax error"));
2345 #else
2347 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2348 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2350 YYSIZE_T yyalloc = 2 * yysize;
2351 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2352 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2353 if (yymsg != yymsgbuf)
2354 YYSTACK_FREE (yymsg);
2355 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2356 if (yymsg)
2357 yymsg_alloc = yyalloc;
2358 else
2360 yymsg = yymsgbuf;
2361 yymsg_alloc = sizeof yymsgbuf;
2365 if (0 < yysize && yysize <= yymsg_alloc)
2367 (void) yysyntax_error (yymsg, yystate, yychar);
2368 yyerror (scanner, yymsg);
2370 else
2372 yyerror (scanner, YY_("syntax error"));
2373 if (yysize != 0)
2374 goto yyexhaustedlab;
2377 #endif
2382 if (yyerrstatus == 3)
2384 /* If just tried and failed to reuse look-ahead token after an
2385 error, discard it. */
2387 if (yychar <= YYEOF)
2389 /* Return failure if at end of input. */
2390 if (yychar == YYEOF)
2391 YYABORT;
2393 else
2395 yydestruct ("Error: discarding",
2396 yytoken, &yylval, scanner);
2397 yychar = YYEMPTY;
2401 /* Else will try to reuse look-ahead token after shifting the error
2402 token. */
2403 goto yyerrlab1;
2406 /*---------------------------------------------------.
2407 | yyerrorlab -- error raised explicitly by YYERROR. |
2408 `---------------------------------------------------*/
2409 yyerrorlab:
2411 /* Pacify compilers like GCC when the user code never invokes
2412 YYERROR and the label yyerrorlab therefore never appears in user
2413 code. */
2414 if (/*CONSTCOND*/ 0)
2415 goto yyerrorlab;
2417 /* Do not reclaim the symbols of the rule which action triggered
2418 this YYERROR. */
2419 YYPOPSTACK (yylen);
2420 yylen = 0;
2421 YY_STACK_PRINT (yyss, yyssp);
2422 yystate = *yyssp;
2423 goto yyerrlab1;
2426 /*-------------------------------------------------------------.
2427 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2428 `-------------------------------------------------------------*/
2429 yyerrlab1:
2430 yyerrstatus = 3; /* Each real token shifted decrements this. */
2432 for (;;)
2434 yyn = yypact[yystate];
2435 if (yyn != YYPACT_NINF)
2437 yyn += YYTERROR;
2438 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2440 yyn = yytable[yyn];
2441 if (0 < yyn)
2442 break;
2446 /* Pop the current state because it cannot handle the error token. */
2447 if (yyssp == yyss)
2448 YYABORT;
2451 yydestruct ("Error: popping",
2452 yystos[yystate], yyvsp, scanner);
2453 YYPOPSTACK (1);
2454 yystate = *yyssp;
2455 YY_STACK_PRINT (yyss, yyssp);
2458 if (yyn == YYFINAL)
2459 YYACCEPT;
2461 *++yyvsp = yylval;
2464 /* Shift the error token. */
2465 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2467 yystate = yyn;
2468 goto yynewstate;
2471 /*-------------------------------------.
2472 | yyacceptlab -- YYACCEPT comes here. |
2473 `-------------------------------------*/
2474 yyacceptlab:
2475 yyresult = 0;
2476 goto yyreturn;
2478 /*-----------------------------------.
2479 | yyabortlab -- YYABORT comes here. |
2480 `-----------------------------------*/
2481 yyabortlab:
2482 yyresult = 1;
2483 goto yyreturn;
2485 #ifndef yyoverflow
2486 /*-------------------------------------------------.
2487 | yyexhaustedlab -- memory exhaustion comes here. |
2488 `-------------------------------------------------*/
2489 yyexhaustedlab:
2490 yyerror (scanner, YY_("memory exhausted"));
2491 yyresult = 2;
2492 /* Fall through. */
2493 #endif
2495 yyreturn:
2496 if (yychar != YYEOF && yychar != YYEMPTY)
2497 yydestruct ("Cleanup: discarding lookahead",
2498 yytoken, &yylval, scanner);
2499 /* Do not reclaim the symbols of the rule which action triggered
2500 this YYABORT or YYACCEPT. */
2501 YYPOPSTACK (yylen);
2502 YY_STACK_PRINT (yyss, yyssp);
2503 while (yyssp != yyss)
2505 yydestruct ("Cleanup: popping",
2506 yystos[*yyssp], yyvsp, scanner);
2507 YYPOPSTACK (1);
2509 #ifndef yyoverflow
2510 if (yyss != yyssa)
2511 YYSTACK_FREE (yyss);
2512 #endif
2513 #if YYERROR_VERBOSE
2514 if (yymsg != yymsgbuf)
2515 YYSTACK_FREE (yymsg);
2516 #endif
2517 /* Make sure YYID is used. */
2518 return YYID (yyresult);
2522 #line 593 "parser.y"
2525 static t_selexpr_value *
2526 process_value_list(t_selexpr_value *values, int *nr)
2528 t_selexpr_value *val, *pval, *nval;
2530 /* Count values (if needed) and reverse list */
2531 if (nr)
2533 *nr = 0;
2535 pval = NULL;
2536 val = values;
2537 while (val)
2539 if (nr)
2541 ++*nr;
2543 nval = val->next;
2544 val->next = pval;
2545 pval = val;
2546 val = nval;
2548 values = pval;
2550 return values;
2553 static t_selexpr_param *
2554 process_param_list(t_selexpr_param *params)
2556 t_selexpr_param *par, *ppar, *npar;
2558 /* Reverse list */
2559 ppar = NULL;
2560 par = params;
2561 while (par)
2563 npar = par->next;
2564 par->next = ppar;
2565 ppar = par;
2566 par = npar;
2568 params = ppar;
2570 return params;
2573 static void
2574 yyerror(yyscan_t scanner, char const *s)
2576 _gmx_selparser_error("%s", s);