aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgenotrance <dev@genotrance.com>2018-07-15 01:18:22 -0500
committerGitHub <noreply@github.com>2018-07-15 01:18:22 -0500
commit96949bf15009868b4ece1bd7d3ece9a8c454fddb (patch)
tree58c919f8bc8fcd38b76e714ffffb4e5f691f722b
parent6b38a558034367725dd0564b9ac7d2cfd29b6096 (diff)
parentf8f918642964f60cee6c8dd5ba9fe8390b8ee369 (diff)
downloadnimgen-96949bf15009868b4ece1bd7d3ece9a8c454fddb.tar.gz
nimgen-96949bf15009868b4ece1bd7d3ece9a8c454fddb.zip
Merge pull request #28 from data-man/multireplace
More multiReplaces
-rw-r--r--src/nimgen/external.nim9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/nimgen/external.nim b/src/nimgen/external.nim
index 096753c..350c841 100644
--- a/src/nimgen/external.nim
+++ b/src/nimgen/external.nim
@@ -126,18 +126,15 @@ proc runPreprocess*(file, ppflags, flags: string, inline: bool): string =
if line.strip() != "":
if line[0] == '#' and not line.contains("#pragma"):
start = false
- if sfile in line.replace("\\", "/").replace("//", "/"):
+ if sfile in line.sanitizePath:
start = true
if not ("\\" in line) and not ("/" in line) and extractFilename(sfile) in line:
start = true
else:
if start:
rdata.add(
- line.replace("_Noreturn", "")
- .replace("(())", "")
- .replace("WINAPI", "")
- .replace("__attribute__", "")
- .replace("extern \"C\"", "")
+ line.multiReplace([("_Noreturn", ""), ("(())", ""), ("WINAPI", ""),
+ ("__attribute__", ""), ("extern \"C\"", "")])
.replace(re"\(\([_a-z]+?\)\)", "")
.replace(re"\(\(__format__[\s]*\(__[gnu_]*printf__, [\d]+, [\d]+\)\)\);", ";") & "\n"
)