aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-04-10 22:45:29 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-04-10 22:45:29 -0500
commitf64fbb67b11ed6e48bf1585d14c1fded3c173944 (patch)
tree7f29fd5810bd1d217d816bfb6b8f9acabaa591cd
parentf5dd89904d8866456c62f4bf6b57b6c264d6dea2 (diff)
downloadnimterop-f64fbb67b11ed6e48bf1585d14c1fded3c173944.tar.gz
nimterop-f64fbb67b11ed6e48bf1585d14c1fded3c173944.zip
Fix #178 - single underscore
-rw-r--r--nimterop/getters.nim4
-rw-r--r--tests/include/test.h6
-rw-r--r--tests/tnimterop_c.nim1
3 files changed, 10 insertions, 1 deletions
diff --git a/nimterop/getters.nim b/nimterop/getters.nim
index 986c54d..48ed8f7 100644
--- a/nimterop/getters.nim
+++ b/nimterop/getters.nim
@@ -655,7 +655,9 @@ proc getNimExpression*(nimState: NimState, expr: string, name = ""): string =
if i == clean.len or gen.nBl:
# Process identifier
if ident.nBl:
- ident = nimState.getIdentifier(ident, nskConst)
+ # Issue #178
+ if ident != "_":
+ ident = nimState.getIdentifier(ident, nskConst)
if name.nBl and ident in nimState.constIdentifiers:
ident = ident & "." & name
result &= ident
diff --git a/tests/include/test.h b/tests/include/test.h
index b22e2d8..e9c281c 100644
--- a/tests/include/test.h
+++ b/tests/include/test.h
@@ -194,6 +194,12 @@ struct JKL {
int **f1;
};
+// Issue #178
+typedef enum
+{
+ SDLK_UNDERSCORE = '_'
+} SDL_KeyCode;
+
#ifdef __cplusplus
}
#endif
diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim
index fe4e9ee..e78e7f2 100644
--- a/tests/tnimterop_c.nim
+++ b/tests/tnimterop_c.nim
@@ -227,3 +227,4 @@ cg.f2 = nil
doAssert BIT == 1
doAssert ca(nil) == 1
doAssert cc(nil) == 2
+doAssert SDLK_UNDERSCORE == 95 \ No newline at end of file