summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/pragmas.nim6
-rw-r--r--compiler/scriptconfig.nim2
-rw-r--r--doc/manual/syntax.txt42
-rw-r--r--lib/system/nimscript.nim13
4 files changed, 17 insertions, 46 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index 354e5bdc6..1f93f5317 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -400,12 +400,10 @@ proc relativeFile(c: PContext; n: PNode; ext=""): string =
     s = addFileExt(s, ext)
   result = parentDir(n.info.toFullPath) / s
   if not fileExists(result):
-    if isAbsolute(s):
-      result = s
+    if isAbsolute(s): result = s
     else:
       result = findFile(s)
-      if result.len == 0:
-        result = s
+      if result.len == 0: result = s
 
 proc processCompile(c: PContext, n: PNode) =
   let found = relativeFile(c, n)
diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim
index 833444788..8b2653bc9 100644
--- a/compiler/scriptconfig.nim
+++ b/compiler/scriptconfig.nim
@@ -130,6 +130,8 @@ proc setupVM*(module: PSym; scriptName: string): PEvalContext =
     elif not isAbsolute(val):
       val = vthisDir / val
     gModuleOverrides[key] = val
+  cbconf selfExe:
+    setResult(a, os.getAppFilename())
 
 proc runNimScript*(scriptName: string; freshDefines=true) =
   passes.gIncludeFile = includeModule
diff --git a/doc/manual/syntax.txt b/doc/manual/syntax.txt
index 74bf7e3c9..89f8ca707 100644
--- a/doc/manual/syntax.txt
+++ b/doc/manual/syntax.txt
@@ -70,48 +70,6 @@ Whether an operator is used a prefix operator is also affected by preceeding whi
   echo($foo)
 
 
-Strong spaces
--------------
-
-The number of spaces preceding a non-keyword operator affects precedence
-if the experimental parser directive ``#?strongSpaces`` is used. Indentation
-is not used to determine the number of spaces. If 2 or more operators have the
-same number of preceding spaces the precedence table applies, so ``1 + 3 * 4``
-is still parsed as ``1 + (3 * 4)``, but ``1+3 * 4`` is parsed as ``(1+3) * 4``:
-
-.. code-block:: nim
-  #? strongSpaces
-  if foo+4 * 4 == 8  and  b&c | 9  ++
-      bar:
-    echo ""
-  # is parsed as
-  if ((foo+4)*4 == 8) and (((b&c) | 9) ++ bar): echo ""
-
-
-Furthermore whether an operator is used a prefix operator is affected by the
-number of spaces:
-
-.. code-block:: nim
-  #? strongSpaces
-  echo $foo
-  # is parsed as
-  echo($foo)
-
-This also affects whether ``[]``, ``{}``, ``()`` are parsed as constructors
-or as accessors:
-
-.. code-block:: nim
-  #? strongSpaces
-  echo (1,2)
-  # is parsed as
-  echo((1,2))
-
-Only 0, 1, 2, 4 or 8 spaces are allowed to specify precedence and it is
-enforced that infix operators have the same amount of spaces before and after
-them. This rules does not apply when a newline follows after the operator,
-then only the preceding spaces are considered.
-
-
 Grammar
 -------
 
diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim
index ad2b154d4..fc6b8c99d 100644
--- a/lib/system/nimscript.nim
+++ b/lib/system/nimscript.nim
@@ -122,6 +122,10 @@ proc existsDir*(dir: string): bool =
   ## An alias for ``dirExists``.
   dirExists(dir)
 
+proc selfExe*(): string =
+  ## Returns the currently running nim or nimble executable.
+  builtin
+
 proc toExe*(filename: string): string =
   ## On Windows adds ".exe" to `filename`, else returns `filename` unmodified.
   (when defined(windows): filename & ".exe" else: filename)
@@ -208,6 +212,15 @@ proc exec*(command: string, input: string, cache = "") {.
   log "exec: " & command:
     echo staticExec(command, input, cache)
 
+proc selfExec*(command: string) =
+  ## Executes an external command with the current nim/nimble executable.
+  ## ``Command`` must not contain the "nim " part.
+  let c = selfExe() & " " & command
+  log "exec: " & c:
+    if rawExec(c) != 0:
+      raise newException(OSError, "FAILED: " & c)
+    checkOsError()
+
 proc put*(key, value: string) =
   ## Sets a configuration 'key' like 'gcc.options.always' to its value.
   builtin