Used by the interpreter when -n
is used
core :: union_find
union–find algorithm using an efficient disjoint-set data structure
# Runtime library to loop around the main program for each line in file-name arguments
#
# Used by the interpreter when `-n` is used
module niti_runtime
redef class Sys
redef fun run do
if not args.is_empty then
open_next_stream
end
loop
read_next_line
main
end
end
# Read the next useful line from file-name arguments
private fun read_next_line
do
while stdin.eof do
open_next_stream
end
self.line = stdin.read_line
end
# Open the next file until there is no more arguments
private fun open_next_stream
do
if args.is_empty then exit(0)
stdin.close
stdin = new FileReader.open(args.shift)
end
# The next line to process by the main program
var line: String is noautoinit
end
lib/niti_runtime/niti_runtime.nit:11,1--46,3