Commits

Anonymous committed 7825e7d

fixed strict mode: space symbols are allowed after primitives; added some new tests

  • Participants
  • Parent commits 0c208cc

Comments (0)

Files changed (2)

 		switch (js[parser->pos]) {
 #ifndef JSMN_STRICT
 			/* In strict mode primitive must be followed by "," or "}" or "]" */
-			case '\t' : case '\r' : case '\n' : case ' ' : case ':': 
+			case ':':
 #endif
+			case '\t' : case '\r' : case '\n' : case ' ' :
 			case ','  : case ']'  : case '}' :
 				goto found;
 		}
 	check(TOKEN_STRING(js, tokens[1], "a"));
 	check(TOKEN_STRING(js, tokens[2], "0"));
 
+	js = "[\"a\":{},\"b\":{}]";
+	r = jsmn_parse(&p, js, tokens, 10);
+	check(r == JSMN_SUCCESS);
+
+	js = "{\n \"Day\": 26,\n \"Month\": 9,\n \"Year\": 12\n }";
+	r = jsmn_parse(&p, js, tokens, 10);
+	check(r == JSMN_SUCCESS);
+
 	return 0;
 }
 
 	jsmn_parser p;
 	jsmntok_t tok[10];
 	const char *js;
-
+#ifndef JSMN_STRICT
 	js = "\"boolVar\" : true";
 	jsmn_init(&p);
 	r = jsmn_parse(&p, js, tok, 10);
 			&& tok[1].type == JSMN_PRIMITIVE);
 	check(TOKEN_STRING(js, tok[0], "nullVar"));
 	check(TOKEN_STRING(js, tok[1], "null"));
-
+#endif
 	return 0;
 }