Lines Matching refs:js
33 #define TOKEN_STRING(js, t, s) \
34 (strncmp(js+(t).start, s, (t).end - (t).start) == 0 \
45 const char *js;
50 js = "{}";
52 r = jsmn_parse(&p, js, strlen(js), t, 10);
57 js = "[]";
59 r = jsmn_parse(&p, js, strlen(js), t, 10);
64 js = "{\"a\":[]}";
66 r = jsmn_parse(&p, js, strlen(js), t, 10);
72 js = "[{},{}]";
74 r = jsmn_parse(&p, js, strlen(js), t, 10);
83 const char *js;
88 js = "{\"a\": 0}";
91 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
97 check(TOKEN_STRING(js, tokens[0], js));
98 check(TOKEN_STRING(js, tokens[1], "a"));
99 check(TOKEN_STRING(js, tokens[2], "0"));
102 js = "[\"a\":{},\"b\":{}]";
103 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
107 js = "{\n \"Day\": 26,\n \"Month\": 9,\n \"Year\": 12\n }";
108 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
119 const char *js;
120 js = "\"boolVar\" : true";
122 r = jsmn_parse(&p, js, strlen(js), tok, 10);
125 check(TOKEN_STRING(js, tok[0], "boolVar"));
126 check(TOKEN_STRING(js, tok[1], "true"));
128 js = "\"boolVar\" : false";
130 r = jsmn_parse(&p, js, strlen(js), tok, 10);
133 check(TOKEN_STRING(js, tok[0], "boolVar"));
134 check(TOKEN_STRING(js, tok[1], "false"));
136 js = "\"intVar\" : 12345";
138 r = jsmn_parse(&p, js, strlen(js), tok, 10);
141 check(TOKEN_STRING(js, tok[0], "intVar"));
142 check(TOKEN_STRING(js, tok[1], "12345"));
144 js = "\"floatVar\" : 12.345";
146 r = jsmn_parse(&p, js, strlen(js), tok, 10);
149 check(TOKEN_STRING(js, tok[0], "floatVar"));
150 check(TOKEN_STRING(js, tok[1], "12.345"));
152 js = "\"nullVar\" : null";
154 r = jsmn_parse(&p, js, strlen(js), tok, 10);
157 check(TOKEN_STRING(js, tok[0], "nullVar"));
158 check(TOKEN_STRING(js, tok[1], "null"));
167 const char *js;
169 js = "\"strVar\" : \"hello world\"";
171 r = jsmn_parse(&p, js, strlen(js), tok, 10);
174 check(TOKEN_STRING(js, tok[0], "strVar"));
175 check(TOKEN_STRING(js, tok[1], "hello world"));
177 js = "\"strVar\" : \"escapes: \\/\\r\\n\\t\\b\\f\\\"\\\\\"";
179 r = jsmn_parse(&p, js, strlen(js), tok, 10);
182 check(TOKEN_STRING(js, tok[0], "strVar"));
183 check(TOKEN_STRING(js, tok[1], "escapes: \\/\\r\\n\\t\\b\\f\\\"\\\\"));
185 js = "\"strVar\" : \"\"";
187 r = jsmn_parse(&p, js, strlen(js), tok, 10);
190 check(TOKEN_STRING(js, tok[0], "strVar"));
191 check(TOKEN_STRING(js, tok[1], ""));
200 const char *js;
203 js = "\"x\": \"va";
204 r = jsmn_parse(&p, js, strlen(js), tok, 10);
206 check(TOKEN_STRING(js, tok[0], "x"));
219 js = "\"x\": \"valu";
220 r = jsmn_parse(&p, js, strlen(js), tok, 10);
222 check(TOKEN_STRING(js, tok[0], "x"));
225 js = "\"x\": \"value\"";
226 r = jsmn_parse(&p, js, strlen(js), tok, 10);
229 check(TOKEN_STRING(js, tok[0], "x"));
230 check(TOKEN_STRING(js, tok[1], "value"));
232 js = "\"x\": \"value\", \"y\": \"value y\"";
233 r = jsmn_parse(&p, js, strlen(js), tok, 10);
237 check(TOKEN_STRING(js, tok[0], "x"));
238 check(TOKEN_STRING(js, tok[1], "value"));
239 check(TOKEN_STRING(js, tok[2], "y"));
240 check(TOKEN_STRING(js, tok[3], "value y"));
250 const char *js;
253 js = "key1: \"value\"\nkey2 : 123";
255 r = jsmn_parse(&p, js, strlen(js), tok, 10);
259 check(TOKEN_STRING(js, tok[0], "key1"));
260 check(TOKEN_STRING(js, tok[1], "value"));
261 check(TOKEN_STRING(js, tok[2], "key2"));
262 check(TOKEN_STRING(js, tok[3], "123"));
271 const char *js;
274 js = " [ 1, true, ";
275 r = jsmn_parse(&p, js, strlen(js), tok, 10);
279 js = " [ 1, true, [123, \"hello";
280 r = jsmn_parse(&p, js, strlen(js), tok, 10);
285 js = " [ 1, true, [123, \"hello\"]";
286 r = jsmn_parse(&p, js, strlen(js), tok, 10);
294 js = " [ 1, true, [123, \"hello\"]]";
295 r = jsmn_parse(&p, js, strlen(js), tok, 10);
310 const char *js;
312 js = " [ 1, true, [123, \"hello\"]]";
318 r = jsmn_parse(&p, js, strlen(js), toksmall, i);
323 r = jsmn_parse(&p, js, strlen(js), toklarge, 10);
336 const char *js;
338 js = "[10}";
340 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
343 js = "[10]";
345 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
348 js = "{\"a\": 1]";
350 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
353 js = "{\"a\": 1}";
355 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
365 const char *js;
367 js = "{ \"height\":10, \"layers\":[ { \"data\":[6,6], \"height\":10, "
376 r = jsmn_parse(&p, js, strlen(js), tokens, 128);
381 printf("%.*s\n", tokens[i].end - tokens[i].start, js + tokens[i].start);
397 const char *js;
400 js = "{\"a\":\"\\uAbcD\"}";
402 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
405 js = "{\"a\":\"str\\u0000\"}";
407 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
410 js = "{\"a\":\"\\uFFFFstr\"}";
412 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
415 js = "{\"a\":\"str\\uFFGFstr\"}";
417 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
420 js = "{\"a\":\"str\\u@FfF\"}";
422 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
425 js = "{\"a\":[\"\\u028\"]}";
427 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
430 js = "{\"a\":[\"\\u0280\"]}";
432 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
439 const char *js;
444 js = "{\"a\": 0}garbage";
447 r = jsmn_parse(&p, js, 8, tokens, 10);
449 check(TOKEN_STRING(js, tokens[0], "{\"a\": 0}"));
450 check(TOKEN_STRING(js, tokens[1], "a"));
451 check(TOKEN_STRING(js, tokens[2], "0"));
458 const char *js;
460 js = "{}";
462 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 1);
464 js = "[]";
466 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 1);
468 js = "[[]]";
470 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 2);
472 js = "[[], []]";
474 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 3);
476 js = "[[], []]";
478 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 3);
480 js = "[[], [[]], [[], []]]";
482 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 7);
484 js = "[\"a\", [[], []]]";
486 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 5);
488 js = "[[], \"[], [[]]\", [[]]]";
490 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 5);
492 js = "[1, 2, 3]";
494 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 4);
496 js = "[1, 2, [3, \"a\"], null]";
498 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 7);
504 const char *js;
509 js = "{\"a\": 0, \"b\": \"c\"}";
512 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
518 js = "{\"a\"\n0}";
520 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
523 js = "{\"a\", 0}";
525 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
528 js = "{\"a\": {2}}";
530 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
533 js = "{\"a\": {2: 3}}";
535 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
539 js = "{\"a\": {\"a\": 2 3}}";
541 r = jsmn_parse(&p, js, strlen(js), tokens, 10);
569 const char *js;
574 js = "a: 0garbage";
577 r = jsmn_parse(&p, js, 4, tokens, 10);
579 check(TOKEN_STRING(js, tokens[0], "a"));
580 check(TOKEN_STRING(js, tokens[1], "0"));
582 js = "Day : 26\nMonth : Sep\n\nYear: 12";
584 r = jsmn_parse(&p, js, strlen(js), tokens, 10);