Module: Gisele::Language::Syntax::CaseSt

Includes:
Node
Defined in:
lib/gisele/language/syntax/case_st.rb

Instance Method Summary collapse

Methods included from Node

#to_ast, #value

Instance Method Details

#_to_astObject



7
8
9
10
11
12
13
14
# File 'lib/gisele/language/syntax/case_st.rb', line 7

def _to_ast
  var     = captures[:var_ref].first
  var     = var.to_ast if var
  var     = nil if var && var.empty?
  whens   = captures[:when_clause].map{|x| x.to_ast}
  els     = captures[:else_clause].map{|x| x.to_ast}
  [:case_st, var] + whens + els
end