Re: [CEDET-devel] (semantic-documentation-for-tag) question
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2006-06-19 16:38:49
|
>>> jo...@ve... seems to think that: >"Eric M. Ludlam" <er...@si...> writes: > >>>>> jo...@ve... seems to think that: >>>"Eric M. Ludlam" <er...@si...> writes: >> [ ... ] >>>> >>>> Adding this to python would be a great new feature. > >Already this simple thing somewhat works: > >(define-mode-local-override semantic-documentation-for-tag > python-mode (&optional tag nosnarf) > "return python def doc string: > >def mupp(r): >\"\"\" lalala \"\"\" > return r > >" > (when (or tag (setq tag (semantic-current-tag))) > (with-current-buffer (semantic-tag-buffer tag) > (save-excursion > ;; Move the point at token start > (goto-char (semantic-tag-start tag)) > (forward-line) ; pyhon doc comment starts below the def > (let* ((p1 (point)) > (dummy (forward-sexp)) > (p2 (point)) ;p1 and p2 now supposedly surround the comment > ) > (buffer-substring p1 p2)))))) > > >It must be made a little bit more clever though: > >- make sure we are really looking at a string """ or " >- move forward over """ or " >- do forward-sexp >- skip back over """ or " >- return the string... > >Im surely forgetting some complexity here, but I was pleasently >surprised by this simplicity. One trick is to use the semantic lexer. Just ask it to parse starting at point and if the python lexer is set up right, it will give you a string. I don't remember much of the details. I seem to remember this being the right thing to do. >More complex will be how to handle system documentation for library >symbols. Do you have any hints there? Do you mean you need to parse the libraries to extract the doc, or is there a processor that has done that already, like doxygen? Eric -- Eric Ludlam: za...@gn..., er...@si... Home: http://www.ludlam.net Siege: www.siege-engine.com Emacs: http://cedet.sourceforge.net GNU: www.gnu.org |