class Sexp

Attributes

paren[W]

Public Instance Methods

add_all(x) click to toggle source
# File lib/rp_extensions.rb, line 61
def add_all x
  self.concat x.sexp_body
end
block_pass?() click to toggle source
# File lib/rp_extensions.rb, line 65
def block_pass?
  any? { |s| Sexp === s && s.sexp_type == :block_pass }
end
check_line_numbers() click to toggle source
# File lib/ruby_parser_extras.rb, line 11
def check_line_numbers
  raise "bad nil line for:\n%s" % [self.pretty_inspect] if nil_line?
  raise "bad line number for:\n%s" % [self.pretty_inspect] unless
    Integer === self.line &&
    self.line >= 1 &&
    self.line <= self.line_min
end
line_min() click to toggle source

Returns the maximum line number of the children of self.

# File lib/ruby_parser_extras.rb, line 22
def line_min
  @line_min ||= [self.deep_each.map(&:line).min, self.line].compact.min
end
nil_line?() click to toggle source
# File lib/ruby_parser_extras.rb, line 26
def nil_line?
  self.deep_each.map(&:line).any?(&:nil?)
end
paren() click to toggle source
# File lib/rp_extensions.rb, line 45
def paren
  @paren ||= false
end
to_sym() click to toggle source
# File lib/rp_extensions.rb, line 54
def to_sym
  raise "no: #{self.inspect}.to_sym is a bug"
  self.value.to_sym
end
value() click to toggle source
# File lib/rp_extensions.rb, line 49
def value
  raise "multi item sexp" if size > 2
  last
end