Method: RubyToAnsiC#process_lit

Defined in:
lib/ruby_to_ansi_c.rb

#process_lit(exp) ⇒ Object

Literals, numbers for the most part. Will probably cause compilation errors if you try to translate bignums and other values that don’t have analogs in the C world. Sensing a pattern?



560
561
562
563
564
565
566
567
568
569
570
571
572
573
# File 'lib/ruby_to_ansi_c.rb', line 560

def process_lit(exp)
  # TODO what about floats and big numbers?

  value = exp.shift
  sexp_type = exp.sexp_type
  case sexp_type
  when Type.long, Type.float then
    return value.to_s
  when Type.symbol then
    return value.to_s.inspect
  else
    raise "Bug! no: Unknown literal #{value}:#{value.class}"
  end
end