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
# Nit Static Analysis Framework client example.
module nitsaf
import saf
import test_phase
import frontend
redef class ToolContext
# Analysis to apply
var opt_analysis = new OptionEnum(["reaching-defs"], "Analysis to apply", 0, "--analysis")
redef init do
super
option_context.add_option(opt_analysis)
end
end
redef fun do_work(mainmodule, given_mmodules, modelbuilder) do
var toolcontext = modelbuilder.toolcontext
var analysis: StaticAnalysis
var analysis_name = toolcontext.opt_analysis.value_name
if analysis_name == "reaching-defs" then
analysis = new ReachingDefsAnalysis(modelbuilder)
else
print "Error: unkown analysis {analysis_name}"
sys.exit 1
return
end
var mainnode = modelbuilder.mmodule2node(mainmodule)
if mainnode == null then return
analysis.start_analysis(mainnode)
analysis.pretty_print
end
src/nitsaf.nit:15,1--50,3