Class: Sexp

Inherits:
Object
  • Object
show all
Defined in:
lib/roodi/core/sexp.rb

Instance Method Summary collapse

Instance Method Details

#accept(visitor) ⇒ Object


4
5
6
# File 'lib/roodi/core/sexp.rb', line 4

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

#childrenObject


12
13
14
# File 'lib/roodi/core/sexp.rb', line 12

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

#is_language_node?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'lib/roodi/core/sexp.rb', line 16

def is_language_node?
  first.class == Symbol
end

#node_typeObject


8
9
10
# File 'lib/roodi/core/sexp.rb', line 8

def node_type
  first
end

#visitable_childrenObject


20
21
22
23
# File 'lib/roodi/core/sexp.rb', line 20

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