acfoltzer / nbt

A parser/serializer for Minecraft's Named Binary Tag (NBT) data format.
BSD 3-Clause "New" or "Revised" License
22 stars 8 forks source link

move "Maybe String" to a map in CompoundTag #4

Closed ghost closed 11 years ago

ghost commented 11 years ago

If you read the specification carefully, there is only one place where named tags can exist: inside compound tags. There are two tags which can contain other nodes, i.e. lists and compounds, and lists only contains unnamed tags. The root of any NBT file is also unnamed. Furthermore, within a compound tag, names must be unique.

So I propose the removal the Maybe String field in every node, and put a Data.Map.Map String NBT in CompoundTag instead of a [NBT]. This adds another dependency for this package (containers), but it's a commonly used package, so that should be fine.

ghost commented 11 years ago

I just noticed that the root of an NBT is also always named, which complicates matters.

ghost commented 11 years ago

Fixed by merging #5.