Lines Matching refs:parser
34 #define PHP_JSON_DEPTH_DEC --parser->depth
36 if (parser->max_depth && parser->depth >= parser->max_depth) { \
37 parser->scanner.errcode = PHP_JSON_ERROR_DEPTH; \
40 ++parser->depth
46 %param { php_json_parser *parser }
69 static int php_json_yylex(union YYSTYPE *value, php_json_parser *parser);
70 static void php_json_yyerror(php_json_parser *parser, char const *msg);
71 static int php_json_parser_array_create(php_json_parser *parser, zval *array);
72 static int php_json_parser_object_create(php_json_parser *parser, zval *array);
82 ZVAL_COPY_VALUE(parser->return_value, &$1);
91 if (parser->methods.object_start && FAILURE == parser->methods.object_start(parser)) {
99 if (parser->methods.object_end && FAILURE == parser->methods.object_end(parser, &$$)) {
109 parser->scanner.errcode = PHP_JSON_ERROR_STATE_MISMATCH;
117 …if ((parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) && parser->methods.object_create == php_j…
120 parser->methods.object_create(parser, &$$);
129 parser->methods.object_create(parser, &$$);
130 if (parser->methods.object_update(parser, &$$, Z_STR($1), &$3) == FAILURE) {
136 if (parser->methods.object_update(parser, &$1, Z_STR($3), &$5) == FAILURE) {
147 if (parser->methods.array_start && FAILURE == parser->methods.array_start(parser)) {
155 if (parser->methods.array_end && FAILURE == parser->methods.array_end(parser, &$$)) {
165 parser->scanner.errcode = PHP_JSON_ERROR_STATE_MISMATCH;
173 if (parser->methods.array_create == php_json_parser_array_create) {
176 parser->methods.array_create(parser, &$$);
185 parser->methods.array_create(parser, &$$);
186 parser->methods.array_append(parser, &$$, &$1);
190 parser->methods.array_append(parser, &$1, &$3);
214 static int php_json_parser_array_create(php_json_parser *parser, zval *array)
220 static int php_json_parser_array_append(php_json_parser *parser, zval *array, zval *zvalue) in php_json_parser_array_append() argument
226 static int php_json_parser_object_create(php_json_parser *parser, zval *object) in php_json_parser_object_create() argument
228 if (parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) { in php_json_parser_object_create()
236 static int php_json_parser_object_update(php_json_parser *parser, zval *object, zend_string *key, z… in php_json_parser_object_update() argument
243 parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME; in php_json_parser_object_update()
257 static int php_json_yylex(union YYSTYPE *value, php_json_parser *parser) in php_json_yylex() argument
259 int token = php_json_scan(&parser->scanner); in php_json_yylex()
260 value->value = parser->scanner.value; in php_json_yylex()
264 static void php_json_yyerror(php_json_parser *parser, char const *msg) in php_json_yyerror() argument
266 if (!parser->scanner.errcode) { in php_json_yyerror()
267 parser->scanner.errcode = PHP_JSON_ERROR_SYNTAX; in php_json_yyerror()
271 PHP_JSON_API php_json_error_code php_json_parser_error_code(const php_json_parser *parser) in php_json_parser_error_code() argument
273 return parser->scanner.errcode; in php_json_parser_error_code()
288 PHP_JSON_API void php_json_parser_init_ex(php_json_parser *parser, in php_json_parser_init_ex() argument
296 memset(parser, 0, sizeof(php_json_parser)); in php_json_parser_init_ex()
297 php_json_scanner_init(&parser->scanner, str, str_len, options); in php_json_parser_init_ex()
298 parser->depth = 1; in php_json_parser_init_ex()
299 parser->max_depth = max_depth; in php_json_parser_init_ex()
300 parser->return_value = return_value; in php_json_parser_init_ex()
301 memcpy(&parser->methods, parser_methods, sizeof(php_json_parser_methods)); in php_json_parser_init_ex()
304 PHP_JSON_API void php_json_parser_init(php_json_parser *parser, in php_json_parser_init() argument
312 parser, in php_json_parser_init()
321 PHP_JSON_API int php_json_parse(php_json_parser *parser) in php_json_parse() argument
323 return php_json_yyparse(parser); in php_json_parse()