class Kaitai::Struct::Visualizer::Parser
Base class for everything that deals with compiling .ksy and parsing stuff as object tree.
Attributes
data[R]
Public Class Methods
new(compiler, bin_fn, formats_fn, opts)
click to toggle source
# File lib/kaitai/struct/visualizer/parser.rb, line 17 def initialize(compiler, bin_fn, formats_fn, opts) @compiler = compiler @bin_fn = bin_fn @formats_fn = formats_fn @opts = opts end
Public Instance Methods
load()
click to toggle source
# File lib/kaitai/struct/visualizer/parser.rb, line 24 def load main_class_name = @compiler.compile_formats(@formats_fn) main_class = Kernel::const_get(main_class_name) @data = main_class.from_file(@bin_fn) load_exc = nil begin @data._read rescue EOFError => e load_exc = e rescue Kaitai::Struct::Stream::UnexpectedDataError => e load_exc = e end return load_exc end