summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-10-17 12:52:25 +0200
committerAraq <rumpf_a@web.de>2018-10-17 13:07:29 +0200
commitbd9d5787f06a1f3e259055268824a852cd160798 (patch)
tree931c3a871fb3d2ee308abe2fd816fc9aa07f5869
parent88adf775691411a526c18d82b1e6bd83b653f343 (diff)
downloadNim-bd9d5787f06a1f3e259055268824a852cd160798.tar.gz
nimpretty: fixes #9384
-rw-r--r--compiler/syntaxes.nim16
-rw-r--r--nimpretty/tester.nim2
2 files changed, 11 insertions, 7 deletions
diff --git a/compiler/syntaxes.nim b/compiler/syntaxes.nim
index b5fcee7b1..decdf1715 100644
--- a/compiler/syntaxes.nim
+++ b/compiler/syntaxes.nim
@@ -72,12 +72,16 @@ proc parsePipe(filename: AbsoluteFile, inputStream: PLLStream; cache: IdentCache
       i = 0
       inc linenumber
     if i+1 < line.len and line[i] == '#' and line[i+1] == '?':
-      inc(i, 2)
-      while i < line.len and line[i] in Whitespace: inc(i)
-      var q: TParser
-      parser.openParser(q, filename, llStreamOpen(substr(line, i)), cache, config)
-      result = parser.parseAll(q)
-      parser.closeParser(q)
+      when defined(nimpretty2):
+        # XXX this is a bit hacky, but oh well...
+        quit "can't nimpretty a source code filter"
+      else:
+        inc(i, 2)
+        while i < line.len and line[i] in Whitespace: inc(i)
+        var q: TParser
+        parser.openParser(q, filename, llStreamOpen(substr(line, i)), cache, config)
+        result = parser.parseAll(q)
+        parser.closeParser(q)
     llStreamClose(s)
 
 proc getFilter(ident: PIdent): TFilterKind =
diff --git a/nimpretty/tester.nim b/nimpretty/tester.nim
index 2f184b7fc..c4e364752 100644
--- a/nimpretty/tester.nim
+++ b/nimpretty/tester.nim
@@ -9,7 +9,7 @@ var
   failures = 0
 
 when defined(develop):
-  const nimp = "bin/nimpretty".addFileExt(ExeExt)
+  const nimp = "bin" / "nimpretty".addFileExt(ExeExt)
   if execShellCmd("nim c -o:$# nimpretty/nimpretty.nim" % [nimp]) != 0:
     quit("FAILURE: compilation of nimpretty failed")
 else: