diff options
| author | data-man <datamanrb@gmail.com> | 2018-07-15 04:49:24 +0300 |
|---|---|---|
| committer | data-man <datamanrb@gmail.com> | 2018-07-15 04:49:24 +0300 |
| commit | 2d06bdcccfcc41d42949f22aa7b96624cc7df130 (patch) | |
| tree | f33c9fd105c0e62e51796cd1434d26d8b77ed1e5 | |
| parent | 2fae7453782c770875f9e1cb46632b47e9f08248 (diff) | |
| download | nimgen-2d06bdcccfcc41d42949f22aa7b96624cc7df130.tar.gz nimgen-2d06bdcccfcc41d42949f22aa7b96624cc7df130.zip | |
More multiReplaces
| -rw-r--r-- | src/nimgen/external.nim | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/nimgen/external.nim b/src/nimgen/external.nim index 79426f6..39c963e 100644 --- a/src/nimgen/external.nim +++ b/src/nimgen/external.nim @@ -123,18 +123,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.multiReplace([("\\", "/"), ("//", "/")]): 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" ) |
