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