In Files

  • ripper/tools/dsl.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

DSL

Attributes

events[R]

Public Class Methods

new(code, options) click to toggle source
 
               # File ripper/tools/dsl.rb, line 14
def initialize(code, options)
  @events = {}
  @error = options.include?("error")
  @brace = options.include?("brace")
  if options.include?("final")
    @final = "p->result"
  else
    @final = (options.grep(/\A\$(?:\$|\d+)\z/)[0] || "$$")
  end
  @vars = 0

  # create $1 == "$1", $2 == "$2", ...
  s = (1..20).map {|n| "$#{n}"}
  re = Array.new(s.size, "([^\0]+)")
  /#{re.join("\0")}/ =~ s.join("\0")

  # struct parser_params *p
  p = p = "p"

  @code = ""
  @last_value = eval(code)
end