+ self.toolcontext.quit
+ end
+
+ return mmodules.to_a
+ end
+
+ # Identify a bunch of modules and groups.
+ #
+ # This does the same as `parse_full` but does only the identification (cf. `identify_module`)
+ fun scan_full(names: Sequence[String]): Array[MModule]
+ do
+ var mmodules = new Array[MModule]
+ for a in names do
+ # Case of a group (root or sub-directory)
+ var mgroup = self.identify_group(a)
+ if mgroup != null then
+ scan_group(mgroup)
+ for mg in mgroup.in_nesting.smallers do mmodules.add_all mg.mmodules
+ continue
+ end
+
+ # Case of a directory that is not a group
+ var stat = a.to_path.stat
+ if stat != null and stat.is_dir then
+ self.toolcontext.info("look in directory {a}", 2)
+ var fs = a.files
+ alpha_comparator.sort(fs)
+ # Try each entry as a group or a module
+ for f in fs do
+ var af = a/f
+ mgroup = identify_group(af)
+ if mgroup != null then
+ scan_group(mgroup)
+ for mg in mgroup.in_nesting.smallers do mmodules.add_all mg.mmodules
+ continue
+ end
+ var mmodule = identify_module(af)
+ if mmodule != null then
+ mmodules.add mmodule
+ else
+ self.toolcontext.info("ignore file {af}", 2)
+ end
+ end
+ continue
+ end
+
+ 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
+ mmodules.add mmodule
+ end
+ var time1 = get_time
+ self.toolcontext.info("*** END PARSE: {time1-time0} ***", 2)
+
+ self.toolcontext.check_errors
+
+ if toolcontext.opt_only_parse.value then
+ self.toolcontext.info("*** ONLY PARSE...", 1)
+ self.toolcontext.quit