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