Skip to content

Commit

Permalink
In haml command, when printing parse tree, only instantiate parser
Browse files Browse the repository at this point in the history
Don't depend on creating an engine just to see the parse tree. This
makes it a bit easier to hack the compiler because you can still see a
parse tree even while you've temporarily broken the compiler during
work.
  • Loading branch information
norman committed Jun 12, 2015
1 parent 59fccea commit c89da38
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/haml/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,16 @@ def process_result

begin

engine = ::Haml::Engine.new(template, @options[:for_engine])
if @options[:check_syntax]
puts "Syntax OK"
if @options[:parse]
parser = ::Haml::Parser.new(template, ::Haml::Options.new(@options))
pp parser.parse
return
end

if @options[:parse]
pp engine.parser.root
engine = ::Haml::Engine.new(template, @options[:for_engine])

if @options[:check_syntax]
puts "Syntax OK"
return
end

Expand Down

0 comments on commit c89da38

Please sign in to comment.