ptrdiff_t off = 0;
enum YACErr err = YACAtomDecode(&atom, buf, len);
if (err != YACErrNo) {
- fprintf(stderr, "map err: %d\n", err);
+ fprintf(stderr, "err: %d\n", err);
return EXIT_FAILURE;
}
off += atom.off;
if (atom->typ != YACItemStr) {
return YACErrMapBadKey;
}
+ if (atom->len == 0) {
+ return YACErrMapBadKey;
+ }
if (atom->len < keyLen) {
return YACErrMapUnordered;
}
}
{
s := sub.V.(string)
+ if len(s) == 0 {
+ err = ErrMapBadKey
+ return
+ }
if len(s) < len(keyPrev) {
err = ErrMapUnordered
return
if not isinstance(k, Str):
raise DecodeError("non-string key")
k = str(k)
+ if len(k) == 0:
+ raise DecodeError("empty key")
if (len(k) < len(kPrev)) or ((len(k) == len(kPrev)) and (k <= kPrev)):
raise DecodeError("unsorted keys")
v, data = Decode(data)
@end verbatim
MAP contains concatenation of @ref{Strings, STR(key)}-value pairs. Keys
-@strong{must} be unique and length-first bytewise ascending ordered.
+@strong{must} be non-empty, unique and length-first bytewise ascending ordered.
@verbatim
MAP [STR(KEY0) || ITEM0 || STR(KEY1) || ITEM1 || ... ] EOC