On Feb 19, 2009, at 4:29 AM, Stefan Behnel wrote: > Lisandro Dalcin wrote: >> Then I'll try to make this work, but this would still need to >> special-case when parsing basic C types. If not, the mix of >> <modifiers> <Py_ssize_t | size_t> get consumed and a the ctypedef >> parsing will fail because of a empty typedef name (the same if you >> wrote "typedef double" instead of "typedef double MyDouble"). > > You can let the parser parse them as usual and once that succeeded, > have > it check for the two names to drop the declaration with a warning. > From my > side, it's ok to do that in the parser. > >> Just a question: if the ctypedef is ignored, what should be the >> return >> of p_ctypedef_statement() ??? None? a PassNode? > > A PassNode should be safe and allowed wherever we allow a ctypedef > statement.
I am actually in favor of moving the logic out of the parser as much as possible. For example, I think the logic for rejecting "signed short size_t" belongs in PyrexTypes.simple_c_type, and raising an warning on "ctypedef int size_t" belongs in CTypeDefNode.analyse_declarations. Does anyone else find it odd "ctypedef int short" is OK? - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
