class Hammer::Internal::HParsedToken
Public Instance Methods
bit_offset()
click to toggle source
# File lib/hammer/internal.rb, line 247 def bit_offset self[:bit_offset] end
bytes()
click to toggle source
# File lib/hammer/internal.rb, line 233 def bytes raise ArgumentError, 'wrong token type' unless token_type == :bytes self[:data][:bytes] end
data()
click to toggle source
TODO: Is this name ok?
# File lib/hammer/internal.rb, line 225 def data return self[:data][:bytes].token if token_type == :bytes return self[:data][:sint] if token_type == :sint return self[:data][:uint] if token_type == :uint return self[:data][:seq].elements if token_type == :sequence return self[:data][:user] if token_type == :user end
index()
click to toggle source
# File lib/hammer/internal.rb, line 243 def index self[:index] end
normalize()
click to toggle source
# File lib/hammer/internal.rb, line 214 def normalize # If I'm null, return nil. return nil if null? return self end
seq()
click to toggle source
# File lib/hammer/internal.rb, line 238 def seq raise ArgumentError, 'wrong token type' unless token_type == :sequence self[:data][:seq] end
token_type()
click to toggle source
# File lib/hammer/internal.rb, line 220 def token_type self[:token_type] end
unmarshal()
click to toggle source
# File lib/hammer/internal.rb, line 255 def unmarshal Hammer::Internal::HTokenType.class_variable_get(:@@from_hpt)[token_type].call self end
user(struct)
click to toggle source
# File lib/hammer/internal.rb, line 251 def user(struct) struct.by_ref.from_native(self[:data][:user], nil) end