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