Class: RMasm::Label

Inherits:
Directive show all
Defined in:
lib/rmasm/label.rb

Instance Attribute Summary collapse

Attributes inherited from Directive

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Directive

#fetch

Constructor Details

#initialize(label) ⇒ Label

Returns a new instance of Label.



50
51
52
53
# File 'lib/rmasm/label.rb', line 50

def initialize(label)
  super :label
  @label = label
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



48
49
50
# File 'lib/rmasm/label.rb', line 48

def label
  @label
end

Class Method Details

.define(*args) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/rmasm/label.rb', line 55

def self.define(*args)
  # Check arguments
  if (args.length != 1)
    return Report.error(:ARGS, args.length, "1", "label :your_symbol or __:your_symbol")
  end

  sym = args[0]
  if !sym.is_a?(Symbol)
    return Report.error(:R0031, sym)
  end
  
  instr = Label.new(sym)
  instr.fetch
end

Instance Method Details

#to_sObject



70
71
72
# File 'lib/rmasm/label.rb', line 70

def to_s()
  "Label #{@label}"
end