Class: Jabs::Engine

Inherits:
Fold::Engine
  • Object
show all
Defined in:
lib/jabs/engine.rb

Instance Method Summary collapse

Instance Method Details

#render(context = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/jabs/engine.rb', line 3

def render context=nil
  @p = precompiler_class.new
  root = Johnson::Nodes::SourceElements.new 0, 0
  main = Johnson::Nodes::SourceElements.new 0, 0
  root << @p.johnsonize(@p.call([:function, nil, [], main]))
  
  @p.fold(lines).children.each{|c|main << @p.johnsonize(c.render)}
  root.to_ecma
rescue Fold::FoldFactory::IndentationError => e
  require 'pp'
  pp lines
  puts "______------UP"
  raise e
end