From: Jean Privat Date: Fri, 10 Jun 2016 13:46:21 +0000 (-0400) Subject: highlight: can hightlight a full source file (not a specific node) X-Git-Url: http://nitlanguage.org highlight: can hightlight a full source file (not a specific node) Signed-off-by: Jean Privat --- diff --git a/src/highlight.nit b/src/highlight.nit index 59e5370..75a6a8d 100644 --- a/src/highlight.nit +++ b/src/highlight.nit @@ -131,8 +131,16 @@ class HighlightVisitor return tag end + # Highlight a full lexed source file. + # + # REQUIRE `source.first_token != null` + fun hightlight_source(source: SourceFile) + do + htmlize(source.first_token.as(not null), null) + end + # Produce HTML between two tokens - protected fun htmlize(first_token, last_token: Token) + protected fun htmlize(first_token: Token, last_token: nullable Token) do var stack2 = new Array[HTMLTag] var stack = new Array[Prod]