Merge pull request #28 from data-man/multireplace

More multiReplaces
This commit is contained in:
genotrance 2018-07-15 01:18:22 -05:00 committed by GitHub
commit 96949bf150
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"
)