nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
frontend: remove ModelView dependency
[nit.git]
/
src
/
nitx.nit
diff --git
a/src/nitx.nit
b/src/nitx.nit
index
d40da24
..
311580a
100644
(file)
--- a/
src/nitx.nit
+++ b/
src/nitx.nit
@@
-25,7
+25,7
@@
module nitx
import frontend
import doc::term
import frontend
import doc::term
-import readline
+import prompt
redef class ToolContext
redef class ToolContext
@@
-43,8
+43,11
@@
end
# Using `prompt`, the command line can be turned on an interactive tool.
class Nitx
# Using `prompt`, the command line can be turned on an interactive tool.
class Nitx
- # ModelView that contains the informations to display
- var view: ModelView
+ # Model that contains the informations to display
+ var model: Model
+
+ # Mainmodule for class linearization
+ var mainmodule: MModule
# ModelBuilder to access AST nodes
var modelbuilder: ModelBuilder
# ModelBuilder to access AST nodes
var modelbuilder: ModelBuilder
@@
-66,7
+69,7
@@
class Nitx
print "Welcome in the Nit Index!"
print ""
print "Loaded packages:\n"
print "Welcome in the Nit Index!"
print ""
print "Loaded packages:\n"
- var cmd = new CmdModelEntities(view, kind = "packages")
+ var cmd = new CmdModelEntities(model, kind = "packages")
cmd.init_command
for mpackage in cmd.results.as(not null) do
print " * {mpackage.full_name}"
cmd.init_command
for mpackage in cmd.results.as(not null) do
print " * {mpackage.full_name}"
@@
-90,7
+93,7
@@
class Nitx
# Prompts the user for a query.
fun prompt do
# Prompts the user for a query.
fun prompt do
- var line = readline(">> ", true)
+ var line = sys.prompt(">> ", true)
if line != null then
do_command(line)
else
if line != null then
do_command(line)
else
@@
-101,7
+104,7
@@
class Nitx
end
# Parser used to process doc commands
end
# Parser used to process doc commands
- var parser = new CommandParser(view, modelbuilder, catalog) is lazy
+ var parser = new CommandParser(model, mainmodule, modelbuilder, catalog) is lazy
# Processes the query string and performs it.
fun do_command(str: String) do
# Processes the query string and performs it.
fun do_command(str: String) do
@@
-117,9
+120,9
@@
end
redef class Catalog
# Build the catalog for Nitx
redef class Catalog
# Build the catalog for Nitx
- private fun build_catalog(view: ModelView) do
+ private fun build_catalog(model: Model, filter: nullable ModelFilter) do
# Compute the poset
# Compute the poset
- for p in view.mpackages do
+ for p in model.collect_mpackages(filter) do
var g = p.root
assert g != null
modelbuilder.scan_group(g)
var g = p.root
assert g != null
modelbuilder.scan_group(g)
@@
-134,7
+137,7
@@
redef class Catalog
end
end
# Build the catalog
end
end
# Build the catalog
- for mpackage in view.mpackages do
+ for mpackage in model.collect_mpackages(filter) do
package_page(mpackage)
git_info(mpackage)
mpackage_stats(mpackage)
package_page(mpackage)
git_info(mpackage)
mpackage_stats(mpackage)
@@
-165,15
+168,14
@@
toolcontext.run_global_phases(mmodules)
var mainmodule = toolcontext.make_main_module(mmodules)
# build views
var mainmodule = toolcontext.make_main_module(mmodules)
# build views
-var view = new ModelView(model, mainmodule)
var catalog = null
if toolcontext.opt_catalog.value then
catalog = new Catalog(mbuilder)
var catalog = null
if toolcontext.opt_catalog.value then
catalog = new Catalog(mbuilder)
- catalog.build_catalog(view)
+ catalog.build_catalog(model)
end
# start nitx
end
# start nitx
-var nitx = new Nitx(view, mbuilder, catalog, toolcontext.opt_no_color.value)
+var nitx = new Nitx(model, mainmodule, mbuilder, catalog, toolcontext.opt_no_color.value)
var q = toolcontext.opt_command.value
if q != null then # shortcut prompt
print ""
var q = toolcontext.opt_command.value
if q != null then # shortcut prompt
print ""