diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2018-07-13 00:20:15 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2018-07-13 00:20:15 -0500 |
| commit | 5fc18f82f4f0ede6774395b3ef657751a9eef2fc (patch) | |
| tree | 87ea9fc23438534a419019f8b6624a56b526a95d /src | |
| parent | e46d3b2332d439cda073a34947cdaa803926e948 (diff) | |
| parent | 0c13c06cfe7b9d2add6efed8c56ef1ec7a3cdfd8 (diff) | |
| download | nimgen-5fc18f82f4f0ede6774395b3ef657751a9eef2fc.tar.gz nimgen-5fc18f82f4f0ede6774395b3ef657751a9eef2fc.zip | |
Merge branch 'master' of https://github.com/genotrance/nimgen
Diffstat (limited to 'src')
| -rw-r--r-- | src/nimgen/fileops.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nimgen/fileops.nim b/src/nimgen/fileops.nim index 2e51d09..c4e67a0 100644 --- a/src/nimgen/fileops.nim +++ b/src/nimgen/fileops.nim @@ -76,14 +76,14 @@ proc removeStatic*(filename: string) = ## out body withFile(filename): content = content.replace( - re"(?m)(static inline.*?\))(\s*\{(\s*?.*?$)*[\n\r]\})", + re"(?m)(static inline.*?\))(\s*\{(\s*?.*?$)*?[\n\r]\})", proc (m: RegexMatch, s: string): string = let funcDecl = s[m.group(0)[0]] let body = s[m.group(1)[0]].strip() result = "" result.add("$#;" % [funcDecl]) - result.add(body.replace(re"(?m)^", "//")) + result.add(body.replace(re"(?m)^(.*\n?)", "//$1")) ) proc reAddStatic*(filename: string) = @@ -91,14 +91,14 @@ proc reAddStatic*(filename: string) = ## removeStatic withFile(filename): content = content.replace( - re"(?m)(static inline.*?\));(\/\/\s*\{(\s*?.*?$)*[\n\r]\/\/\})", + re"(?m)(static inline.*?\));(\/\/\s*\{(\s*?.*?$)*?[\n\r]\/\/\})", proc (m: RegexMatch, s: string): string = let funcDecl = s[m.group(0)[0]] let body = s[m.group(1)[0]].strip() result = "" result.add("$# " % [funcDecl]) - result.add(body.replace(re"(?m)^\/\/", "")) + result.add(body.replace(re"(?m)^\/\/(.*\n?)", "$1")) ) proc fixFuncProtos*(file: string) = |
