shebang support added
This commit is contained in:
parent
f0fab9a9ec
commit
2c68861451
|
|
@ -5,6 +5,7 @@
|
||||||
- better error reporting..for example ls_dir on non existing dir should prind `pwd` dir
|
- better error reporting..for example ls_dir on non existing dir should prind `pwd` dir
|
||||||
|
|
||||||
### TODO
|
### TODO
|
||||||
|
- add debug support, at least function call could keep call stack
|
||||||
- documentation
|
- documentation
|
||||||
- add url of source/inspiration to clib/*.cpp
|
- add url of source/inspiration to clib/*.cpp
|
||||||
- add stdtest - to test every functionality
|
- add stdtest - to test every functionality
|
||||||
|
|
@ -12,7 +13,6 @@
|
||||||
- add -sb option to remove sheebang line
|
- add -sb option to remove sheebang line
|
||||||
- add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc)
|
- add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc)
|
||||||
- add -p (profile/performance option)
|
- add -p (profile/performance option)
|
||||||
- add debug support function call could keep call stack
|
|
||||||
- multiline editting (kilo editor)
|
- multiline editting (kilo editor)
|
||||||
- execute system command should capture stderr
|
- execute system command should capture stderr
|
||||||
- add built in for and, or
|
- add built in for and, or
|
||||||
|
|
|
||||||
6
ml.cpp
6
ml.cpp
|
|
@ -1886,6 +1886,12 @@ int main(int argc, char *argv[]) {
|
||||||
std::vector<std::string> files = getCmdOption(argv, argc, "-f");
|
std::vector<std::string> files = getCmdOption(argv, argc, "-f");
|
||||||
for (size_t i = 0; i < files.size(); i++)
|
for (size_t i = 0; i < files.size(); i++)
|
||||||
run(read_file_contents(files[i]), env);
|
run(read_file_contents(files[i]), env);
|
||||||
|
// just one parameter - filename
|
||||||
|
} else if (argc == 2) {
|
||||||
|
std::string file_content = read_file_contents(argv[1]);
|
||||||
|
if (file_content.find("#!") == 0) // shebang ?
|
||||||
|
file_content.erase(0, file_content.find("\n") + 1); // TODO mac osx newline??
|
||||||
|
run(file_content, env);
|
||||||
// repl
|
// repl
|
||||||
} else {
|
} else {
|
||||||
repl(env);
|
repl(env);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue