Code Monkey home page Code Monkey logo

Comments (2)

generalmimon avatar generalmimon commented on June 15, 2024 1

@bersbersbers Thanks for reporting. This is a Web IDE-specific issue, due to using a crappy YAML parsing library https://github.com/jeremyfa/yaml.js - see https://gitter.im/kaitai_struct/Lobby?at=62e7c3a9cf6cfd27af5f9523.

The YAML parser apparently interprets this:

enums:
  my_enum:
    0b0: x
    0b1: y

as this:

enums:
  my_enum:
    0: x
    0: y

and since duplicate keys cannot be preserved in a YAML map, https://github.com/jeremyfa/yaml.js only keeps the first entry with key 0 (while generating no warning) and we end up with:

enums:
  my_enum:
    0: x

And once this tree is passed to kaitai-struct-compiler running in the browser, it has no way of knowing that this isn't quite what was in the original .ksy source.

At least it's very good that kaitai-struct-compiler since 0.10 handles its part correctly and refuses to compile a .ksy spec that references non-existent enum members.


@bersbersbers So you can't use binary literals as enum keys in the Web IDE at the moment, but hex literals (probably the closest substitute for binary literals) should work just fine:

enums:
  my_enum:
    0x0: x
    0x1: y

from kaitai_struct_webide.

bersbersbers avatar bersbersbers commented on June 15, 2024

Sounds good, thanks for the explanation. Good luck having this fixed ;)

from kaitai_struct_webide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.