Class: X86Assembler::Operand
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
45 46 47 |
# File 'lib/rmasm/x86/x86_assembler.rb', line 45 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
45 46 47 |
# File 'lib/rmasm/x86/x86_assembler.rb', line 45 def value @value end |
Class Method Details
.parse(*expr_list) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/rmasm/x86/x86_assembler.rb', line 47 def self.parse(*expr_list) ops = [] expr_list.each do |expr| op = Operand.new ops << op op.value = expr # Is expression an immediate value if expr.is_a?(Integer) op.type = :imm # todo, check value size elsif expr.is_a?(RMasm::Register) op.type = :register elsif expr.is_a?(Symbol) op.type = :label; elsif expr.is_a?(String) op.type = :string; else op.type = :addr # else we have an address or an invalid expression if expr.is_a?(RMasm::Modifier) elsif expr.is_a?(Array) else RMasm::Report.error("Unexpected expression found #{expr.inspect}") end end end ops end |
Instance Method Details
#to_s ⇒ Object
77 78 79 |
# File 'lib/rmasm/x86/x86_assembler.rb', line 77 def to_s() "Op type=#{@type} value=#{value}" end |