Class: CodeTools::AST::DynamicRegex

Inherits:
DynamicString show all
Defined in:
lib/rubinius/code/ast/literals.rb

Direct Known Subclasses

DynamicOnceRegex

Instance Attribute Summary

Attributes inherited from DynamicString

#array, #options

Attributes inherited from StringLiteral

#string

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from DynamicString

#defined

Methods inherited from StringLiteral

#defined

Methods inherited from Node

#ascii_graph, #attributes, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

#initialize(line, str, array, flags) ⇒ DynamicRegex

Returns a new instance of DynamicRegex.



545
546
547
548
# File 'lib/rubinius/code/ast/literals.rb', line 545

def initialize(line, str, array, flags)
  super line, str, array
  @options = flags || 0
end

Instance Method Details

#bytecode(g) ⇒ Object



550
551
552
553
554
555
556
# File 'lib/rubinius/code/ast/literals.rb', line 550

def bytecode(g)
  g.push_cpath_top
  g.find_const :Regexp
  super(g)
  g.push_int @options
  g.send :new, 2
end

#sexp_nameObject



558
559
560
# File 'lib/rubinius/code/ast/literals.rb', line 558

def sexp_name
  :dregx
end

#to_sexpObject



562
563
564
565
566
# File 'lib/rubinius/code/ast/literals.rb', line 562

def to_sexp
  sexp = super
  sexp << @options if @options != 0
  sexp
end