class SyntaxTree::YARV::ToRegExp

### Summary

‘toregexp` pops a number of values off the stack, combines them into a new regular expression, and pushes the new regular expression onto the stack.

### Usage

~~~ruby /foo #{bar}/ ~~~

Attributes

length[R]
options[R]

Public Class Methods

new(options, length) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5703
def initialize(options, length)
  @options = options
  @length = length
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5720
def ==(other)
  other.is_a?(ToRegExp) && other.options == options &&
    other.length == length
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5733
def call(vm)
  vm.push(Regexp.new(vm.pop(length).join, options))
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5716
def deconstruct_keys(_keys)
  { options: options, length: length }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5708
def disasm(fmt)
  fmt.instruction("toregexp", [fmt.object(options), fmt.object(length)])
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5725
def pops
  length
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5729
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5712
def to_a(_iseq)
  [:toregexp, options, length]
end