Comments (2)
@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.
Sounds good, thanks for the explanation. Good luck having this fixed ;)
from kaitai_struct_webide.
Related Issues (20)
- Non-descriptive error messages
- Display TLV Formats in Object Tree HOT 1
- Enums bugs HOT 3
- Missing link to user manual HOT 4
- [feature suggestion] Autorun HOT 2
- "Parse error (RangeError): invalid or out-of-range index" after changing KSY in editor HOT 1
- `-webide-representation` key not working for imported types HOT 1
- Parse error (TypeError): ksyType.instancesByJsName is undefined
- Strings in UTF-16 encodings does not decoded correctly HOT 3
- Long (?) binary data exported in JSON as `{ "$start": x, "$end": y }` instead of an array
- Add ability to inject custom JS code for processors HOT 2
- Feature request: update object-tree selection on keyboard navigation
- Ability to create link to IDE with custom urls for format specification and binary file HOT 2
- `to-string` is broken: `Parse error (TypeError): ksyType.instancesByJsName is undefined`
- Feature request: although parsing has failed, show all the parsed tree till the fail HOT 2
- electron (or equivalent) build for local desktop use? HOT 1
- Distribute kaitai_struct_webide as Electron application and npm module HOT 6
- Empty object tree and error on opening ide with zip example HOT 3
- `-webide-representation` doesn't work for arrays of primitive values HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaitai_struct_webide.