Last active
December 12, 2016 03:01
-
-
Save marcotc/40f5d5f6edb475759f5bc41d63cdd754 to your computer and use it in GitHub Desktop.
Parser for Named Binary Tag (NBT), in Kaitai format (http://kaitai.io/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
meta: | |
id: nbt | |
file-extension: nbt | |
endian: be | |
application: Named Binary Tag (NBT) | |
seq: | |
- id: tag_compound | |
type: tag_compound | |
types: | |
tag_byte: | |
seq: | |
- id: content | |
contents: s1 | |
tag_short: | |
seq: | |
- id: content | |
contents: s2 | |
tag_int: | |
seq: | |
- id: content | |
contents: s4 | |
tag_long: | |
seq: | |
- id: content | |
contents: s8 | |
tag_float: | |
seq: | |
- id: content | |
contents: f4 | |
tag_double: | |
seq: | |
- id: content | |
contents: f8 | |
tag_byte_array: | |
seq: | |
- id: length | |
contents: tag_int | |
- id: content | |
size: length | |
tag_string: | |
seq: | |
- id: length | |
contents: tag_short | |
- id: content | |
size: length | |
type: str | |
encoding: UTF-8 | |
tag_list: | |
seq: | |
- id: tag_id | |
contents: tag_byte | |
- id: length | |
contents: tag_int | |
- id: content | |
repeat-expr: length | |
repeat: expr | |
type: | |
switch-on: tag_id | |
cases: | |
1: tag_byte | |
2: tag_short | |
3: tag_int | |
4: tag_long | |
5: tag_float | |
6: tag_double | |
7: tag_byte_array | |
8: tag_string | |
9: tag_list | |
10: tag_compound | |
tag_compound: | |
seq: | |
- id: tag_type | |
type: u1 | |
- id: tag_name | |
type: tag_string | |
- id: payload | |
type: | |
switch-on: tag_type | |
cases: | |
1: tag_byte | |
2: tag_short | |
3: tag_int | |
4: tag_long | |
5: tag_float | |
6: tag_double | |
7: tag_byte_array | |
8: tag_string | |
9: tag_list | |
10: tag_compound | |
- id: tag_end | |
contents: [0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment