|
45 | 45 | (cc-bytecomp-defvar imenu-case-fold-search)
|
46 | 46 | (cc-bytecomp-defvar imenu-generic-expression)
|
47 | 47 | (cc-bytecomp-defvar imenu-create-index-function)
|
| 48 | +(cc-bytecomp-defun c-literal-limits) |
48 | 49 |
|
49 | 50 |
|
50 | 51 | ;; imenu integration
|
@@ -437,55 +438,56 @@ Example:
|
437 | 438 | (goto-char (point-max))
|
438 | 439 | ;;
|
439 | 440 | (while (re-search-backward cc-imenu-objc-generic-expression nil t)
|
440 |
| - (setq langnum (if (match-beginning OBJC) |
441 |
| - OBJC |
442 |
| - (cond |
443 |
| - ((match-beginning Cproto) Cproto) |
444 |
| - ((match-beginning Cgeneralfunc) Cgeneralfunc) |
445 |
| - ((match-beginning Cnoreturn) Cnoreturn)))) |
446 |
| - (setq str (funcall func (match-beginning langnum) (match-end langnum))) |
447 |
| - ;; |
448 |
| - (cond |
449 |
| - ;; |
450 |
| - ;; C |
451 |
| - ;; |
452 |
| - ((not (eq langnum OBJC)) |
453 |
| - (setq clist (cons (cons str (match-beginning langnum)) clist))) |
454 |
| - ;; |
455 |
| - ;; ObjC |
456 |
| - ;; |
457 |
| - ;; An instance Method |
458 |
| - ((eq (aref str 0) ?-) |
459 |
| - (setq str (concat "-" (cc-imenu-objc-method-to-selector str))) |
460 |
| - (setq methodlist (cons (cons str |
461 |
| - (match-beginning langnum)) |
462 |
| - methodlist))) |
463 |
| - ;; A factory Method |
464 |
| - ((eq (aref str 0) ?+) |
465 |
| - (setq str (concat "+" (cc-imenu-objc-method-to-selector str))) |
466 |
| - (setq methodlist (cons (cons str |
467 |
| - (match-beginning langnum)) |
468 |
| - methodlist))) |
469 |
| - ;; Interface or implementation or protocol |
470 |
| - ((eq (aref str 0) ?@) |
471 |
| - (setq classcount (1+ classcount)) |
| 441 | + (when (not (c-literal-limits)) |
| 442 | + (setq langnum (if (match-beginning OBJC) |
| 443 | + OBJC |
| 444 | + (cond |
| 445 | + ((match-beginning Cproto) Cproto) |
| 446 | + ((match-beginning Cgeneralfunc) Cgeneralfunc) |
| 447 | + ((match-beginning Cnoreturn) Cnoreturn)))) |
| 448 | + (setq str (funcall func (match-beginning langnum) (match-end langnum))) |
| 449 | + ;; |
472 | 450 | (cond
|
473 |
| - ((and (> (length str) implen) |
474 |
| - (string= (substring str 0 implen) "@implementation")) |
475 |
| - (setq str (substring str implen) |
476 |
| - str2 "@implementation")) |
477 |
| - ((string= (substring str 0 intflen) "@interface") |
478 |
| - (setq str (substring str intflen) |
479 |
| - str2 "@interface")) |
480 |
| - ((string= (substring str 0 prtlen) "@protocol") |
481 |
| - (setq str (substring str prtlen) |
482 |
| - str2 "@protocol"))) |
483 |
| - (setq str (cc-imenu-objc-remove-white-space str)) |
484 |
| - (setq methodlist (cons (cons str2 |
485 |
| - (match-beginning langnum)) |
486 |
| - methodlist)) |
487 |
| - (setq toplist (cons (cons str methodlist) toplist) |
488 |
| - methodlist nil)))) |
| 451 | + ;; |
| 452 | + ;; C |
| 453 | + ;; |
| 454 | + ((not (eq langnum OBJC)) |
| 455 | + (setq clist (cons (cons str (match-beginning langnum)) clist))) |
| 456 | + ;; |
| 457 | + ;; ObjC |
| 458 | + ;; |
| 459 | + ;; An instance Method |
| 460 | + ((eq (aref str 0) ?-) |
| 461 | + (setq str (concat "-" (cc-imenu-objc-method-to-selector str))) |
| 462 | + (setq methodlist (cons (cons str |
| 463 | + (match-beginning langnum)) |
| 464 | + methodlist))) |
| 465 | + ;; A factory Method |
| 466 | + ((eq (aref str 0) ?+) |
| 467 | + (setq str (concat "+" (cc-imenu-objc-method-to-selector str))) |
| 468 | + (setq methodlist (cons (cons str |
| 469 | + (match-beginning langnum)) |
| 470 | + methodlist))) |
| 471 | + ;; Interface or implementation or protocol |
| 472 | + ((eq (aref str 0) ?@) |
| 473 | + (setq classcount (1+ classcount)) |
| 474 | + (cond |
| 475 | + ((and (> (length str) implen) |
| 476 | + (string= (substring str 0 implen) "@implementation")) |
| 477 | + (setq str (substring str implen) |
| 478 | + str2 "@implementation")) |
| 479 | + ((string= (substring str 0 intflen) "@interface") |
| 480 | + (setq str (substring str intflen) |
| 481 | + str2 "@interface")) |
| 482 | + ((string= (substring str 0 prtlen) "@protocol") |
| 483 | + (setq str (substring str prtlen) |
| 484 | + str2 "@protocol"))) |
| 485 | + (setq str (cc-imenu-objc-remove-white-space str)) |
| 486 | + (setq methodlist (cons (cons str2 |
| 487 | + (match-beginning langnum)) |
| 488 | + methodlist)) |
| 489 | + (setq toplist (cons (cons str methodlist) toplist) |
| 490 | + methodlist nil))))) |
489 | 491 |
|
490 | 492 | ;; In this buffer, there is only one or zero @{interface|implementation|protocol}.
|
491 | 493 | (if (< classcount 2)
|
|
0 commit comments