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

Not worked with grammars with parameters #33

Open
Mingun opened this issue Jan 9, 2020 · 0 comments
Open

Not worked with grammars with parameters #33

Mingun opened this issue Jan 9, 2020 · 0 comments

Comments

@Mingun
Copy link

Mingun commented Jan 9, 2020

If ksy contains key params at top-level, then visualizer crashed with error:

$ ksv msg kaitai-struct/ddc.ksy 
Compilation OK
... processing kaitai-struct/ddc.ksy 0
...... loading ddc.rb
Classes loaded OK, main class = Ddc
/tmp/d20200109-15900-1lqithx/ddc.rb:12:in `initialize': wrong number of arguments (given 1, expected 2..4) (ArgumentError)
	from /var/lib/gems/2.3.0/gems/kaitai-struct-0.8/lib/kaitai/struct/struct.rb:26:in `new'
	from /var/lib/gems/2.3.0/gems/kaitai-struct-0.8/lib/kaitai/struct/struct.rb:26:in `from_file'
	from /var/lib/gems/2.3.0/gems/kaitai-struct-visualizer-0.7/lib/kaitai/struct/visualizer/parser.rb:28:in `load'
	from /var/lib/gems/2.3.0/gems/kaitai-struct-visualizer-0.7/lib/kaitai/struct/visualizer/visualizer.rb:13:in `run'
	from /var/lib/gems/2.3.0/gems/kaitai-struct-visualizer-0.7/bin/ksv:53:in `<top (required)>'
	from /usr/local/bin/ksv:23:in `load'
	from /usr/local/bin/ksv:23:in `<main>'

Generated struct has following definition:

class Ddc < Kaitai::Struct::Struct
  def initialize(_io, _parent = nil, _root = self, has_mac)
    super(_io, _parent, _root)
    @has_mac = has_mac
    _read
  end
  ...

Original ksv:

meta:
  id: ddc
params:
  - id: has_mac
    type: bool
seq:
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant