class Haml::Exec::Haml

def process_result

and runs the Haml compiler appropriately.
Processes the options set by the command-line arguments,
def process_result
  super
  @options[:for_engine][:filename] = @options[:filename]
  input = @options[:input]
  output = @options[:output]
  template = input.read()
  input.close() if input.is_a? File
  @options[:load_paths].each {|p| $LOAD_PATH << p}
  @options[:requires].each {|f| require f}
  begin
    engine = ::Haml::Engine.new(template, @options[:for_engine])
    if @options[:check_syntax]
      puts "Syntax OK"
      return
    end
    if @options[:parse]
      pp engine.parser.root
      return
    end
    if @options[:debug]
      puts engine.precompiled
      puts '=' * 100
    end
    result = engine.to_html
  rescue Exception => e
    raise e if @options[:trace]
    case e
    when ::Haml::SyntaxError; raise "Syntax error on line #{get_line e}: #{e.message}"
    when ::Haml::Error;       raise "Haml error on line #{get_line e}: #{e.message}"
    else raise "Exception on line #{get_line e}: #{e.message}"
    end
  end
  output.write(result)
  output.close() if output.is_a? File
end