Method: MicroCisc::Compile::Instruction#parse_component

Defined in:
lib/micro_cisc/compile/instruction.rb

#parse_component(component) ⇒ Object



109
110
111
112
113
114
115
116
117
118
# File 'lib/micro_cisc/compile/instruction.rb', line 109

def parse_component(component)
  parts = component.split('.')
  if /^-{0,1}[0-9A-Fa-f]+$/.match(parts.first)
    [parts.first.to_i, parts.last.downcase]
  elsif /^-{0,1}(0x){0,1}[0-9A-Fa-f]+$/.match(parts.first)
    [parts.first.to_i(16), parts.last.downcase]
  else
    [parts.first, parts.last.downcase]
  end
end