From: Jean Privat Date: Sat, 17 Oct 2015 02:30:31 +0000 (-0400) Subject: highlight: only highlight the given node, not the whole AST X-Git-Tag: v0.7.9~27^2~5 X-Git-Url: http://nitlanguage.org highlight: only highlight the given node, not the whole AST Signed-off-by: Jean Privat --- diff --git a/src/highlight.nit b/src/highlight.nit index 2a139ee..7bce52d 100644 --- a/src/highlight.nit +++ b/src/highlight.nit @@ -53,8 +53,22 @@ class HighlightVisitor fun enter_visit(n: ANode) do n.parentize_tokens - var s = n.location.file - htmlize(s.first_token.as(not null), s.last_token.as(not null)) + + var f + var l + + if n isa Token then + f = n + l = n + else + assert n isa Prod + f = n.first_token + if f == null then return + l = n.last_token + if l == null then return + end + + htmlize(f, l) end private fun full_tag(anode: ANode, hv: HighlightVisitor): nullable HTMLTag