aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2019-05-27 17:19:47 -0500
committerGanesh Viswanathan <dev@genotrance.com>2019-05-27 17:19:47 -0500
commit9387de8638d7805130c2c9dc53e83541eb399f6b (patch)
tree9dc9b03dd1919fc04c2ed4b1f3e8d40374b2aa8a
parente245e17488de47cf28e1b6d5d66fe76e6fc3c8c5 (diff)
downloadnimterop-9387de8638d7805130c2c9dc53e83541eb399f6b.tar.gz
nimterop-9387de8638d7805130c2c9dc53e83541eb399f6b.zip
Handle comments in #defines
-rw-r--r--nimterop/getters.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/nimterop/getters.nim b/nimterop/getters.nim
index 1051e4f..51d63a7 100644
--- a/nimterop/getters.nim
+++ b/nimterop/getters.nim
@@ -161,6 +161,9 @@ proc getPtrType*(str: string): string =
str
proc getLit*(str: string): string =
+ let
+ str = str.replace(re"//.*?$", "").replace(re"/\*.*?\*/", "").strip()
+
if str.contains(re"^[\-]?[\d]+$") or
str.contains(re"^[\-]?[\d]*\.[\d]+$") or
str.contains(re"^0x[\d]+$"):