- var nmodule = self.load_module(a)
- if nmodule == null then continue # Skip error
- # Load imported module
- build_module_importation(nmodule)
- var mmodule = nmodule.mmodule
- if mmodule == null then continue # Skip error
+ var mmodule = identify_module(a)
+ if mmodule == null then
+ if a.file_exists then
+ toolcontext.error(null, "Error: `{a}` is not a Nit source file.")
+ else
+ toolcontext.error(null, "Error: cannot find module `{a}`.")
+ end
+ continue
+ end
+
+ mmodules.add mmodule
+ end
+ return mmodules
+ end
+
+ # Load a bunch of modules and groups.
+ #
+ # Each name can be:
+ #
+ # * a path to a module, a group or a directory of packages.
+ # * a short name of a module or a group that are looked in the `paths` (-I)
+ #
+ # Then, for each entry, if it is:
+ #
+ # * a module, then is it parsed and returned.
+ # * a group then recursively all its modules are parsed.
+ # * a directory of packages then all the modules of all packages are parsed.
+ # * else an error is displayed.
+ #
+ # See `parse` for details.
+ fun parse_full(names: Sequence[String]): Array[MModule]
+ do
+ var time0 = get_time
+ # Parse and recursively load
+ self.toolcontext.info("*** PARSE ***", 1)
+ var mmodules = new ArraySet[MModule]
+ var scans = scan_full(names)
+ for mmodule in scans do
+ var ast = mmodule.load(self)
+ if ast == null then continue # Skip error