Re: Semantic cannot parse a c++ enum

Eric Ludlam <[email protected]>
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
On 11/21/2014 04:49 AM, Vincent Semeria wrote:
> Hello,
>
> In the attached c++ file which contains a simple enum and 2 functions,
> set the point in function main, on word seBadPassword (an entry of the
> enum).
>
> Then run semantic-ia-fast-jump, which will fail to locate this entry in
> the enum's definition, whereas it's only 15 lines above.

As far as I know, Semantic's smart completion engine doesn't handle 
enums in terms of pulling enum symbols into the global namespace where 
they can be found.

It worked OK when I did:

   WriteEvent(securityEvent::seBadPassword);

but that is undesirable.

I poked around a little to see where I might be able to update this, and 
found that if I treat enums like namespaces while scoping in symbols, it 
appears to work.   I'm a bit hesitant to make this change as I'm not 
sure what consequences there might be.  I looked through the tests, and 
tests for enums are missing, so I don't have a good way to know what I 
might have broken.

Regardless, here is a patch you can play with.   Let me know how it 
goes, or if it breaks anything new.

Eric

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk

_______________________________________________
Cedet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-devel
scope.el.patch (text/x-patch, 1.2 KB)
=== modified file 'lisp/cedet/semantic/scope.el'
*** lisp/cedet/semantic/scope.el	2013-11-21 21:03:33 +0000
--- lisp/cedet/semantic/scope.el	2014-11-24 19:37:08 +0000
***************
*** 1,6 ****
  ;;; semantic/scope.el --- Analyzer Scope Calculations
  
! ;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
  
  ;; Author: Eric M. Ludlam <[email protected]>
  
--- 1,6 ----
  ;;; semantic/scope.el --- Analyzer Scope Calculations
  
! ;; Copyright (C) 2007-2014 Free Software Foundation, Inc.
  
  ;; Author: Eric M. Ludlam <[email protected]>
  
***************
*** 415,421 ****
      ;; the names in typelist.
      (while typelist
        (let ((tt (semantic-tag-type (car typelist))))
! 	(when (and (stringp tt) (string= tt "namespace"))
  	  ;; By using the typecache, our namespaces are pre-merged.
  	  (setq typelist2 (cons (car typelist) typelist2))
  	  ))
--- 415,422 ----
      ;; the names in typelist.
      (while typelist
        (let ((tt (semantic-tag-type (car typelist))))
! 	(when (and (stringp tt) (or (string= tt "namespace")
! 				    (string= tt "enum")))
  	  ;; By using the typecache, our namespaces are pre-merged.
  	  (setq typelist2 (cons (car typelist) typelist2))
  	  ))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.