contrived_json 0.0.1

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