Sha256: 72f6bc090f362853ab0570534c927e209d7ef5f155cd1ff593668bc79ffd7f5c

Contents?: true

Size: 337 Bytes

Versions: 8

Compression:

Stored size: 337 Bytes

Contents

require 'sexp'

class Sexp
  def accept(visitor)
    visitor.visit(self)
  end

  def node_type
    first
  end

  def children
    find_all { | sexp | Sexp === sexp }
  end

  def is_language_node?
    first.class == Symbol
  end

  def visitable_children
    parent = is_language_node? ? sexp_body : self
    parent.children
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
roodi-5.0.0 lib/roodi/core/sexp.rb
roodi-4.1.1 lib/roodi/core/sexp.rb
roodi-4.1.0 lib/roodi/core/visitable_sexp.rb
roodi-4.0.0 lib/roodi/core/visitable_sexp.rb
roodi-3.3.1 lib/roodi/core/visitable_sexp.rb
roodi-3.3.0 lib/roodi/core/visitable_sexp.rb
roodi-3.2.0 lib/roodi/core/visitable_sexp.rb
roodi-3.1.1 lib/roodi/core/visitable_sexp.rb