aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgenotrance <dev@genotrance.com>2018-07-12 21:59:40 -0500
committerGitHub <noreply@github.com>2018-07-12 21:59:40 -0500
commit0c13c06cfe7b9d2add6efed8c56ef1ec7a3cdfd8 (patch)
treef6b58bcb9e6ee13f5dc6380a8087499cfd0cf0bb /src
parent7d60e2eea78169d7237594f6ab77ed02c968acc3 (diff)
parent59c64782bd1f70688d3105024bc2c9cffb8bf313 (diff)
downloadnimgen-0c13c06cfe7b9d2add6efed8c56ef1ec7a3cdfd8.tar.gz
nimgen-0c13c06cfe7b9d2add6efed8c56ef1ec7a3cdfd8.zip
Merge pull request #22 from jyapayne/temp_regex_fix
Workaround regex replace issue
Diffstat (limited to 'src')
-rw-r--r--src/nimgen/fileops.nim8
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) =