Author: Armin Rigo <[email protected]>
Branch:
Changeset: r109:add8f0e282f4
Date: 2014-11-29 10:01 +0100
http://bitbucket.org/cffi/creflect/changeset/add8f0e282f4/
Log: typedef'ed identifiers
diff --git a/creflect/src/c_decl_parser.c b/creflect/src/c_decl_parser.c
--- a/creflect/src/c_decl_parser.c
+++ b/creflect/src/c_decl_parser.c
@@ -379,6 +379,16 @@
case TOK_VOID:
t1 = tok->cb->get_void_type(tok->cb);
break;
+ case TOK_IDENTIFIER:
+ {
+ char identifier[1024];
+ if (tok->size >= 1024)
+ return parse_error(tok); // XXX
+ memcpy(identifier, tok->p, tok->size);
+ identifier[tok->size] = 0;
+ t1 = tok->cb->get_user_type(tok->cb, identifier);
+ break;
+ }
default:
tok->kind = TOK_ERROR;
return NULL;
diff --git a/test/test_c_decl_parser.py b/test/test_c_decl_parser.py
--- a/test/test_c_decl_parser.py
+++ b/test/test_c_decl_parser.py
@@ -75,8 +75,9 @@
parse("unsigned char", "unsigned char")
parse("char(*(*)(long))(int)","PTR FUNC( long -> PTR FUNC( int -> char )
)")
parse("int[]", "ARRAY[] int")
+ parse("foo_t", "foo_t")
+ parse("foo_t*", "PTR foo_t")
import py; py.test.skip("in-progress")
- parse("foo_t")
parse("int(int, ...)")
parse("int(int[])")
parse("int(long(char))")
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit