Class: Expressive::List

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/expressive.rb

Instance Method Summary collapse

Instance Method Details

#eval(scope) ⇒ Object



78
79
80
81
82
83
84
85
# File 'lib/expressive.rb', line 78

def eval(scope)
  first_elem = statements.first.eval(scope)
  if first_elem.is_a? Function
    first_elem.call(scope, statements[1..-1])
  else
    statements.map {|stat| stat.eval(scope) }
  end
end

#statementsObject



74
75
76
# File 'lib/expressive.rb', line 74

def statements
  elements[1].elements.map {|e| e.data }
end