nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: Added contributing guidelines and link from readme
[nit.git]
/
src
/
nit.nit
diff --git
a/src/nit.nit
b/src/nit.nit
index
13f8c59
..
a28bb6f
100644
(file)
--- a/
src/nit.nit
+++ b/
src/nit.nit
@@
-21,15
+21,14
@@
import interpreter
import frontend
import parser_util
import vm
import frontend
import parser_util
import vm
-import vm_optimizations
-import variables_numbering
# Create a tool context to handle options and paths
var toolcontext = new ToolContext
toolcontext.option_context.options_before_rest = true
toolcontext.tooldescription = "Usage: nit [OPTION]... <file.nit>...\nInterprets and debugs Nit programs."
# Create a tool context to handle options and paths
var toolcontext = new ToolContext
toolcontext.option_context.options_before_rest = true
toolcontext.tooldescription = "Usage: nit [OPTION]... <file.nit>...\nInterprets and debugs Nit programs."
-# Add an option "-o" to enable compatibilit with the tests.sh script
-var opt = new OptionString("compatibility (does noting)", "-o")
+# Add an option "-o" to enable compatibility with the tests.sh script
+var opt = new OptionString("Does nothing. Used for compatibility.", "-o")
+opt.hidden = true
toolcontext.option_context.add_option(opt)
var opt_eval = new OptionBool("Specifies the program from command-line", "-e")
var opt_loop = new OptionBool("Repeatedly run the program for each line in file-name arguments", "-n")
toolcontext.option_context.add_option(opt)
var opt_eval = new OptionBool("Specifies the program from command-line", "-e")
var opt_loop = new OptionBool("Repeatedly run the program for each line in file-name arguments", "-n")
@@
-65,13
+64,19
@@
if opt_eval.value then
modelbuilder.load_rt_module(parent, amodule, "-")
mmodules = [amodule.mmodule.as(not null)]
modelbuilder.load_rt_module(parent, amodule, "-")
mmodules = [amodule.mmodule.as(not null)]
+else if progname == "-" then
+ var content = stdin.read_all
+ var amodule = toolcontext.parse_module(content)
+ toolcontext.check_errors
+ modelbuilder.load_rt_module(null, amodule, "-")
+ mmodules = [amodule.mmodule.as(not null)]
else
mmodules = modelbuilder.parse([progname])
end
modelbuilder.run_phases
else
mmodules = modelbuilder.parse([progname])
end
modelbuilder.run_phases
-if toolcontext.opt_only_metamodel.value then exit(0)
+if toolcontext.opt_only_metamodel.value then toolcontext.quit
var mainmodule = toolcontext.make_main_module(mmodules)
var mainmodule = toolcontext.make_main_module(mmodules)