diff options
| author | Joel Martin <github@martintribe.org> | 2014-11-15 23:51:59 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-09 16:16:47 -0600 |
| commit | aaba249304b184e12e2445ab22d66df1f39a51a5 (patch) | |
| tree | a3c7b1a0d683ef73ec030a390eca2922bfc9bc54 /cs/step6_file.cs | |
| parent | ee7cd5859e56423983f025088c8cef36b7ed09dd (diff) | |
| download | mal-aaba249304b184e12e2445ab22d66df1f39a51a5.tar.gz mal-aaba249304b184e12e2445ab22d66df1f39a51a5.zip | |
VB.Net, C#: fix cmd line arg handling with --raw
Diffstat (limited to 'cs/step6_file.cs')
| -rw-r--r-- | cs/step6_file.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cs/step6_file.cs b/cs/step6_file.cs index ab7a426..c885922 100644 --- a/cs/step6_file.cs +++ b/cs/step6_file.cs @@ -141,8 +141,13 @@ namespace Mal { repl_env.set(entry.Key, entry.Value); } repl_env.set("eval", new MalFunc(a => EVAL(a[0], repl_env))); + int fileIdx = 1; + if (args.Length > 0 && args[0] == "--raw") { + Mal.readline.mode = Mal.readline.Mode.Raw; + fileIdx = 2; + } MalList _argv = new MalList(); - for (int i=1; i < args.Length; i++) { + for (int i=fileIdx; i < args.Length; i++) { _argv.conj_BANG(new MalString(args[i])); } repl_env.set("*ARGV*", _argv); @@ -151,11 +156,6 @@ namespace Mal { RE("(def! not (fn* (a) (if a false true)))"); RE("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))"); - int fileIdx = 0; - if (args.Length > 0 && args[0] == "--raw") { - Mal.readline.mode = Mal.readline.Mode.Raw; - fileIdx = 1; - } if (args.Length > fileIdx) { RE("(load-file \"" + args[fileIdx] + "\")"); return; |
