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