Open
Description
KSC 0.11-SNAPSHOT at 91aeb53e
compiles executable/dex.ksy
with the following warnings:
$ kaitai-struct-compiler -- -I . -t python --verbose file executable/dex.ksy
parsing executable/dex.ksy...
reading executable/dex.ksy...
reading ./common/vlq_base128_le.ksy...
... compiling it for python...
.... writing dex.py
.... writing vlq_base128_le.py
executable/dex.ksy: /types/map_list/seq/0/id:
warning: use `num_list` instead of `size`, (...)
executable/dex.ksy: /types/type_list/seq/0/id:
warning: use `num_list` instead of `size`, (...)
executable/dex.ksy: /types/class_def_item/instances/type_name/encoding:
warning: use canonical encoding name `ASCII` instead of `ascii` (see https://doc.kaitai.io/ksy_style_guide.html#encoding-name)
executable/dex.ksy: /types/header_item/seq/1/encoding:
warning: use canonical encoding name `ASCII` instead of `ascii` (see https://doc.kaitai.io/ksy_style_guide.html#encoding-name)
The dex.ksy
spec has 2 occurrences of encoding
:
-
/types/header_item/seq/1/encoding
- seeexecutable/dex.ksy:143-151
types: header_item: seq: - id: magic contents: "dex\n" - id: version_str size: 4 type: strz encoding: ascii
-
/types/string_id_item/types/string_data_item/seq/1/encoding
- seeexecutable/dex.ksy:275-284
types: # ... string_id_item: # ... types: string_data_item: -webide-representation: "{data}" seq: - id: utf16_size type: vlq_base128_le - id: data size: utf16_size.value type: str encoding: ascii
As you can see, the warning was correctly reported at /types/header_item/seq/1/encoding
, i.e. on the 1st occurrence of encoding
in the spec. However, it was not reported on the 2nd occurrence of encoding
, i.e. at /types/string_id_item/types/string_data_item/seq/1/encoding
.
Instead, it was reported at /types/class_def_item/instances/type_name/encoding
:
executable/dex.ksy: /types/class_def_item/instances/type_name/encoding:
warning: use canonical encoding name `ASCII` instead of `ascii` (see https://doc.kaitai.io/ksy_style_guide.html#encoding-name)
But /types/class_def_item/instances/type_name
is a value instance that doesn't have the encoding
key:
instances:
type_name:
value: _root.type_ids[class_idx].type_name
-webide-parse-mode: eager