From bf685d1dfc356f41e07e8c42e28969381452df7e Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Tue, 22 Jan 2019 11:14:32 -0600 Subject: Fix #58 --- nimterop/grammar.nim | 7 ++++++- tests/include/test.c | 10 +++++++++- tests/include/test.h | 6 ++++++ tests/tnimterop_c.nim | 5 +++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/nimterop/grammar.nim b/nimterop/grammar.nim index 28b08d1..9a434fe 100644 --- a/nimterop/grammar.nim +++ b/nimterop/grammar.nim @@ -305,7 +305,10 @@ proc initGrammar() = (type_identifier?) {fieldListGrammar} ) - (type_identifier) + (type_identifier!) + (pointer_declarator + (type_identifier) + ) ) """, proc (ast: ref Ast, node: TSNode) = @@ -424,6 +427,8 @@ proc initGrammar() = if gStateRT.data[i].name == "pointer_declarator": fptr = "ptr " i += 1 + else: + fptr = "" var fname = gStateRT.data[i].val diff --git a/tests/include/test.c b/tests/include/test.c index 162645c..0312b4f 100644 --- a/tests/include/test.c +++ b/tests/include/test.c @@ -58,4 +58,12 @@ float test_call_param8(int *param1) { void *test_call9() { return NULL; -} \ No newline at end of file +} + +void multiline1(void) {} + +void *multiline2(void) { + return NULL; +} + +void multiline3(void) {} diff --git a/tests/include/test.h b/tests/include/test.h index a8a5b74..12f052c 100644 --- a/tests/include/test.h +++ b/tests/include/test.h @@ -109,6 +109,12 @@ int test_call_param7(union UNION1 param1); float test_call_param8(int *param1); void *test_call9(); +// Issue #58 +void + multiline1(void), + *multiline2(void), + multiline3(void); + #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/tests/tnimterop_c.nim b/tests/tnimterop_c.nim index 7c4481d..d3cb26e 100644 --- a/tests/tnimterop_c.nim +++ b/tests/tnimterop_c.nim @@ -110,6 +110,11 @@ check enum13 == 4 check enum14 == 9 check enum15 == 2 +# Issue #58 +multiline1() +let p = multiline2() +multiline3() + cAddStdDir() ## failing tests -- cgit v1.2.3