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