49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
64 #define YYLSP_NEEDED 0
67 #define yyparse gse_parse
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
88 #ifdef YYERROR_VERBOSE
89 # undef YYERROR_VERBOSE
90 # define YYERROR_VERBOSE 1
92 # define YYERROR_VERBOSE 0
97 # define YYTOKEN_TABLE 0
116 using namespace libdap;
121 #define gse_arg(arg) ((gse_arg *)(arg))
130 #line 131 "gse.tab.cc"
153 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
169 #line 170 "gse.tab.cc"
171 # define YYSTYPE_IS_TRIVIAL 1
172 # define yystype YYSTYPE
173 # define YYSTYPE_IS_DECLARED 1
181 #line 182 "gse.tab.cc"
195 int op2,
double val2);
201 #line 202 "gse.tab.cc"
215 #elif (defined __STDC__ || defined __C99__FUNC__ \
216 || defined __cplusplus || defined _MSC_VER)
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)
242 # define YYSIZE_T size_t
244 # define YYSIZE_T unsigned int
248 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
253 # include <libintl.h>
254 # define YY_(msgid) dgettext ("bison-runtime", msgid)
258 # define YY_(msgid) msgid
263 #if ! defined lint || defined __GNUC__
264 # define YYUSE(e) ((void) (e))
273 #if (defined __STDC__ || defined __C99__FUNC__ \
274 || defined __cplusplus || defined _MSC_VER)
287 #if ! defined yyoverflow || YYERROR_VERBOSE
291 # ifdef YYSTACK_USE_ALLOCA
292 # if YYSTACK_USE_ALLOCA
294 # define YYSTACK_ALLOC __builtin_alloca
295 # elif defined __BUILTIN_VA_ARG_INCR
298 # define YYSTACK_ALLOC __alloca
299 # elif defined _MSC_VER
301 # define alloca _alloca
303 # define YYSTACK_ALLOC alloca
304 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
305 || defined __cplusplus || defined _MSC_VER)
315 # ifdef YYSTACK_ALLOC
317 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
318 # ifndef YYSTACK_ALLOC_MAXIMUM
323 # define YYSTACK_ALLOC_MAXIMUM 4032
326 # define YYSTACK_ALLOC YYMALLOC
327 # define YYSTACK_FREE YYFREE
328 # ifndef YYSTACK_ALLOC_MAXIMUM
329 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
331 # if (defined __cplusplus && ! defined _STDLIB_H \
332 && ! ((defined YYMALLOC || defined malloc) \
333 && (defined YYFREE || defined free)))
340 # define YYMALLOC malloc
341 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
342 || defined __cplusplus || defined _MSC_VER)
348 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
349 || defined __cplusplus || defined _MSC_VER)
357 #if (! defined yyoverflow \
358 && (! defined __cplusplus \
359 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
369 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
373 # define YYSTACK_BYTES(N) \
374 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
375 + YYSTACK_GAP_MAXIMUM)
380 # if defined __GNUC__ && 1 < __GNUC__
381 # define YYCOPY(To, From, Count) \
382 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
384 # define YYCOPY(To, From, Count) \
388 for (yyi = 0; yyi < (Count); yyi++) \
389 (To)[yyi] = (From)[yyi]; \
400 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
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); \
429 #define YYMAXUTOK 267
431 #define YYTRANSLATE(YYX) \
432 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
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
471 0, 0, 3, 7, 11, 17, 19, 21, 23, 25,
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,
487 0, 108, 108, 114, 120, 129, 132, 133, 136, 137,
492 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
495 static const char *
const yytname[] =
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
509 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
517 0, 13, 14, 14, 14, 15, 16, 16, 17, 17,
524 0, 2, 3, 3, 5, 1, 1, 1, 1, 1,
533 0, 6, 7, 5, 0, 0, 0, 1, 8, 9,
534 10, 11, 12, 13, 0, 0, 2, 3, 0, 4
545 #define YYPACT_NINF -7
548 12, -7, -7, -7, 1, -5, -5, -7, -7, -7,
549 -7, -7, -7, -7, 5, 7, -7, -5, 5, -7
562 #define YYTABLE_NINF -1
565 15, 7, 8, 9, 10, 11, 12, 13, 1, 2,
566 16, 18, 3, 17, 19, 1, 2, 3
571 6, 0, 7, 8, 9, 10, 11, 12, 3, 4,
572 14, 17, 5, 15, 18, 3, 4, 5
579 0, 3, 4, 5, 14, 15, 16, 0, 7, 8,
580 9, 10, 11, 12, 17, 17, 16, 15, 17, 16
583 #define yyerrok (yyerrstatus = 0)
584 #define yyclearin (yychar = YYEMPTY)
588 #define YYACCEPT goto yyacceptlab
589 #define YYABORT goto yyabortlab
590 #define YYERROR goto yyerrorlab
597 #define YYFAIL goto yyerrlab
599 #define YYRECOVERING() (!!yyerrstatus)
601 #define YYBACKUP(Token, Value) \
603 if (yychar == YYEMPTY && yylen == 1) \
607 yytoken = YYTRANSLATE (yychar); \
613 yyerror (arg, YY_("syntax error: cannot back up")); \
620 #define YYERRCODE 256
627 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
628 #ifndef YYLLOC_DEFAULT
629 # define YYLLOC_DEFAULT(Current, Rhs, N) \
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; \
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; \
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)
660 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
668 # define YYLEX yylex (YYLEX_PARAM)
670 # define YYLEX yylex ()
678 # define YYFPRINTF fprintf
681 # define YYDPRINTF(Args) \
687 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
691 YYFPRINTF (stderr, "%s ", Title); \
692 yy_symbol_print (stderr, \
694 YYFPRINTF (stderr, "\n"); \
704 #if (defined __STDC__ || defined __C99__FUNC__ \
705 || defined __cplusplus || defined _MSC_VER)
710 yy_symbol_value_print (yyoutput, yytype, yyvaluep, arg)
722 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
738 #if (defined __STDC__ || defined __C99__FUNC__ \
739 || defined __cplusplus || defined _MSC_VER)
741 yy_symbol_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
gse_arg *arg)
744 yy_symbol_print (yyoutput, yytype, yyvaluep, arg)
747 YYSTYPE const * const yyvaluep;
752 YYFPRINTF (yyoutput,
"token %s (", yytname[yytype]);
754 YYFPRINTF (yyoutput,
"nterm %s (", yytname[yytype]);
756 yy_symbol_value_print (yyoutput, yytype, yyvaluep, arg);
765 #if (defined __STDC__ || defined __C99__FUNC__ \
766 || defined __cplusplus || defined _MSC_VER)
771 yy_stack_print (yybottom, yytop)
777 for (; yybottom <=
yytop; yybottom++)
779 int yybot = *yybottom;
785 # define YY_STACK_PRINT(Bottom, Top) \
788 yy_stack_print ((Bottom), (Top)); \
796 #if (defined __STDC__ || defined __C99__FUNC__ \
797 || defined __cplusplus || defined _MSC_VER)
802 yy_reduce_print (yyvsp, yyrule, arg)
808 int yynrhs = yyr2[
yyrule];
811 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
814 for (yyi = 0; yyi < yynrhs; yyi++)
817 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
818 &(yyvsp[(yyi + 1) - (yynrhs)])
824 # define YY_REDUCE_PRINT(Rule) \
827 yy_reduce_print (yyvsp, Rule, arg); \
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)
843 # define YYINITDEPTH 200
854 # define YYMAXDEPTH 10000
862 # if defined __GLIBC__ && defined _STRING_H
863 # define yystrlen strlen
866 #if (defined __STDC__ || defined __C99__FUNC__ \
867 || defined __cplusplus || defined _MSC_VER)
869 yystrlen (
const char *yystr)
877 for (yylen = 0; yystr[
yylen]; yylen++)
885 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
886 # define yystpcpy stpcpy
890 #if (defined __STDC__ || defined __C99__FUNC__ \
891 || defined __cplusplus || defined _MSC_VER)
893 yystpcpy (
char *yydest,
const char *yysrc)
896 yystpcpy (yydest, yysrc)
902 const char *yys = yysrc;
904 while ((*yyd++ = *yys++) !=
'\0')
921 yytnamerr (
char *yyres,
const char *yystr)
926 char const *yyp = yystr;
933 goto do_not_strip_quotes;
937 goto do_not_strip_quotes;
950 do_not_strip_quotes: ;
954 return yystrlen (yystr);
956 return yystpcpy (yyres, yystr) - yyres;
977 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
980 int yysize_overflow = 0;
981 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
982 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
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");
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;
1007 int yyxbegin = yyn < 0 ? -yyn : 0;
1010 int yychecklim =
YYLAST - yyn + 1;
1014 yyarg[0] = yytname[
yytype];
1015 yyfmt = yystpcpy (yyformat, yyunexpected);
1017 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1018 if (yycheck[yyx + yyn] == yyx && yyx !=
YYTERROR)
1020 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1024 yyformat[
sizeof yyunexpected - 1] =
'\0';
1027 yyarg[yycount++] = yytname[yyx];
1028 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1029 yysize_overflow |= (yysize1 < yysize);
1031 yyfmt = yystpcpy (yyfmt, yyprefix);
1035 yyf =
YY_(yyformat);
1036 yysize1 = yysize + yystrlen (yyf);
1037 yysize_overflow |= (yysize1 < yysize);
1040 if (yysize_overflow)
1050 while ((*yyp = *yyf) !=
'\0')
1052 if (*yyp ==
'%' && yyf[1] ==
's' && yyi < yycount)
1054 yyp += yytnamerr (yyp, yyarg[yyi++]);
1075 #if (defined __STDC__ || defined __C99__FUNC__ \
1076 || defined __cplusplus || defined _MSC_VER)
1078 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep,
gse_arg *arg)
1081 yydestruct (yymsg, yytype, yyvaluep, arg)
1104 #ifdef YYPARSE_PARAM
1105 #if defined __STDC__ || defined __cplusplus
1106 int yyparse (
void *YYPARSE_PARAM);
1111 #if defined __STDC__ || defined __cplusplus
1134 #ifdef YYPARSE_PARAM
1135 #if (defined __STDC__ || defined __C99__FUNC__ \
1136 || defined __cplusplus || defined _MSC_VER)
1142 void *YYPARSE_PARAM;
1145 #if (defined __STDC__ || defined __C99__FUNC__ \
1146 || defined __cplusplus || defined _MSC_VER)
1192 char *yymsg = yymsgbuf;
1193 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1196 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1207 YYDPRINTF ((stderr,
"Starting parse\n"));
1234 if (yyss + yystacksize - 1 <= yyssp)
1237 YYSIZE_T yysize = yyssp - yyss + 1;
1251 yyoverflow (
YY_(
"memory exhausted"),
1252 &yyss1, yysize *
sizeof (*yyssp),
1253 &yyvs1, yysize *
sizeof (*yyvsp),
1260 # ifndef YYSTACK_RELOCATE
1261 goto yyexhaustedlab;
1265 goto yyexhaustedlab;
1275 goto yyexhaustedlab;
1278 # undef YYSTACK_RELOCATE
1285 yyssp = yyss + yysize - 1;
1286 yyvsp = yyvs + yysize - 1;
1288 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1289 (
unsigned long int) yystacksize));
1291 if (yyss + yystacksize - 1 <= yyssp)
1295 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1320 YYDPRINTF ((stderr,
"Reading a token: "));
1326 yychar = yytoken =
YYEOF;
1327 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1338 if (yyn < 0 ||
YYLAST < yyn || yycheck[yyn] != yytoken)
1391 yyval = yyvsp[1-
yylen];
1404 (yyval.boolean) =
true;
1415 (yyval.boolean) =
true;
1426 (yyvsp[(5) - (5)].val)));
1427 (yyval.boolean) =
true;
1434 #line 1435 "gse.tab.cc"
1452 if (0 <= yystate && yystate <=
YYLAST && yycheck[yystate] == *yyssp)
1468 #if ! YYERROR_VERBOSE
1472 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1478 if (yymsg != yymsgbuf)
1486 yymsg_alloc =
sizeof yymsgbuf;
1490 if (0 < yysize && yysize <= yymsg_alloc)
1492 (void) yysyntax_error (yymsg, yystate, yychar);
1499 goto yyexhaustedlab;
1507 if (yyerrstatus == 3)
1512 if (yychar <=
YYEOF)
1515 if (yychar ==
YYEOF)
1520 yydestruct (
"Error: discarding",
1576 yydestruct (
"Error: popping",
1577 yystos[yystate], yyvsp, arg);
1607 #if !defined(yyoverflow) || YYERROR_VERBOSE
1619 yydestruct (
"Cleanup: discarding lookahead",
1625 while (yyssp != yyss)
1627 yydestruct (
"Cleanup: popping",
1628 yystos[*yyssp], yyvsp, arg);
1636 if (yymsg != yymsgbuf)
1640 return YYID (yyresult);
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.");
1659 decode_relop(
int op)
1673 throw Error(malformed_expr,
"Unrecognized relational operator");
1678 decode_inverse_relop(
int op)
1692 throw Error(malformed_expr,
"Unrecognized relational operator");
1708 decode_inverse_relop(op));
1713 int op2,
double val2)
1717 relop rop1 = decode_inverse_relop(op1);
1718 relop rop2 = decode_relop(op2);
1724 throw Error(malformed_expr,
1725 "GSE Clause operands must define a monotonic interval.");
1730 throw Error(malformed_expr,
1731 "GSE Clause operands must define a monotonic interval.");
1736 throw Error(malformed_expr,
"Unrecognized relational operator.");
YYSTYPE yyvsa[YYINITDEPTH]
YYSTYPE const *const yyvaluep
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Argument to the GSE parser.
#define YY_REDUCE_PRINT(Rule)
yytype_int16 yyssa[YYINITDEPTH]
void gse_error(gse_arg *arg, const char *str)
Holds the results of parsing one of the Grid Selection Expression clauses.
unsigned short int yytype_uint16
#define YYSTACK_ALLOC_MAXIMUM
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
#define YY_STACK_PRINT(Bottom, Top)
GSEClause * build_dual_gse_clause(gse_arg *arg, char id[ID_MAX], int op1, double val1, int op2, double val2)
GSEClause * build_rev_gse_clause(gse_arg *arg, char id[ID_MAX], int op, double val)
GSEClause * build_gse_clause(gse_arg *arg, char id[ID_MAX], int op, double val)
unsigned char yytype_uint8