logo       

Re: array of objects: msg#00004

emacs.semantic

Subject: Re: array of objects

Hi Eric,

Sorry for this late reply.

> You are correct. Fortunately, this is easy to fix up for C code.
> I found that the below patch got things working with arrays.
>
> Unfortunately, that is not the real purpose of what the separation
> character, so I will resist checking this in while I contemplate a
> better way to do this.
>
> If anyone else has a better notion for dealing with the local
> context parser, I'd like to read it.
[...]
>
> ! (defvar-mode-local c-mode semantic-type-relation-separator-character
> ! '("\\(\\[\\w+\\]\\)?." "\\(\\[\\w+\\]\\)?->")
> "Separator characters between something of a give type, and a field.")
[...]

I agree with you that the above is not the right fix, and, even worse,
it will break completion.

The variable `semantic-type-relation-separator-character' is only used
into two libraries:

senator

which uses it to format TYPE.MEMBER like expressions (so your above
change will produce strange results).

semantic-ctxt

in the function `semantic-ctxt-current-symbol-default', which
`regexp-quote' each separator like this:

(let* ((fieldsep1
(mapconcat
(lambda (a) (regexp-quote a))
semantic-type-relation-separator-character
"\\|"))

So, clearly, `semantic-type-relation-separator-character' must not
contain regexps.

What do you thing of improving `semantic-ctxt-current-symbol-default'
instead, to skip array-like (parenthesized) expressions that surround
symbols? Following is a patch that seems to give good results:

Sincerely,
David

Index: semantic-ctxt.el
===================================================================
RCS file: /cvsroot/cedet/cedet/semantic/semantic-ctxt.el,v
retrieving revision 1.40
diff -c -r1.40 semantic-ctxt.el
*** semantic-ctxt.el 30 Sep 2005 20:19:00 -0000 1.40
--- semantic-ctxt.el 8 Dec 2005 08:11:34 -0000
***************
*** 355,360 ****
--- 355,362 ----
(looking-at fieldsep1))))
(setq symlist (list ""))
(forward-sexp -1)
+ ;; Skip array expressions.
+ (while (looking-at "\\s(") (forward-sexp -1))
(forward-sexp 1)))
(setq end (point))
(condition-case nil
***************
*** 374,380 ****
;; have to stop.
(if (<= cp (point)) (error nil)))
(if (looking-at fieldsep)
! (setq end (point))
(error nil))
)
(error nil)))
--- 376,387 ----
;; have to stop.
(if (<= cp (point)) (error nil)))
(if (looking-at fieldsep)
! (progn
! (forward-sexp -1)
! ;; Skip array expressions.
! (while (looking-at "\\s(") (forward-sexp -1))
! (forward-sexp 1)
! (setq end (point)))
(error nil))
)
(error nil)))




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise