Re: semantic-analyze-possible-completion

Martin Stein <[email protected]> Sun, 01 Feb 2015 13:58:51 +0100
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
Hi,

David wrote:
> In the old parser I wrote, I did it like this (in
> 'semantic-f90-expand-tag'):
...

>    (("testmodule.f90" include nil nil nil)
>     ("main" program
>      (:usedmodules
>       (("testmodule" use nil ...)))))
...

I have gladly taken and copied these "use" tag structure from the bovine 
f90 parser, I just have moved most of the work to wisent parser.

I am still trying to figure out how the C parser works and how to 
imitate its tag structure. As I have now realised, the word type (as in 
typecache, scoped-types etc) has a wider meaning than just struct or 
class, some of the documentation becomes more clear. In particular I was 
wondering about Davids semantic-analyze-scoped-types functions, which 
now makes a lot more sense.

Eric wrote:
> If a module or type is of class 'type, it will get collected into the typecache.  The only type that is special in the typecache is "namespace".  Namespaces whose names are the same will have their contents merged.  This is because code like this:
>
> namespace foo { int sym1; };
> namespace foo { int sym2; };
>
> keeps adding symbols to the foo namespace.
>
> If modules behave like this, we'll need to take action in the typecache to allow languages to specify which types of types get symbols merged.
There is no such thing as merging, so no probleme there.

However, I was experimenting with namespace examples to see what the 
context looks like and how the relevant tags are retrieved internally 
when I came across this short textbook example somewhat extended by me:

namespace bar
{
   const double math_pi = 3.1416;
   struct nn { double some; } pp;
}


int main () {
   using namespace bar;

   double x;
   x = math_!_
   x = bar::_!_
   return 0;
}

Having the cursor at the first _!_ the completion function should 
suggest math_pi, but it does not. If I type x = bar::math instead, then 
the desired completion is shown. To me this looks like a bug, because 
"using namespace bar" is all about make the bar names available in the 
main function. Do I miss something?

Moreover, even with the prefix bar:: the completion engines misses to 
offer pp at the second _!_, it just offers math_pi. Looks like a bug as 
well?

> Protection for tags varies pretty widely, so to specify custom
> behavior you need to override `semantic-tag-protection'.
I have kept Davids "make all public" approach. For the moment that is 
fine. Protection in Fortran is a bit cumbersome, because you have to 
analyse the order of public and private statements if they occur as 
single keywords on a line without a name. Also I still need to add 
parsing rules for protection for derived types.

Martin


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/