Lines Matching refs:parser

33 static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser,  in jsmn_alloc_token()  argument
38 if ((unsigned)parser->toknext >= num_tokens) in jsmn_alloc_token()
40 tok = &tokens[parser->toknext++]; in jsmn_alloc_token()
61 static jsmnerr_t jsmn_parse_primitive(jsmn_parser *parser, const char *js, in jsmn_parse_primitive() argument
68 start = parser->pos; in jsmn_parse_primitive()
70 for (; parser->pos < len; parser->pos++) { in jsmn_parse_primitive()
71 switch (js[parser->pos]) { in jsmn_parse_primitive()
90 if (js[parser->pos] < 32 || js[parser->pos] >= 127) { in jsmn_parse_primitive()
91 parser->pos = start; in jsmn_parse_primitive()
100 parser->pos = start; in jsmn_parse_primitive()
105 token = jsmn_alloc_token(parser, tokens, num_tokens); in jsmn_parse_primitive()
107 parser->pos = start; in jsmn_parse_primitive()
110 jsmn_fill_token(token, JSMN_PRIMITIVE, start, parser->pos); in jsmn_parse_primitive()
111 parser->pos--; /* parent sees closing brackets */ in jsmn_parse_primitive()
118 static jsmnerr_t jsmn_parse_string(jsmn_parser *parser, const char *js, in jsmn_parse_string() argument
123 int start = parser->pos; in jsmn_parse_string()
126 parser->pos++; in jsmn_parse_string()
128 for (; parser->pos < len; parser->pos++) { in jsmn_parse_string()
129 char c = js[parser->pos]; in jsmn_parse_string()
133 token = jsmn_alloc_token(parser, tokens, num_tokens); in jsmn_parse_string()
135 parser->pos = start; in jsmn_parse_string()
139 parser->pos); in jsmn_parse_string()
145 parser->pos++; in jsmn_parse_string()
146 switch (js[parser->pos]) { in jsmn_parse_string()
163 parser->pos = start; in jsmn_parse_string()
168 parser->pos = start; in jsmn_parse_string()
175 jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len, in jsmn_parse() argument
190 for (; parser->pos < len; parser->pos++) { in jsmn_parse()
194 c = js[parser->pos]; in jsmn_parse()
202 token = jsmn_alloc_token(parser, tokens, num_tokens); in jsmn_parse()
205 if (parser->toksuper != -1) in jsmn_parse()
206 tokens[parser->toksuper].size++; in jsmn_parse()
208 token->start = parser->pos; in jsmn_parse()
209 parser->toksuper = parser->toknext - 1; in jsmn_parse()
218 for (i = parser->toknext - 1; i >= 0; i--) { in jsmn_parse()
223 parser->toksuper = -1; in jsmn_parse()
224 token->end = parser->pos + 1; in jsmn_parse()
234 parser->toksuper = i; in jsmn_parse()
245 r = jsmn_parse_string(parser, js, len, tokens, in jsmn_parse()
249 if (parser->toksuper != -1) in jsmn_parse()
250 tokens[parser->toksuper].size++; in jsmn_parse()
299 r = jsmn_parse_primitive(parser, js, len, tokens, in jsmn_parse()
303 if (parser->toksuper != -1) in jsmn_parse()
304 tokens[parser->toksuper].size++; in jsmn_parse()
315 for (i = parser->toknext - 1; i >= 0; i--) { in jsmn_parse()
332 void jsmn_init(jsmn_parser *parser) in jsmn_init() argument
334 parser->pos = 0; in jsmn_init()
335 parser->toknext = 0; in jsmn_init()
336 parser->toksuper = -1; in jsmn_init()