aboutsummaryrefslogtreecommitdiff
path: root/cs/step8_macros.cs
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-11-15 23:51:59 -0600
committerJoel Martin <github@martintribe.org>2015-01-09 16:16:47 -0600
commitaaba249304b184e12e2445ab22d66df1f39a51a5 (patch)
treea3c7b1a0d683ef73ec030a390eca2922bfc9bc54 /cs/step8_macros.cs
parentee7cd5859e56423983f025088c8cef36b7ed09dd (diff)
downloadmal-aaba249304b184e12e2445ab22d66df1f39a51a5.tar.gz
mal-aaba249304b184e12e2445ab22d66df1f39a51a5.zip
VB.Net, C#: fix cmd line arg handling with --raw
Diffstat (limited to 'cs/step8_macros.cs')
-rw-r--r--cs/step8_macros.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/cs/step8_macros.cs b/cs/step8_macros.cs
index 1aaa1fa..ccc0242 100644
--- a/cs/step8_macros.cs
+++ b/cs/step8_macros.cs
@@ -210,8 +210,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);
@@ -222,11 +227,6 @@ namespace Mal {
RE("(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))");
RE("(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) `(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))");
- 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;