Wouldn't it make sense to return an error if multiple root elements are found and JSMN_STRICT is defined? e.g.
"{}{}"
is not valid JSON and jsmn could/should return an error. This code would do the trick:
}
token->end = parser->pos + 1;
parser->toksuper = token->parent;
+ if (token->parent == -1) {
+#ifdef JSMN_STRICT
+ // ensure that no junk data is present
+ for (; js[parser->pos+1] != '\0'; parser->pos++) {
+ char c;
+ c = js[parser->pos+1];
+ if (!isspace(c)) {
+ return JSMN_ERROR_JUNK;
+ }
+ }
+#endif
+ break;
+ }
break;
}
if (token->parent == -1) {
(Note: I hesitate to create a pull request, as I never used HG as well as Bitbucket so far. But if you're willing to merge this and you want to have a pull request, I'll create one of course)
Wouldn't it make sense to return an error if multiple root elements are found and JSMN_STRICT is defined? e.g. "{}{}" is not valid JSON and jsmn could/should return an error. This code would do the trick:
(Note: I hesitate to create a pull request, as I never used HG as well as Bitbucket so far. But if you're willing to merge this and you want to have a pull request, I'll create one of course)