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);
92 if (parser->methods.object_start && FAILURE == parser->methods.object_start(parser)) {
100 if (parser->methods.object_end && FAILURE == parser->methods.object_end(parser, &$$)) {
110 parser->scanner.errcode = PHP_JSON_ERROR_STATE_MISMATCH;
118 …if ((parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) && parser->methods.object_create == php_j…
121 parser->methods.object_create(parser, &$$);
130 parser->methods.object_create(parser, &$$);
131 if (parser->methods.object_update(parser, &$$, Z_STR($1), &$3) == FAILURE) {
137 if (parser->methods.object_update(parser, &$1, Z_STR($3), &$5) == FAILURE) {
148 if (parser->methods.array_start && FAILURE == parser->methods.array_start(parser)) {
156 if (parser->methods.array_end && FAILURE == parser->methods.array_end(parser, &$$)) {
166 parser->scanner.errcode = PHP_JSON_ERROR_STATE_MISMATCH;
174 if (parser->methods.array_create == php_json_parser_array_create) {
177 parser->methods.array_create(parser, &$$);
186 parser->methods.array_create(parser, &$$);
187 parser->methods.array_append(parser, &$$, &$1);
191 parser->methods.array_append(parser, &$1, &$3);
215 static int php_json_parser_array_create(php_json_parser *parser, zval *array)
221 static int php_json_parser_array_append(php_json_parser *parser, zval *array, zval *zvalue) in php_json_parser_array_append() argument
227 static int php_json_parser_object_create(php_json_parser *parser, zval *object) in php_json_parser_object_create() argument
229 if (parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) { in php_json_parser_object_create()
237 static int php_json_parser_object_update(php_json_parser *parser, zval *object, zend_string *key, z… in php_json_parser_object_update() argument
244 parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME; in php_json_parser_object_update()
258 static int php_json_parser_array_create_validate(php_json_parser *parser, zval *array) in php_json_parser_array_create_validate() argument
264 static int php_json_parser_array_append_validate(php_json_parser *parser, zval *array, zval *zvalue) in php_json_parser_array_append_validate() argument
269 static int php_json_parser_object_create_validate(php_json_parser *parser, zval *object) in php_json_parser_object_create_validate() argument
275 static int php_json_parser_object_update_validate(php_json_parser *parser, zval *object, zend_strin… in php_json_parser_object_update_validate() argument
280 static int php_json_yylex(union YYSTYPE *value, php_json_parser *parser) in php_json_yylex() argument
282 int token = php_json_scan(&parser->scanner); in php_json_yylex()
284 bool validate = parser->methods.array_create == php_json_parser_array_create_validate in php_json_yylex()
285 && parser->methods.array_append == php_json_parser_array_append_validate in php_json_yylex()
286 && parser->methods.object_create == php_json_parser_object_create_validate in php_json_yylex()
287 && parser->methods.object_update == php_json_parser_object_update_validate; in php_json_yylex()
290 zval_ptr_dtor_str(&(parser->scanner.value)); in php_json_yylex()
293 value->value = parser->scanner.value; in php_json_yylex()
299 static void php_json_yyerror(php_json_parser *parser, char const *msg) in php_json_yyerror() argument
301 if (!parser->scanner.errcode) { in php_json_yyerror()
302 parser->scanner.errcode = PHP_JSON_ERROR_SYNTAX; in php_json_yyerror()
306 PHP_JSON_API php_json_error_code php_json_parser_error_code(const php_json_parser *parser) in php_json_parser_error_code() argument
308 return parser->scanner.errcode; in php_json_parser_error_code()
335 PHP_JSON_API void php_json_parser_init_ex(php_json_parser *parser, in php_json_parser_init_ex() argument
343 memset(parser, 0, sizeof(php_json_parser)); in php_json_parser_init_ex()
344 php_json_scanner_init(&parser->scanner, str, str_len, options); in php_json_parser_init_ex()
345 parser->depth = 1; in php_json_parser_init_ex()
346 parser->max_depth = max_depth; in php_json_parser_init_ex()
347 parser->return_value = return_value; in php_json_parser_init_ex()
348 memcpy(&parser->methods, parser_methods, sizeof(php_json_parser_methods)); in php_json_parser_init_ex()
351 PHP_JSON_API void php_json_parser_init(php_json_parser *parser, in php_json_parser_init() argument
359 parser, in php_json_parser_init()
368 PHP_JSON_API int php_json_parse(php_json_parser *parser) in php_json_parse() argument
370 return php_json_yyparse(parser); in php_json_parse()