bin/p-lang in p-lang-0.2.0 vs bin/p-lang in p-lang-0.3.0
- old
+ new
@@ -12,11 +12,16 @@
sa = PLang::Parser::SyntaxAnalyser.new(command)
vm = PLang::VM::Interpreter.new(sa.parse)
vm.execute!
end
- opts.on("-i", "-i FILE", "interp a script file.") do |file|
+ opts.on("-i", "-i", "interactive p shell.") do
+ shell = PLang::IPS::Shell.new
+ shell.start
+ end
+
+ opts.on("-f", "-f FILE", "interp a script file.") do |file|
begin
program = File.readlines(file).join("")
rescue
puts "No such file (LoadError)"
exit
@@ -33,13 +38,14 @@
argv = ARGV
begin
if ARGV.length > 0
if options.parse!(ARGV).length > 0
- options.parse!(["-h"])
+ options.parse!(["-f" + ARGV[0]])
end
else
- options.parse!(["-h"])
+ # without arguments
+ options.parse!(["-i"])
end
rescue
puts "p-lang: unrecognized option"
end