Lines Matching +full:input +full:- +full:depth

10  * See the COPYING.LIB file in the top-level directory.
16 #include "json-parser-int.h"
26 while ((token = g_queue_pop_head(&parser->tokens))) { in json_message_free_tokens()
31 void json_message_process_token(JSONLexer *lexer, GString *input, in json_message_process_token() argument
41 parser->brace_count++; in json_message_process_token()
44 parser->brace_count--; in json_message_process_token()
47 parser->bracket_count++; in json_message_process_token()
50 parser->bracket_count--; in json_message_process_token()
53 error_setg(&err, "JSON parse error, stray '%s'", input->str); in json_message_process_token()
56 if (g_queue_is_empty(&parser->tokens)) { in json_message_process_token()
59 json = json_parser_parse(&parser->tokens, parser->ap, &err); in json_message_process_token()
67 * and the maximum recursion depth that a message can force. in json_message_process_token()
69 if (parser->token_size + input->len + 1 > MAX_TOKEN_SIZE) { in json_message_process_token()
73 if (g_queue_get_length(&parser->tokens) + 1 > MAX_TOKEN_COUNT) { in json_message_process_token()
77 if (parser->bracket_count + parser->brace_count > MAX_NESTING) { in json_message_process_token()
78 error_setg(&err, "JSON nesting depth limit exceeded"); in json_message_process_token()
82 token = json_token(type, x, y, input); in json_message_process_token()
83 parser->token_size += input->len; in json_message_process_token()
85 g_queue_push_tail(&parser->tokens, token); in json_message_process_token()
87 if ((parser->brace_count > 0 || parser->bracket_count > 0) in json_message_process_token()
88 && parser->brace_count >= 0 && parser->bracket_count >= 0) { in json_message_process_token()
92 json = json_parser_parse(&parser->tokens, parser->ap, &err); in json_message_process_token()
95 parser->brace_count = 0; in json_message_process_token()
96 parser->bracket_count = 0; in json_message_process_token()
98 parser->token_size = 0; in json_message_process_token()
99 parser->emit(parser->opaque, json, err); in json_message_process_token()
107 parser->emit = emit; in json_message_parser_init()
108 parser->opaque = opaque; in json_message_parser_init()
109 parser->ap = ap; in json_message_parser_init()
110 parser->brace_count = 0; in json_message_parser_init()
111 parser->bracket_count = 0; in json_message_parser_init()
112 g_queue_init(&parser->tokens); in json_message_parser_init()
113 parser->token_size = 0; in json_message_parser_init()
115 json_lexer_init(&parser->lexer, !!ap); in json_message_parser_init()
121 json_lexer_feed(&parser->lexer, buffer, size); in json_message_parser_feed()
126 json_lexer_flush(&parser->lexer); in json_message_parser_flush()
127 assert(g_queue_is_empty(&parser->tokens)); in json_message_parser_flush()
132 json_lexer_destroy(&parser->lexer); in json_message_parser_destroy()