Module: Trxl::StatementList2

Defined in:
lib/trxl/trxl_grammar.rb

Instance Method Summary collapse

Instance Method Details

#eval(env = Environment.new) ⇒ Object



186
187
188
189
190
191
192
193
194
# File 'lib/trxl/trxl_grammar.rb', line 186

def eval(env = Environment.new)
  last_eval = nil
  #env.enter_scope
  expressions.each do |e|
    last_eval = e.eval(env)
  end
  #env.exit_scope
  last_eval
end

#expressionsObject



196
197
198
# File 'lib/trxl/trxl_grammar.rb', line 196

def expressions
  [ expression ] + more_expressions.elements.map { |e| e.expression }
end

#to_s(env = Environment.new) ⇒ Object



200
201
202
# File 'lib/trxl/trxl_grammar.rb', line 200

def to_s(env = Environment.new)
  expressions.map { |e| e.to_s(env) }.join(' ')
end