Class: AVR::OpcodeDecoder::OperandParser
- Inherits:
-
Object
- Object
- AVR::OpcodeDecoder::OperandParser
- Extended by:
- T::Sig
- Defined in:
- lib/avr/opcode_decoder.rb
Constant Summary collapse
- ProcType =
T.type_alias do T.proc.params(cpu: CPU, operands: Opcode::OperandValueHashType).returns(Opcode::OperandValueHashType) end
Instance Attribute Summary collapse
-
#parse_proc ⇒ Object
readonly
Returns the value of attribute parse_proc.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(pattern, parse_proc) ⇒ OperandParser
constructor
A new instance of OperandParser.
- #parse(cpu, operands) ⇒ Object
Constructor Details
#initialize(pattern, parse_proc) ⇒ OperandParser
Returns a new instance of OperandParser.
101 102 103 104 |
# File 'lib/avr/opcode_decoder.rb', line 101 def initialize(pattern, parse_proc) @pattern = T.let(pattern.gsub(/[^01a-zA-Z_]/, ''), String) @parse_proc = T.let(parse_proc, OperandParser::ProcType) end |
Instance Attribute Details
#parse_proc ⇒ Object (readonly)
Returns the value of attribute parse_proc.
98 99 100 |
# File 'lib/avr/opcode_decoder.rb', line 98 def parse_proc @parse_proc end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
91 92 93 |
# File 'lib/avr/opcode_decoder.rb', line 91 def pattern @pattern end |
Instance Method Details
#parse(cpu, operands) ⇒ Object
107 108 109 |
# File 'lib/avr/opcode_decoder.rb', line 107 def parse(cpu, operands) parse_proc.call(cpu, operands) end |