Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent hex literals in pos: #456

Closed
JKAnderson opened this issue Jul 5, 2018 · 4 comments · Fixed by kaitai-io/kaitai_struct_webide#166
Closed

Inconsistent hex literals in pos: #456

JKAnderson opened this issue Jul 5, 2018 · 4 comments · Fixed by kaitai-io/kaitai_struct_webide#166

Comments

@JKAnderson
Copy link

Starting a pos: expression with a hex literal gives very undesirable results. For instance:

instances:
  compressed:
    io: _root._io
    pos: 0x44 + _parent.compression_header_size + offset
    size: size

Generates code:

io.Seek(19332502143299584);

Placing the literal in the middle or at the end behaves as expected:

instances:
  compressed:
    io: _root._io
    pos: _parent.compression_header_size + offset + 0x44
    size: size

Generated code:

io.Seek(((M_Parent.CompressionHeaderSize + Offset) + 68));
@GreyCat
Copy link
Member

GreyCat commented Jul 5, 2018

I suspect that it's only for JavaScript version of ksc, running in IDE? JVM-based version doesn't seem to exhibit this behavior?

If yes, the problem is with the JS YAML parser (which is not really something we can fix without writing our own parser), and I believe I've seen that bug filed in the past, I'll try to find the reference now.

The simple workaround is just use quotes around the expression to clearly state that it's a string, not a hex number.

@FireyFly
Copy link

FireyFly commented Jul 6, 2018

If there isn't one already, probably at least a bug should be filed upstream? And possibly other alternative yaml libraries could be looked into--three should be a few for JS probably.

@KOLANICH
Copy link

KOLANICH commented Jul 6, 2018

And possibly other alternative yaml libraries could be looked into--three should be a few for JS probably.

See #229

@JKAnderson
Copy link
Author

Correct, using the web IDE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants