kaitai-io / kaitai_struct_webide

Online editor / visualizer for Kaitai Struct .ksy files
https://ide.kaitai.io
GNU General Public License v3.0
278 stars 62 forks source link

Enchance webide-representation support #112

Open VitaliyZaharenko opened 4 years ago

VitaliyZaharenko commented 4 years ago

I have two issues that's related to -webide-representation

  1. When we define type in external file(to use it with import in some other .ksy file) we have no way to use -webide-representation. Seems that obj, which passed to
    // paresedToTree.ts
    reprObject(obj: IExportedValue): string

    have ksyType undefined on imported types.

  2. I think we need more flexible way to represent values in -webide-representation. Especially numeric types. It would be nice to add the ability to limit the number of decimal places for float numbers. When we parse vectors, quaternions or matrices, this is especially desirable. Maybe in addition to hex, dec etc add len attribute, something like "{x:len=3} Or add more general dsl for value manipulations, like c format string or smth.
GreyCat commented 4 years ago

@VitaliyZaharenko Likely we'll try to deprecate -webide-representation and replace it with more universal to-string, as per https://github.com/kaitai-io/kaitai_struct/issues/732.

Basically, the idea is to reuse existing KS expression language syntax, so we'd likely enhance KS expression language so it will include interpolated strings, rich formatting, etc.