Method: MicroCisc::Compile::Instruction#validate_boolean
- Defined in:
- lib/micro_cisc/compile/instruction.rb
#validate_boolean(component, current) ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/micro_cisc/compile/instruction.rb', line 137 def validate_boolean(component, current) raise ArgumentError, "Duplicate #{component.last} value" if current if component.first == component.last # Was used with syntax sugar without the numeric argument component[0] = 1 end unless (0..1).include?(component.first) raise ArgumentError, "Value of #{component.last} must be 0x0 or 0x1 instead of 0x#{component.first.to_s(16).upcase}" end component.first end |