nitcc_runtime :: TestParser :: main
work
)
# Use the class as the main enrty point of the program
# - parse arguments and options of the command
# - test the parser (see `work`)
fun main: Node
do
if args.is_empty then
print "usage {name}_test <filepath> | - | -e <text>"
exit 0
end
var filepath = args.shift
var text
if filepath == "-" then
text = sys.stdin.read_all
else if filepath == "-e" then
if args.is_empty then
print "Error: -e need a text"
exit 1
end
text = args.shift
else
var f = new FileReader.open(filepath)
text = f.read_all
f.close
end
if not args.is_empty then
print "Error: superfluous arguments."
exit 1
end
return work(text)
end
lib/nitcc_runtime/nitcc_runtime.nit:598,2--630,4