# Default: false
var include_whole_lines = false is writable
- # The entry-point of the highlighting.
- # Will fill `html` with the generated HTML content.
- fun enter_visit(n: ANode)
+ # Highlight a AST element.
+ fun highlight_node(n: ANode)
do
n.parentize_tokens
l = l.last_real_token_in_line
end
- htmlize(f, l)
+ do_highlight(f, l)
end
private fun full_tag(anode: ANode, hv: HighlightVisitor): nullable HTMLTag
# Highlight a full lexed source file.
#
# REQUIRE `source.first_token != null`
- fun hightlight_source(source: SourceFile)
+ fun highlight_source(source: SourceFile)
do
- htmlize(source.first_token.as(not null), null)
+ do_highlight(source.first_token.as(not null), null)
end
- # Produce HTML between two tokens
- protected fun htmlize(first_token: Token, last_token: nullable Token)
+ # Low-level highlighting between 2 tokens
+ protected fun do_highlight(first_token: Token, last_token: nullable Token)
do
var stack2 = new Array[HTMLTag]
var stack = new Array[Prod]
page.add_raw_html v.head_content
page.add_raw_html "</head><body><pre class='nit_code'>"
end
- v.enter_visit(m)
+ v.highlight_node(m)
if not opt_fragment.value then
page.add(v.html)
page.add_raw_html "</pre>"
var n = mb.mpropdef2node(pd)
if not n isa APropdef then continue
var hl = new TestHighlightVisitor
- hl.enter_visit(n)
+ hl.highlight_node(n)
print "<h1 id=\"{pd.c_name}\">{pd.full_name}</h1>"
printn "<pre><code>"
hl.html.write_to(stdout)
seen.add cn
var hl = new TestHighlightVisitor
- hl.enter_visit(n)
+ hl.highlight_node(n)
print "<h2>AST node: {cn} at {n.location}</h2>"
printn "<pre><code>"
hl.html.write_to(stdout)