Re[1]: [cedet-semantic] Improved defadvice add-log-current-defun
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2005-09-01 00:17:44
|
Hi all, A delayed response, I finally checked in a modified version of the originally suggested canonical name format function. This involved changes to senator and semantic-format (among others.) At this time it is incomplete. A deep hierarchy (such as from C++ namespace1::namespace2::class::method) will not be shown. For those anxious for a 1.0 release, that is very much on my mind and that is the first thing I'll do if I can get a large enough chunk of time to run through the pre-release checklist. In the meantime, I'll amuse myself with short bugs once in a while. Eric >>> Stefan =?iso-8859-1?Q?Reich=F6r?= <st...@xs...> seems to think that: >"Eric M. Ludlam" <er...@si...> writes: > >>>However, I looked in wisent-python.wy. I think the following parts are relevant: >>> >>>;; funcdef: 'def' NAME parameters ':' suite >>>funcdef >>> : DEF NAME function_parameter_list COLON suite >>> (FUNCTION-TAG $2 nil $3) >>> ; >>> >>>;; classdef: 'class' NAME ['(' testlist ')'] ':' suite >>>class_declaration >>> : CLASS NAME paren_class_list_opt COLON suite >>> (TYPE-TAG $2 $1 ;; Name "class" >>> $5 ;; Members >>> (cons $3 nil) ;; (SUPERCLASSES . INTERFACES) >>> ) >>> ; >>> >>> >>>But I have no idea, how to set the :parent tag for the funcdef. >>>Any pointers? >> [ ... ] >> >> It seems that a class should indeed be a type class. I suspect that >> the 'parent' is found via nesting instead of via a :parent attribute. >> >> As such, I now better understand the original question. >> >> If you have a definition like this in some invented language: >> >> class foo { >> >> method whatever { >> } >> >> } >> >> then 'whatever' has a parent determined by tag nesting. ie: >> >> (semantic-tag-functio-parent whatevertag) >> => nil >> >> but >> >> (semantic-tag-components footag) >> => <#TAG whatever> >> >> where 'components' just means "more tags inside this one". In the >> case of a tag of class type, that means methods and fields. For a >> function, it may be arguments to the function. > >The situation you described above is exactly the case for python. > >> In C++, you can do this instead: >> >> class foo { >> >> void whatever(); >> >> } >> >> void foo::whatever() { >> } >> >> and in this file, there are two 'whatever' tags. The first is as >> described above. The second has a :parent attribute which contains >> the name of the 'foo' tag. To get the foo tag, you would need to >> perform some sort of semantic search. >> >> Does that make sense? Basically, tag tables mirror the code, and it >> is up to various programs to make logical sense from the bounty of >> language implementations. > >Thanks for that nice explanation, now I see the difference between >python and C++ from the viewpoint of semantic. > >My use case (get class name + method name) for the point position >didn't need that distinction. > >If I understood you correct, the new format function will provide a >unified way to get class name + method name for every supported >language. > > >Stefan. [ ... ] |