summary refs log tree commit diff stats
path: root/compiler/nim.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-05-27 15:22:17 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-05-27 15:22:17 +0200
commit18a3833d6085ae4edf28433ba12a27a4be3ae3b1 (patch)
treea4dc15d24b03c7657b15fdf5e5da0e087b6347f5 /compiler/nim.nim
parentdd8a6ef3a2aa1f0200d6ddff0f1f38532e84647b (diff)
downloadNim-18a3833d6085ae4edf28433ba12a27a4be3ae3b1.tar.gz
more refactoring
Diffstat (limited to 'compiler/nim.nim')
-rw-r--r--compiler/nim.nim21
1 files changed, 20 insertions, 1 deletions
diff --git a/compiler/nim.nim b/compiler/nim.nim
index 456a7bdac..ac861b2d7 100644
--- a/compiler/nim.nim
+++ b/compiler/nim.nim
@@ -20,7 +20,7 @@ when defined(i386) and defined(windows) and defined(vcc):
 
 import
   commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes,
-  extccomp, strutils, os, osproc, platform, main, parseopt, service,
+  extccomp, strutils, os, osproc, platform, main, parseopt,
   nodejs, scriptconfig, idents, modulegraphs, lineinfos
 
 when hasTinyCBackend:
@@ -37,6 +37,25 @@ proc prependCurDir(f: string): string =
   else:
     result = f
 
+proc processCmdLine(pass: TCmdLinePass, cmd: string; config: ConfigRef) =
+  var p = parseopt.initOptParser(cmd)
+  var argsCount = 0
+  while true:
+    parseopt.next(p)
+    case p.kind
+    of cmdEnd: break
+    of cmdLongoption, cmdShortOption:
+      if p.key == " ":
+        p.key = "-"
+        if processArgument(pass, p, argsCount, config): break
+      else:
+        processSwitch(pass, p, config)
+    of cmdArgument:
+      if processArgument(pass, p, argsCount, config): break
+  if pass == passCmd2:
+    if optRun notin config.globalOptions and config.arguments.len > 0 and config.command.normalize != "run":
+      rawMessage(config, errGenerated, errArgsNeedRunOption)
+
 proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
   condsyms.initDefines(conf.symbols)
   if paramCount() == 0: