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.



576
577
578
579
# File 'lib/rubinius/code/ast/literals.rb', line 576

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

Instance Method Details

#bytecode(g) ⇒ Object



581
582
583
584
585
586
587
# File 'lib/rubinius/code/ast/literals.rb', line 581

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

#sexp_nameObject



589
590
591
# File 'lib/rubinius/code/ast/literals.rb', line 589

def sexp_name
  :dregx
end

#to_sexpObject



593
594
595
596
597
# File 'lib/rubinius/code/ast/literals.rb', line 593

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