Re: [Epydoc-devel] Docstring parsing shortcomings
Brought to you by:
edloper
From: Hans M. <me...@in...> - 2007-05-21 15:18:29
|
Hi again! Am Freitag, 18. Mai 2007 16:28:43 schrieb Hans Meine: > Am Freitag, 11. Mai 2007 00:38:02 schrieb Edward Loper: > > Perhaps boost and/or sip could be encouraged to include some > > introspectable value that can be used to find the signature? Either > > by automatically including a signature at the beginning of the > > __doc__ attribute, or by adding a new attribute to the object? If > > they did that, I'd be happy to add support to epydoc for reading it. > > I wrote a parser for the C++ signatures, using pyparsing.[*] I knew that the parser was not perfect when I wrote this, but I wanted to have some feedback. Now I realized there is a specific flaw: In order to let my test suite run (parsing 206 random C++ signatures from a real-life extension module), I extended the parser to grok e.g. python list literals, which is needed for the default arguments. However, I should have separated parsers for C++ literals (template arguments in the type specs) and python literals (default values). :-( Alas, the only existing C++ parser I could find is part of http://synopsis.fresco.org/, and I would still need pyparsing for the special C++ signature format with mixed C++/python expressions. BTW: How does epydoc handle default arguments with commas, e.g. """test(a, b, c = [1,2,3], d = None) Foo bar baz...""" AFAICS, that cannot be done with regular expressions very easily?! (OK, I chose numbers as list contents, which are no valid identifiers. I could try harder though. ;-) ) -- Ciao, / / /--/ / / ANS |