aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nimterop/ast.nim2
-rw-r--r--nimterop/globals.nim7
-rw-r--r--tests/include/test.h5
-rw-r--r--tests/tnimterop_c.nim2
4 files changed, 13 insertions, 3 deletions
diff --git a/nimterop/ast.nim b/nimterop/ast.nim
index dce61f9..c85d5dd 100644
--- a/nimterop/ast.nim
+++ b/nimterop/ast.nim
@@ -52,7 +52,7 @@ proc saveNodeData(node: TSNode, nimState: NimState): bool =
nimState.data.insert(("pointer_declarator", ""), nimState.data.len-1)
nimState.data.add(("function_declarator", ""))
- elif name in gExpressions:
+ elif name in gExpressions and name != "escape_sequence":
if $node.tsNodeParent.tsNodeType() notin gExpressions:
nimState.data.add((name, node.getNodeVal()))
diff --git a/nimterop/globals.nim b/nimterop/globals.nim
index 85aa06e..61054b9 100644
--- a/nimterop/globals.nim
+++ b/nimterop/globals.nim
@@ -12,6 +12,7 @@ const
"field_identifier",
"identifier",
"number_literal",
+ "char_literal",
"preproc_arg",
"primitive_type",
"sized_type_specifier",
@@ -22,12 +23,14 @@ const
"parenthesized_expression",
"bitwise_expression",
"shift_expression",
- "math_expression"
+ "math_expression",
+ "escape_sequence"
].toSet()
gEnumVals {.used.} = @[
"identifier",
- "number_literal"
+ "number_literal",
+ "char_literal"
].concat(toSeq(gExpressions.items))
type
diff --git a/tests/include/test.h b/tests/include/test.h
index 2e4cf08..9a28dc0 100644
--- a/tests/include/test.h
+++ b/tests/include/test.h
@@ -73,6 +73,11 @@ enum ENUM5 {
enum15 = (1 << (1 & 1))
};
+enum ENUM7 {
+ enum17 = '\0',
+ enum18 = 'A'
+};
+
typedef void * VOIDPTR;
typedef int * INTPTR;
diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim
index 0eafa11..ddfa43e 100644
--- a/tests/tnimterop_c.nim
+++ b/tests/tnimterop_c.nim
@@ -127,6 +127,8 @@ check e4 == enum11
check enum13 == 4
check enum14 == 9
check enum15 == 2
+check enum17 == '\0'.ENUM7
+check enum18 == 'A'.ENUM7
# Issue #58
multiline1()