nitc :: THLVisitor
nitc :: actors_injection_phase
Injects model for the classes annotated with "is actor" sonitc :: astbuilder
Instantiation and transformation of semantic nodes in the AST of expressions and statementsnitc :: i18n_phase
Basic support of internationalization through the generation of id-to-string tablesSerializable::inspect
to show more useful information
nitc :: modelbuilder
more_collections :: more_collections
Highly specific, but useful, collections-related classes.threaded
annotation
serialization :: serialization_core
Abstract services to serialize Nit objects to different formatsnitc :: serialization_model_phase
Phase generating methods (model-only) to serialize Nit objectsnitc :: toolcontext
Common command-line tool infrastructure than handle options and error messagescore :: union_find
union–find algorithm using an efficient disjoint-set data structure
# Program used to test the Nit highlighter
module test_highlight
import htmlight
import test_phase
class TestHighlightVisitor
super HtmlightVisitor
redef fun hrefto(e) do
return "#" + e.c_name
end
end
redef fun do_work(mainmodule, mmodules, mb)
do
var v = new TestHighlightVisitor
print """<head>
<meta charset="utf-8">
<style type="text/css">
{{{v.css_content}}}
</style>
{{{v.head_content}}}
</head><body>
"""
for mm in mmodules do for cd in mm.mclassdefs do for pd in cd.mpropdefs do
var n = mb.mpropdef2node(pd)
if not n isa APropdef then continue
var hl = new TestHighlightVisitor
hl.highlight_node(n)
print "<h1 id=\"{pd.c_name}\">{pd.full_name}</h1>"
printn "<pre><code>"
hl.html.write_to(stdout)
print "</code></pre>"
end
# Some random nodes
var thlv = new THLVisitor
for mm in mmodules do
var n = mb.mmodule2node(mm)
thlv.enter_visit(n)
end
print v.foot_content
print "</body></html>"
end
class THLVisitor
super Visitor
var seen = new HashSet[String]
redef fun visit(n)
do
var cn = n.class_name
if not seen.has(cn) then
seen.add cn
var hl = new TestHighlightVisitor
hl.highlight_node(n)
print "<h2>AST node: {cn} at {n.location}</h2>"
printn "<pre><code>"
hl.html.write_to(stdout)
print "</code></pre>"
end
n.visit_all(self)
end
end
src/test_highlight.nit:15,1--81,3