nitlight: include whole lines and loose tookens
[nit.git] / src / nitlight.nit
index a81f845..f23bcd3 100644 (file)
@@ -19,9 +19,6 @@ import highlight
 
 var toolcontext = new ToolContext
 
-# Disable `cached` because it causes issues when printing transformed AST. FIXME
-toolcontext.cached_phase.disabled = true
-
 # Try to colorize, even if programs are non valid
 toolcontext.keep_going = true
 
@@ -41,7 +38,7 @@ var modelbuilder = new ModelBuilder(model, toolcontext)
 
 var args = toolcontext.option_context.rest
 
-var mmodules = modelbuilder.parse(args)
+var mmodules = modelbuilder.parse_full(args)
 modelbuilder.run_phases
 
 if opt_full.value then mmodules = model.mmodules
@@ -55,13 +52,15 @@ else if mmodules.length > 1 then
 end
 
 for mm in mmodules do
-       if dir != null then toolcontext.info("write {dir}/{mm.name}.html", 1)
+       if dir != null then toolcontext.info("write {dir}/{mm.c_name}.html", 1)
 
        var v = new HighlightVisitor
        var prefix = opt_line_id_prefix.value
        if prefix != null then
                v.line_id_prefix = prefix.trim
        end
+       v.include_loose_tokens = true
+       v.include_whole_lines = true
 
        if opt_first_line.value != 0 then v.first_line = opt_first_line.value
        if opt_last_line.value != 0 then v.last_line = opt_last_line.value
@@ -97,7 +96,7 @@ for mm in mmodules do
        end
 
        if dir != null then
-               page.write_to_file("{dir}/{mm.name}.html")
+               page.write_to_file("{dir}/{mm.c_name}.html")
        else
                page.write_to(stdout)
        end
@@ -116,15 +115,15 @@ if dir != null then
                var n2 = new HTMLTag("a")
                page.add n
                n.add n2
-               n2.attr("href", "{mm.name}.html")
-               n2.text(mm.name)
+               n2.attr("href", "{mm.c_name}.html")
+               n2.text(mm.full_name)
        end
        page.add_raw_html "</li></body>"
        page.write_to_file("{dir}/index.html")
 
        var v = new HighlightVisitor
        toolcontext.info("write {dir}/style.css", 1)
-       var f = new OFStream.open("{dir}/style.css")
+       var f = new FileWriter.open("{dir}/style.css")
        f.write v.css_content
        f.close
 end