Mercurial > emacs
annotate lisp/cedet/semantic/bovine/c.el @ 112150:14a97ab281d5
* install-sh, mkinstalldirs, move-if-change: Update from master
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Fri, 07 Jan 2011 12:42:11 -0800 |
parents | 2b266010d0b7 |
children | 417b1e4d63cd |
rev | line source |
---|---|
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/bovine/c.el --- Semantic details for C |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
105340 | 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
106815 | 4 ;; 2008, 2009, 2010 Free Software Foundation, Inc. |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; (at your option) any later version. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;;; Commentary: |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; Support for the C/C++ bovine parser for Semantic. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; @todo - can I support c++-font-lock-extra-types ? |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 (require 'semantic) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 (require 'semantic/analyze) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 (require 'semantic/bovine/gcc) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 (require 'semantic/idle) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 (require 'semantic/lex-spp) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'semantic/bovine/c-by) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (eval-when-compile |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (require 'semantic/find)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 (declare-function semantic-brute-find-tag-by-attribute "semantic/find") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (declare-function semanticdb-minor-mode-p "semantic/db-mode") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (declare-function semanticdb-needs-refresh-p "semantic/db") |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
42 (declare-function semanticdb-typecache-faux-namespace "semantic/db-typecache") |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 (declare-function c-forward-conditional "cc-cmds") |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104452
diff
changeset
|
44 (declare-function ede-system-include-path "ede") |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ;;; Compatibility |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (eval-when-compile (require 'cc-mode)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (if (fboundp 'c-end-of-macro) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (eval-and-compile |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (defalias 'semantic-c-end-of-macro 'c-end-of-macro)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; From cc-mode 5.30 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (defun semantic-c-end-of-macro () |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 "Go to the end of a preprocessor directive. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 More accurately, move point to the end of the closest following line |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 that doesn't end with a line continuation backslash. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 This function does not do any hidden buffer changes." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 (while (progn |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (end-of-line) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 (when (and (eq (char-before) ?\\) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 (not (eobp))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (forward-char) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 t)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 ;;; Code: |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (define-child-mode c++-mode c-mode |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 "`c++-mode' uses the same parser as `c-mode'.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 ;;; Include Paths |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (defcustom-mode-local-semantic-dependency-system-include-path |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 c-mode semantic-c-dependency-system-include-path |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 '("/usr/include") |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
78 "The system include path used by the C language.") |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (defcustom semantic-default-c-path nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 "Default set of include paths for C code. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 Used by `semantic-dep' to define an include path. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 NOTE: In process of obsoleting this." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 :group 'c |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 :group 'semantic |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 :type '(repeat (string :tag "Path"))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (defvar-mode-local c-mode semantic-dependency-include-path |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 semantic-default-c-path |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 "System path to search for include files.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 ;;; Compile Options |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 ;; Compiler options need to show up after path setup, but before |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 ;; the preprocessor section. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 |
111461 | 97 (if (memq system-type '(gnu gnu/linux darwin cygwin)) |
98 (semantic-gcc-setup)) | |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 ;;; Pre-processor maps |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 ;;; Lexical analysis |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (defvar semantic-lex-c-preprocessor-symbol-map-builtin |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 '( ("__THROW" . "") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 ("__const" . "const") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 ("__restrict" . "") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 ("__declspec" . ((spp-arg-list ("foo") 1 . 2))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 ("__attribute__" . ((spp-arg-list ("foo") 1 . 2))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 "List of symbols to include by default.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (defvar semantic-c-in-reset-preprocessor-table nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 "Non-nil while resetting the preprocessor symbol map. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 Used to prevent a reset while trying to parse files that are |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 part of the preprocessor map.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (defvar semantic-lex-c-preprocessor-symbol-file) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (defvar semantic-lex-c-preprocessor-symbol-map) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (defun semantic-c-reset-preprocessor-symbol-map () |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 "Reset the C preprocessor symbol map based on all input variables." |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
122 (when (featurep 'semantic/bovine/c) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (let ((filemap nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (when (and (not semantic-c-in-reset-preprocessor-table) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (featurep 'semantic/db-mode) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (semanticdb-minor-mode-p)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (let ( ;; Don't use external parsers. We need the internal one. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (semanticdb-out-of-buffer-create-table-fcn nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 ;; Don't recurse while parsing these files the first time. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (semantic-c-in-reset-preprocessor-table t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 (dolist (sf semantic-lex-c-preprocessor-symbol-file) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ;; Global map entries |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (let* ((table (semanticdb-file-table-object sf t))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (when table |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (when (semanticdb-needs-refresh-p table) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (condition-case nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 ;; Call with FORCE, as the file is very likely to |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 ;; not be in a buffer. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 (semanticdb-refresh-table table t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (error (message "Error updating tables for %S" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (object-name table))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 (setq filemap (append filemap (oref table lexical-table))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 )))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 (setq-mode-local c-mode |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 semantic-lex-spp-macro-symbol-obarray |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (semantic-lex-make-spp-table |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (append semantic-lex-c-preprocessor-symbol-map-builtin |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 semantic-lex-c-preprocessor-symbol-map |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 filemap)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (defcustom semantic-lex-c-preprocessor-symbol-map nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 "Table of C Preprocessor keywords used by the Semantic C lexer. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 Each entry is a cons cell like this: |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 ( \"KEYWORD\" . \"REPLACEMENT\" ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 Where KEYWORD is the macro that gets replaced in the lexical phase, |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
162 and REPLACEMENT is a string that is inserted in its place. Empty string |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 implies that the lexical analyzer will discard KEYWORD when it is encountered. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 Alternately, it can be of the form: |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 ( \"KEYWORD\" ( LEXSYM1 \"str\" 1 1 ) ... ( LEXSYMN \"str\" 1 1 ) ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 where LEXSYM is a symbol that would normally be produced by the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 lexical analyzer, such as `symbol' or `string'. The string in the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 second position is the text that makes up the replacement. This is |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 the way to have multiple lexical symbols in a replacement. Using the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 first way to specify text like \"foo::bar\" would not work, because : |
105340 | 172 is a separate lexical symbol. |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 A quick way to see what you would need to insert is to place a |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 definition such as: |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 #define MYSYM foo::bar |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 into a C file, and do this: |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 \\[semantic-lex-spp-describe] |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 The output table will describe the symbols needed." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 :group 'c |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 :type '(repeat (cons (string :tag "Keyword") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 (sexp :tag "Replacement"))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 :set (lambda (sym value) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 (set-default sym value) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (condition-case nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (semantic-c-reset-preprocessor-symbol-map) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (error nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (defcustom semantic-lex-c-preprocessor-symbol-file nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 "List of C/C++ files that contain preprocessor macros for the C lexer. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 Each entry is a filename and each file is parsed, and those macros |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 are included in every C/C++ file parsed by semantic. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 You can use this variable instead of `semantic-lex-c-preprocessor-symbol-map' |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 to store your global macros in a more natural way." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 :group 'c |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 :type '(repeat (file :tag "File")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 :set (lambda (sym value) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (set-default sym value) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (condition-case nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (semantic-c-reset-preprocessor-symbol-map) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (error nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (defcustom semantic-c-member-of-autocast 't |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
211 "Non-nil means classes with a '->' operator will cast to its return type. |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 For Examples: |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 class Foo { |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 Bar *operator->(); |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 } |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 Foo foo; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 if `semantic-c-member-of-autocast' is non-nil : |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 foo->[here completion will list method of Bar] |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 if `semantic-c-member-of-autocast' is nil : |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 foo->[here completion will list method of Foo]" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 :group 'c |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 :type 'boolean) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 (define-lex-spp-macro-declaration-analyzer semantic-lex-cpp-define |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 "A #define of a symbol with some value. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 Record the symbol in the semantic preprocessor. |
105423
309bc750556d
* files-x.el (modify-dir-local-variable)
Juanma Barranquero <lekktu@gmail.com>
parents:
105377
diff
changeset
|
232 Return the defined symbol as a special spp lex token." |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 "^\\s-*#\\s-*define\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 1 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (skip-chars-forward " \t") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (if (eolp) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (let* ((name (buffer-substring-no-properties |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (match-beginning 1) (match-end 1))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (with-args (save-excursion |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (looking-at "("))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 (semantic-lex-spp-replacements-enabled nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 ;; Temporarilly override the lexer to include |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 ;; special items needed inside a macro |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 (semantic-lex-analyzer #'semantic-cpp-lexer) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (raw-stream |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (semantic-lex-spp-stream-for-macro (save-excursion |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (semantic-c-end-of-macro) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 (point)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 ;; Only do argument checking if the paren was immediatly after |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 ;; the macro name. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (if with-args |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (semantic-lex-spp-first-token-arg-list (car raw-stream))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 ;; Magical spp variable for end point. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (setq semantic-lex-end-point (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 ;; Handled nested macro streams. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 (semantic-lex-spp-merge-streams raw-stream) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (define-lex-spp-macro-undeclaration-analyzer semantic-lex-cpp-undef |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 "A #undef of a symbol. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 Remove the symbol from the semantic preprocessor. |
105423
309bc750556d
* files-x.el (modify-dir-local-variable)
Juanma Barranquero <lekktu@gmail.com>
parents:
105377
diff
changeset
|
268 Return the defined symbol as a special spp lex token." |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 "^\\s-*#\\s-*undef\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 ;;; Conditional Skipping |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (defcustom semantic-c-obey-conditional-section-parsing-flag t |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 "*Non-nil means to interpret preprocessor #if sections. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 This implies that some blocks of code will not be parsed based on the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 values of the conditions in the #if blocks." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 :group 'c |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 :type 'boolean) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 (defun semantic-c-skip-conditional-section () |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 "Skip one section of a conditional. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 Moves forward to a matching #elif, #else, or #endif. |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
284 Moves completely over balanced #if blocks." |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 (require 'cc-cmds) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 (let ((done nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 ;; (if (looking-at "^\\s-*#if") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 ;; (semantic-lex-spp-push-if (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 (end-of-line) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 (while (and semantic-c-obey-conditional-section-parsing-flag |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 (and (not done) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 (re-search-forward |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 "^\\s-*#\\s-*\\(if\\(n?def\\)?\\|el\\(if\\|se\\)\\|endif\\)\\>" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 nil t))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 (goto-char (match-beginning 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (cond |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 ((looking-at "^\\s-*#\\s-*if") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 ;; We found a nested if. Skip it. |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
299 ;; @TODO - can we use the new c-scan-conditionals |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 (c-forward-conditional 1)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 ((looking-at "^\\s-*#\\s-*elif") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 ;; We need to let the preprocessor analize this one. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (beginning-of-line) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (setq done t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 ((looking-at "^\\s-*#\\s-*\\(endif\\|else\\)\\>") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 ;; We are at the end. Pop our state. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 ;; (semantic-lex-spp-pop-if) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 ;; Note: We include ELSE and ENDIF the same. If skip some previous |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 ;; section, then we should do the else by default, making it much |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 ;; like the endif. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 (end-of-line) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 (forward-char 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (setq done t)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 (t |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 ;; We found an elif. Stop here. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 (setq done t)))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (define-lex-regex-analyzer semantic-lex-c-if |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 "Code blocks wrapped up in #if, or #ifdef. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 Uses known macro tables in SPP to determine what block to skip." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 "^\\s-*#\\s-*\\(if\\|ifndef\\|ifdef\\|elif\\)\\s-+\\(!?defined(\\|\\)\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\(\\s-*)\\)?\\s-*$" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (semantic-c-do-lex-if)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (defun semantic-c-do-lex-if () |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 "Handle lexical CPP if statements." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (let* ((sym (buffer-substring-no-properties |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (match-beginning 3) (match-end 3))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 (defstr (buffer-substring-no-properties |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (match-beginning 2) (match-end 2))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 (defined (string= defstr "defined(")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 (notdefined (string= defstr "!defined(")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 (ift (buffer-substring-no-properties |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 (match-beginning 1) (match-end 1))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 (ifdef (or (string= ift "ifdef") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 (and (string= ift "if") defined) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 (and (string= ift "elif") defined) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 (ifndef (or (string= ift "ifndef") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 (and (string= ift "if") notdefined) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 (and (string= ift "elif") notdefined) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 (if (or (and (or (string= ift "if") (string= ift "elif")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 (string= sym "0")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 (and ifdef (not (semantic-lex-spp-symbol-p sym))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 (and ifndef (semantic-lex-spp-symbol-p sym))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 ;; The if indecates to skip this preprocessor section |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (let ((pt nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 ;; (message "%s %s yes" ift sym) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (beginning-of-line) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 (setq pt (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 ;; This skips only a section of a conditional. Once that section |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 ;; is opened, encountering any new #else or related conditional |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 ;; should be skipped. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (semantic-c-skip-conditional-section) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 (setq semantic-lex-end-point (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (semantic-push-parser-warning (format "Skip #%s %s" ift sym) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 pt (point)) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
360 ;; (semantic-lex-push-token |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
361 ;; (semantic-lex-token 'c-preprocessor-skip pt (point))) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 ;; Else, don't ignore it, but do handle the internals. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 ;;(message "%s %s no" ift sym) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 (end-of-line) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (setq semantic-lex-end-point (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 nil))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (define-lex-regex-analyzer semantic-lex-c-macro-else |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 "Ignore an #else block. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 We won't see the #else due to the macro skip section block |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 unless we are actively parsing an open #if statement. In that |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 case, we must skip it since it is the ELSE part." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 "^\\s-*#\\s-*\\(else\\)" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (let ((pt (point))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (semantic-c-skip-conditional-section) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 (setq semantic-lex-end-point (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 (semantic-push-parser-warning "Skip #else" pt (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 ;; (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 ;; (semantic-lex-token 'c-preprocessor-skip pt (point))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (define-lex-regex-analyzer semantic-lex-c-macrobits |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 "Ignore various forms of #if/#else/#endif conditionals." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 "^\\s-*#\\s-*\\(if\\(n?def\\)?\\|endif\\|elif\\|else\\)" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 (semantic-c-end-of-macro) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (setq semantic-lex-end-point (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 (define-lex-spp-include-analyzer semantic-lex-c-include-system |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 "Identify include strings, and return special tokens." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 "^\\s-*#\\s-*include\\s-*<\\([^ \t\n>]+\\)>" 0 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 ;; Hit 1 is the name of the include. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 (setq semantic-lex-end-point (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 (cons (buffer-substring-no-properties (match-beginning 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 (match-end 1)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 'system)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 (define-lex-spp-include-analyzer semantic-lex-c-include |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 "Identify include strings, and return special tokens." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 "^\\s-*#\\s-*include\\s-*\"\\([^ \t\n>]+\\)\"" 0 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 ;; Hit 1 is the name of the include. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 (setq semantic-lex-end-point (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 (cons (buffer-substring-no-properties (match-beginning 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 (match-end 1)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 (define-lex-regex-analyzer semantic-lex-c-ignore-ending-backslash |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 "Skip backslash ending a line. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 Go to the next line." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 "\\\\\\s-*\n" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 (setq semantic-lex-end-point (match-end 0))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (define-lex-regex-analyzer semantic-lex-c-namespace-begin-macro |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 "Handle G++'s namespace macros which the pre-processor can't handle." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 "\\(_GLIBCXX_BEGIN_NAMESPACE\\)(\\s-*\\(\\(?:\\w\\|\\s_\\)+\\)\\s-*)" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 (let* ((nsend (match-end 1)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 (sym-start (match-beginning 2)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 (sym-end (match-end 2)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 (ms (buffer-substring-no-properties sym-start sym-end))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 ;; Push the namespace keyword. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 (semantic-lex-token 'NAMESPACE (match-beginning 0) nsend "namespace")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 ;; Push the name. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 (semantic-lex-token 'symbol sym-start sym-end ms)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 (let ((start (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 (end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 ;; If we can't find a matching end, then create the fake list. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 (when (re-search-forward "_GLIBCXX_END_NAMESPACE" nil t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 (setq end (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (semantic-lex-token 'semantic-list start end |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (list 'prefix-fake))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (setq semantic-lex-end-point (point))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 (defcustom semantic-lex-c-nested-namespace-ignore-second t |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 "Should _GLIBCXX_BEGIN_NESTED_NAMESPACE ignore the second namespace? |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 It is really there, but if a majority of uses is to squeeze out |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 the second namespace in use, then it should not be included. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 If you are having problems with smart completion and STL templates, |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
448 it may be that this is set incorrectly. After changing the value |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 of this flag, you will need to delete any semanticdb cache files |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 that may have been incorrectly parsed." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 :group 'semantic |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 :type 'boolean) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 (define-lex-regex-analyzer semantic-lex-c-VC++-begin-std-namespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 "Handle VC++'s definition of the std namespace." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 "\\(_STD_BEGIN\\)" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 (semantic-lex-token 'NAMESPACE (match-beginning 0) (match-end 0) "namespace")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (semantic-lex-token 'symbol (match-beginning 0) (match-end 0) "std")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 (let ((start (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 (end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 (when (re-search-forward "_STD_END" nil t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 (setq end (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 (semantic-lex-token 'semantic-list start end |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 (list 'prefix-fake))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (setq semantic-lex-end-point (point))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 (define-lex-regex-analyzer semantic-lex-c-VC++-end-std-namespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 "Handle VC++'s definition of the std namespace." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 "\\(_STD_END\\)" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 (setq semantic-lex-end-point (point))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 (define-lex-regex-analyzer semantic-lex-c-namespace-begin-nested-macro |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 "Handle G++'s namespace macros which the pre-processor can't handle." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 "\\(_GLIBCXX_BEGIN_NESTED_NAMESPACE\\)(\\s-*\\(\\(?:\\w\\|\\s_\\)+\\)\\s-*,\\s-*\\(\\(?:\\w\\|\\s_\\)+\\)\\s-*)" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 (let* ((nsend (match-end 1)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 (sym-start (match-beginning 2)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 (sym-end (match-end 2)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 (ms (buffer-substring-no-properties sym-start sym-end)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 (sym2-start (match-beginning 3)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 (sym2-end (match-end 3)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 (ms2 (buffer-substring-no-properties sym2-start sym2-end))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 ;; Push the namespace keyword. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 (semantic-lex-token 'NAMESPACE (match-beginning 0) nsend "namespace")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 ;; Push the name. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 (semantic-lex-token 'symbol sym-start sym-end ms)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 (let ((start (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 (end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 ;; If we can't find a matching end, then create the fake list. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 (when (re-search-forward "_GLIBCXX_END_NESTED_NAMESPACE" nil t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 (setq end (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 (if semantic-lex-c-nested-namespace-ignore-second |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 ;; The same as _GLIBCXX_BEGIN_NAMESPACE |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 (semantic-lex-token 'semantic-list start end |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (list 'prefix-fake))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 ;; Do both the top and second level namespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 (semantic-lex-token 'semantic-list start end |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 ;; We'll depend on a quick hack |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 (list 'prefix-fake-plus |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 (semantic-lex-token 'NAMESPACE |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 sym-end sym2-start |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 "namespace") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 (semantic-lex-token 'symbol |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 sym2-start sym2-end |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 ms2) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 (semantic-lex-token 'semantic-list start end |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 (list 'prefix-fake))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 (setq semantic-lex-end-point (point))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 (define-lex-regex-analyzer semantic-lex-c-namespace-end-macro |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 "Handle G++'s namespace macros which the pre-processor can't handle." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 "_GLIBCXX_END_\\(NESTED_\\)?NAMESPACE" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 (goto-char (match-end 0)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 (setq semantic-lex-end-point (point))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 (define-lex-regex-analyzer semantic-lex-c-string |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 "Detect and create a C string token." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 "L?\\(\\s\"\\)" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 ;; Zing to the end of this string. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 (semantic-lex-push-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 (semantic-lex-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 'string (point) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 (save-excursion |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 ;; Skip L prefix if present. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 (goto-char (match-beginning 1)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 (semantic-lex-unterminated-syntax-protection 'string |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 (forward-sexp 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 (point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 )))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 (define-lex-regex-analyzer semantic-c-lex-ignore-newline |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 "Detect and ignore newline tokens. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 Use this ONLY if newlines are not whitespace characters (such as when |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 they are comment end characters)." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 ;; Just like semantic-lex-ignore-newline, but also ignores |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 ;; trailing \. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 "\\s-*\\\\?\\s-*\\(\n\\|\\s>\\)" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 (setq semantic-lex-end-point (match-end 0))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (define-lex semantic-c-lexer |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 "Lexical Analyzer for C code. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 Use semantic-cpp-lexer for parsing text inside a CPP macro." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 ;; C preprocessor features |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 semantic-lex-cpp-define |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 semantic-lex-cpp-undef |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 semantic-lex-c-if |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 semantic-lex-c-macro-else |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 semantic-lex-c-macrobits |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 semantic-lex-c-include |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 semantic-lex-c-include-system |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 semantic-lex-c-ignore-ending-backslash |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 ;; Whitespace handling |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 semantic-lex-ignore-whitespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 semantic-c-lex-ignore-newline |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 ;; Non-preprocessor features |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 semantic-lex-number |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 ;; Must detect C strings before symbols because of possible L prefix! |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 semantic-lex-c-string |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 ;; Custom handlers for some macros come before the macro replacement analyzer. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 semantic-lex-c-namespace-begin-macro |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 semantic-lex-c-namespace-begin-nested-macro |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 semantic-lex-c-namespace-end-macro |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 semantic-lex-c-VC++-begin-std-namespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 semantic-lex-c-VC++-end-std-namespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 ;; Handle macros, symbols, and keywords |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 semantic-lex-spp-replace-or-symbol-or-keyword |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 semantic-lex-charquote |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 semantic-lex-paren-or-list |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 semantic-lex-close-paren |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 semantic-lex-ignore-comments |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 semantic-lex-punctuation |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 semantic-lex-default-action) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 (define-lex-simple-regex-analyzer semantic-lex-cpp-hashhash |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 "Match ## inside a CPP macro as special." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 "##" 'spp-concat) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 (define-lex semantic-cpp-lexer |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 "Lexical Analyzer for CPP macros in C code." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 ;; CPP special |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 semantic-lex-cpp-hashhash |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 ;; C preprocessor features |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 semantic-lex-cpp-define |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 semantic-lex-cpp-undef |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 semantic-lex-c-if |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 semantic-lex-c-macro-else |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 semantic-lex-c-macrobits |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 semantic-lex-c-include |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 semantic-lex-c-include-system |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 semantic-lex-c-ignore-ending-backslash |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 ;; Whitespace handling |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 semantic-lex-ignore-whitespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 semantic-c-lex-ignore-newline |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 ;; Non-preprocessor features |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 semantic-lex-number |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 ;; Must detect C strings before symbols because of possible L prefix! |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 semantic-lex-c-string |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 ;; Parsing inside a macro means that we don't do macro replacement. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 ;; semantic-lex-spp-replace-or-symbol-or-keyword |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 semantic-lex-symbol-or-keyword |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 semantic-lex-charquote |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 semantic-lex-paren-or-list |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 semantic-lex-close-paren |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 semantic-lex-ignore-comments |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 semantic-lex-punctuation |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
620 semantic-lex-default-action) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
622 (define-mode-local-override semantic-parse-region c-mode |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 (start end &optional nonterminal depth returnonerror) |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
624 "Calls `semantic-parse-region-default', except in a macro expansion. |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 MACRO expansion mode is handled through the nature of Emacs's non-lexical |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 binding of variables. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 START, END, NONTERMINAL, DEPTH, and RETURNONERRORS are the same |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 as for the parent." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 (if (and (boundp 'lse) (or (/= start 1) (/= end (point-max)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 (let* ((last-lexical-token lse) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 (llt-class (semantic-lex-token-class last-lexical-token)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
632 (llt-fakebits (car (cdr last-lexical-token))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
633 (macroexpand (stringp (car (cdr last-lexical-token))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
634 (if macroexpand |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
635 (progn |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 ;; It is a macro expansion. Do something special. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 ;;(message "MOOSE %S %S, %S : %S" start end nonterminal lse) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
638 (semantic-c-parse-lexical-token |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 lse nonterminal depth returnonerror) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
640 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
641 ;; Not a macro expansion, but perhaps a funny semantic-list |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 ;; is at the start? Remove the depth if our semantic list is not |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 ;; made of list tokens. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
644 (if (and depth (= depth 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 (eq llt-class 'semantic-list) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 (not (null llt-fakebits)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
647 (consp llt-fakebits) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 (symbolp (car llt-fakebits)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 (progn |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
651 (setq depth 0) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 ;; This is a copy of semantic-parse-region-default where we |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
654 ;; are doing something special with the lexication of the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 ;; contents of the semantic-list token. Stuff not used by C |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 ;; removed. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 (let ((tokstream |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 (if (and (consp llt-fakebits) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 (eq (car llt-fakebits) 'prefix-fake-plus)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
660 ;; If our semantic-list is special, then only stick in the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 ;; fake tokens. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 (cdr llt-fakebits) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
663 ;; Lex up the region with a depth of 0 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
664 (semantic-lex start end 0)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
666 ;; Do the parse |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
667 (nreverse |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
668 (semantic-repeat-parse-whole-stream tokstream |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
669 nonterminal |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
670 returnonerror)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
671 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
672 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
673 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
674 ;; It was not a macro expansion, nor a special semantic-list. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
675 ;; Do old thing. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
676 (semantic-parse-region-default start end |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
677 nonterminal depth |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
678 returnonerror) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 ;; Do the parse |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
681 (semantic-parse-region-default start end nonterminal |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 depth returnonerror) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
684 |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
685 (defvar semantic-c-parse-token-hack-depth 0 |
105340 | 686 "Current depth of recursive calls to `semantic-c-parse-lexical-token'.") |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
687 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 (defun semantic-c-parse-lexical-token (lexicaltoken nonterminal depth |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
689 returnonerror) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 "Do a region parse on the contents of LEXICALTOKEN. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
691 Presumably, this token has a string in it from a macro. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 The text of the token is inserted into a different buffer, and |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
693 parsed there. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
694 Argument NONTERMINAL, DEPTH, and RETURNONERROR are passed into |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
695 the regular parser." |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
696 (let* ((semantic-c-parse-token-hack-depth (1+ semantic-c-parse-token-hack-depth)) |
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
697 (buf (get-buffer-create (format " *C parse hack %d*" |
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
698 semantic-c-parse-token-hack-depth))) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 (mode major-mode) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 (spp-syms semantic-lex-spp-dynamic-macro-symbol-obarray) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
701 (stream nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
702 (start (semantic-lex-token-start lexicaltoken)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
703 (end (semantic-lex-token-end lexicaltoken)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
704 (symtext (semantic-lex-token-text lexicaltoken)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
705 (macros (get-text-property 0 'macros symtext)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 ) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
707 (if (> semantic-c-parse-token-hack-depth 5) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
708 nil |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
709 (with-current-buffer buf |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
710 (erase-buffer) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
711 (when (not (eq major-mode mode)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
712 (save-match-data |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
713 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
714 ;; Protect against user hooks throwing errors. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
715 (condition-case nil |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
716 (funcall mode) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
717 (error |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
718 (if (y-or-n-p |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
719 (format "There was an error initializing %s in buffer \"%s\". Debug your hooks? " |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
720 mode (buffer-name))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
721 (semantic-c-debug-mode-init mode) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
722 (message "Macro parsing state may be broken...") |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
723 (sit-for 1)))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
724 ) ; save match data |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
725 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
726 ;; Hack in mode-local |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
727 (activate-mode-local-bindings) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
728 ;; CHEATER! The following 3 lines are from |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
729 ;; `semantic-new-buffer-fcn', but we don't want to turn |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
730 ;; on all the other annoying modes for this little task. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
731 (setq semantic-new-buffer-fcn-was-run t) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
732 (semantic-lex-init) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
733 (semantic-clear-toplevel-cache) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
734 (remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
735 t) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
736 ) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
737 ;; Get the macro symbol table right. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
738 (setq semantic-lex-spp-dynamic-macro-symbol-obarray spp-syms) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
739 ;; (message "%S" macros) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
740 (dolist (sym macros) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
741 (semantic-lex-spp-symbol-set (car sym) (cdr sym))) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
742 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
743 (insert symtext) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
744 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
745 (setq stream |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
746 (semantic-parse-region-default |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
747 (point-min) (point-max) nonterminal depth returnonerror)) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
748 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
749 ;; Clean up macro symbols |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
750 (dolist (sym macros) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
751 (semantic-lex-spp-symbol-remove (car sym))) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
752 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
753 ;; Convert the text of the stream. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
754 (dolist (tag stream) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
755 ;; Only do two levels here 'cause I'm lazy. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
756 (semantic--tag-set-overlay tag (list start end)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
757 (dolist (stag (semantic-tag-components-with-overlays tag)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
758 (semantic--tag-set-overlay stag (list start end)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
759 )) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
760 )) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
761 stream)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
762 |
105692
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
763 (defvar semantic-c-debug-mode-init-last-mode nil |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
764 "The most recent mode needing debugging.") |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
765 |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
766 (defun semantic-c-debug-mode-init (mm) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
767 "Debug mode init for major mode MM after we're done parsing now." |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
768 (interactive (list semantic-c-debug-mode-init-last-mode)) |
106197
019d906c8f48
* cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents:
105842
diff
changeset
|
769 (if (called-interactively-p 'interactive) |
105692
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
770 ;; Do the debug. |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
771 (progn |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
772 (switch-to-buffer (get-buffer-create "*MODE HACK TEST*")) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
773 (let ((debug-on-error t)) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
774 (funcall mm))) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
775 |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
776 ;; Notify about the debug |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
777 (setq semantic-c-debug-mode-init-last-mode mm) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
778 |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
779 (add-hook 'post-command-hook 'semantic-c-debug-mode-init-pch))) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
780 |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
781 (defun semantic-c-debug-mode-init-pch () |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
782 "Notify user about needing to debug their major mode hooks." |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
783 (let ((mm semantic-c-debug-mode-init-last-mode)) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
784 (switch-to-buffer-other-window |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
785 (get-buffer-create "*MODE HACK TEST*")) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
786 (erase-buffer) |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
787 (insert "A failure occurred while parsing your buffers. |
105692
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
788 |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
789 The failure occurred while attempting to initialize " (symbol-name mm) " in a |
105692
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
790 buffer not associated with a file. To debug this problem, type |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
791 |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
792 M-x semantic-c-debug-mode-init |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
793 |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
794 now. |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
795 ") |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
796 (remove-hook 'post-command-hook 'semantic-c-debug-mode-init-pch))) |
15b4b661ceb1
* cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
Chong Yidong <cyd@stupidchicken.com>
parents:
105423
diff
changeset
|
797 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
798 (defun semantic-expand-c-tag (tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
799 "Expand TAG into a list of equivalent tags, or nil." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
800 (let ((return-list nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
801 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 ;; Expand an EXTERN C first. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
803 (when (eq (semantic-tag-class tag) 'extern) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 (let* ((mb (semantic-tag-get-attribute tag :members)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
805 (ret mb)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 (while mb |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
807 (let ((mods (semantic-tag-get-attribute (car mb) :typemodifiers))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
808 (setq mods (cons "extern" (cons "\"C\"" mods))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
809 (semantic-tag-put-attribute (car mb) :typemodifiers mods)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
810 (setq mb (cdr mb))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
811 (setq return-list ret))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
812 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
813 ;; Function or variables that have a :type that is some complex |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
814 ;; thing, extract it, and replace it with a reference. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
815 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
816 ;; Thus, struct A { int a; } B; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
817 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
818 ;; will create 2 toplevel tags, one is type A, and the other variable B |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
819 ;; where the :type of B is just a type tag A that is a prototype, and |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
820 ;; the actual struct info of A is it's own toplevel tag. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
821 (when (or (semantic-tag-of-class-p tag 'function) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
822 (semantic-tag-of-class-p tag 'variable)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
823 (let* ((basetype (semantic-tag-type tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
824 (typeref nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
825 (tname (when (consp basetype) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
826 (semantic-tag-name basetype)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
827 ;; Make tname be a string. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
828 (when (consp tname) (setq tname (car (car tname)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
829 ;; Is the basetype a full type with a name of its own? |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
830 (when (and basetype (semantic-tag-p basetype) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
831 (not (semantic-tag-prototype-p basetype)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
832 tname |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
833 (not (string= tname ""))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
834 ;; a type tag referencing the type we are extracting. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
835 (setq typeref (semantic-tag-new-type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
836 (semantic-tag-name basetype) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
837 (semantic-tag-type basetype) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
838 nil nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
839 :prototype t)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
840 ;; Convert original tag to only have a reference. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
841 (setq tag (semantic-tag-copy tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
842 (semantic-tag-put-attribute tag :type typeref) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
843 ;; Convert basetype to have the location information. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
844 (semantic--tag-copy-properties tag basetype) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
845 (semantic--tag-set-overlay basetype |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
846 (semantic-tag-overlay tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
847 ;; Store the base tag as part of the return list. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
848 (setq return-list (cons basetype return-list))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
849 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
850 ;; Name of the tag is a list, so expand it. Tag lists occur |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
851 ;; for variables like this: int var1, var2, var3; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
852 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
853 ;; This will expand that to 3 tags that happen to share the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
854 ;; same overlay information. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
855 (if (consp (semantic-tag-name tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
856 (let ((rl (semantic-expand-c-tag-namelist tag))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
857 (cond |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
858 ;; If this returns nothing, then return nil overall |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
859 ;; because that will restore the old TAG input. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
860 ((not rl) (setq return-list nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
861 ;; If we have a return, append it to the existing list |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
862 ;; of returns. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
863 ((consp rl) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
864 (setq return-list (append rl return-list))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
865 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
866 ;; If we didn't have a list, but the return-list is non-empty, |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
867 ;; that means we still need to take our existing tag, and glom |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
868 ;; it onto our extracted type. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
869 (if (consp return-list) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
870 (setq return-list (cons tag return-list))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
871 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
872 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
873 ;; Default, don't change the tag means returning nil. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
874 return-list)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
875 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
876 (defun semantic-expand-c-tag-namelist (tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
877 "Expand TAG whose name is a list into a list of tags, or nil." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
878 (cond ((semantic-tag-of-class-p tag 'variable) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
879 ;; The name part comes back in the form of: |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
880 ;; ( NAME NUMSTARS BITS ARRAY ASSIGN ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
881 (let ((vl nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
882 (basety (semantic-tag-type tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
883 (ty "") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
884 (mods (semantic-tag-get-attribute tag :typemodifiers)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
885 (suffix "") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
886 (lst (semantic-tag-name tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
887 (default nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
888 (cur nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
889 ;; Open up each name in the name list. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
890 (while lst |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
891 (setq suffix "" ty "") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
892 (setq cur (car lst)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
893 (if (nth 2 cur) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
894 (setq suffix (concat ":" (nth 2 cur)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
895 (if (= (length basety) 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
896 (setq ty (car basety)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
897 (setq ty basety)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
898 (setq default (nth 4 cur)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
899 (setq vl (cons |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
900 (semantic-tag-new-variable |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
901 (car cur) ;name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
902 ty ;type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
903 (if default |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
904 (buffer-substring-no-properties |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
905 (car default) (car (cdr default)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
906 :constant-flag (semantic-tag-variable-constant-p tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
907 :suffix suffix |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
908 :typemodifiers mods |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
909 :dereference (length (nth 3 cur)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
910 :pointer (nth 1 cur) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
911 :reference (semantic-tag-get-attribute tag :reference) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
912 :documentation (semantic-tag-docstring tag) ;doc |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
913 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
914 vl)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
915 (semantic--tag-copy-properties tag (car vl)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
916 (semantic--tag-set-overlay (car vl) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
917 (semantic-tag-overlay tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
918 (setq lst (cdr lst))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
919 ;; Return the list |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
920 (nreverse vl))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
921 ((semantic-tag-of-class-p tag 'type) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
922 ;; We may someday want to add an extra check for a type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
923 ;; of type "typedef". |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
924 ;; Each elt of NAME is ( STARS NAME ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
925 (let ((vl nil) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
926 (names (semantic-tag-name tag)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
927 (super (semantic-tag-get-attribute tag :superclasses)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
928 (addlast nil)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
929 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
930 (when (and (semantic-tag-of-type-p tag "typedef") |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
931 (semantic-tag-of-class-p super 'type) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
932 (semantic-tag-type-members super)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
933 ;; This is a typedef of a real type. Extract |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
934 ;; the super class, and stick it into the tags list. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
935 (setq addlast super) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
936 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
937 ;; Clone super and remove the members IFF super has a name. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
938 ;; Note: anonymous struct/enums that are typedef'd shouldn't |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
939 ;; exist in the top level type list, so they will appear only |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
940 ;; in the :typedef slot of the typedef. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
941 (setq super (semantic-tag-clone super)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
942 (if (not (string= (semantic-tag-name super) "")) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
943 (semantic-tag-put-attribute super :members nil) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
944 (setq addlast nil)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
945 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
946 ;; Add in props to the full superclass. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
947 (when addlast |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
948 (semantic--tag-copy-properties tag addlast) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
949 (semantic--tag-set-overlay addlast (semantic-tag-overlay tag))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
950 ) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
951 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
952 (while names |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
953 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
954 (setq vl (cons (semantic-tag-new-type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
955 (nth 1 (car names)) ; name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
956 "typedef" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
957 (semantic-tag-type-members tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
958 ;; parent is just tbe name of what |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
959 ;; is passed down as a tag. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
960 (list |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
961 (semantic-tag-name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
962 (semantic-tag-type-superclasses tag))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
963 :pointer |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
964 (let ((stars (car (car (car names))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
965 (if (= stars 0) nil stars)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
966 ;; This specifies what the typedef |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
967 ;; is expanded out as. Just the |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
968 ;; name shows up as a parent of this |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
969 ;; typedef. |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
970 :typedef super |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
971 ;;(semantic-tag-type-superclasses tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
972 :documentation |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
973 (semantic-tag-docstring tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
974 vl)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
975 (semantic--tag-copy-properties tag (car vl)) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
976 (semantic--tag-set-overlay (car vl) (semantic-tag-overlay tag)) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
977 (setq names (cdr names))) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
978 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
979 ;; Add typedef superclass last. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
980 (when addlast (setq vl (cons addlast vl))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
981 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
982 vl)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
983 ((and (listp (car tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
984 (semantic-tag-of-class-p (car tag) 'variable)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
985 ;; Argument lists come in this way. Append all the expansions! |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
986 (let ((vl nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
987 (while tag |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
988 (setq vl (append (semantic-tag-components (car vl)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
989 vl) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
990 tag (cdr tag))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
991 vl)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
992 (t nil))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
993 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
994 (defvar-mode-local c-mode semantic-tag-expand-function 'semantic-expand-c-tag |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
995 "Function used to expand tags generated in the C bovine parser.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
996 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
997 (defvar semantic-c-classname nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
998 "At parse time, assign a class or struct name text here. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
999 It is picked up by `semantic-c-reconstitute-token' to determine |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1000 if something is a constructor. Value should be: |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
1001 (TYPENAME . TYPEOFTYPE) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1002 where typename is the name of the type, and typeoftype is \"class\" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1003 or \"struct\".") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1004 |
111305
eebc5a3ff54b
* cedet/semantic/bovine/c.el (semantic-analyze-split-name): Move before use.
Glenn Morris <rgm@gnu.org>
parents:
110533
diff
changeset
|
1005 (define-mode-local-override semantic-analyze-split-name c-mode (name) |
eebc5a3ff54b
* cedet/semantic/bovine/c.el (semantic-analyze-split-name): Move before use.
Glenn Morris <rgm@gnu.org>
parents:
110533
diff
changeset
|
1006 "Split up tag names on colon (:) boundaries." |
eebc5a3ff54b
* cedet/semantic/bovine/c.el (semantic-analyze-split-name): Move before use.
Glenn Morris <rgm@gnu.org>
parents:
110533
diff
changeset
|
1007 (let ((ans (split-string name ":"))) |
eebc5a3ff54b
* cedet/semantic/bovine/c.el (semantic-analyze-split-name): Move before use.
Glenn Morris <rgm@gnu.org>
parents:
110533
diff
changeset
|
1008 (if (= (length ans) 1) |
eebc5a3ff54b
* cedet/semantic/bovine/c.el (semantic-analyze-split-name): Move before use.
Glenn Morris <rgm@gnu.org>
parents:
110533
diff
changeset
|
1009 name |
eebc5a3ff54b
* cedet/semantic/bovine/c.el (semantic-analyze-split-name): Move before use.
Glenn Morris <rgm@gnu.org>
parents:
110533
diff
changeset
|
1010 (delete "" ans)))) |
eebc5a3ff54b
* cedet/semantic/bovine/c.el (semantic-analyze-split-name): Move before use.
Glenn Morris <rgm@gnu.org>
parents:
110533
diff
changeset
|
1011 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1012 (defun semantic-c-reconstitute-token (tokenpart declmods typedecl) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1013 "Reconstitute a token TOKENPART with DECLMODS and TYPEDECL. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1014 This is so we don't have to match the same starting text several times. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1015 Optional argument STAR and REF indicate the number of * and & in the typedef." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1016 (when (and (listp typedecl) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1017 (= 1 (length typedecl)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1018 (stringp (car typedecl))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1019 (setq typedecl (car typedecl))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1020 (cond ((eq (nth 1 tokenpart) 'variable) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1021 (semantic-tag-new-variable |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1022 (car tokenpart) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1023 (or typedecl "int") ;type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1024 nil ;default value (filled with expand) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1025 :constant-flag (if (member "const" declmods) t nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1026 :typemodifiers (delete "const" declmods) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1027 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1028 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1029 ((eq (nth 1 tokenpart) 'function) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1030 ;; We should look at part 4 (the arglist) here, and throw an |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1031 ;; error of some sort if it contains parser errors so that we |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1032 ;; don't parser function calls, but that is a little beyond what |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1033 ;; is available for data here. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1034 (let* ((constructor |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1035 (and (or (and semantic-c-classname |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1036 (string= (car semantic-c-classname) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1037 (car tokenpart))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1038 (and (stringp (car (nth 2 tokenpart))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1039 (string= (car (nth 2 tokenpart)) (car tokenpart))) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1040 (nth 10 tokenpart) ; initializers |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1041 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1042 (not (car (nth 3 tokenpart))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1043 (fcnpointer (string-match "^\\*" (car tokenpart))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1044 (fnname (if fcnpointer |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1045 (substring (car tokenpart) 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1046 (car tokenpart))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1047 (operator (if (string-match "[a-zA-Z]" fnname) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1048 nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1049 t)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1050 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1051 (if fcnpointer |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1052 ;; Function pointers are really variables. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1053 (semantic-tag-new-variable |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1054 fnname |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1055 typedecl |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1056 nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1057 ;; It is a function pointer |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1058 :functionpointer-flag t |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1059 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1060 ;; The function |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1061 (semantic-tag-new-function |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1062 fnname |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1063 (or typedecl ;type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1064 (cond ((car (nth 3 tokenpart) ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1065 "void") ; Destructors have no return? |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1066 (constructor |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1067 ;; Constructors return an object. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1068 (semantic-tag-new-type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1069 ;; name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1070 (or (car semantic-c-classname) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1071 (let ((split (semantic-analyze-split-name-c-mode |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1072 (car (nth 2 tokenpart))))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1073 (if (stringp split) split |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1074 (car (last split))))) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1075 ;; type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1076 (or (cdr semantic-c-classname) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1077 "class") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1078 ;; members |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1079 nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1080 ;; parents |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1081 nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1082 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1083 (t "int"))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1084 (nth 4 tokenpart) ;arglist |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1085 :constant-flag (if (member "const" declmods) t nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1086 :typemodifiers (delete "const" declmods) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1087 :parent (car (nth 2 tokenpart)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1088 :destructor-flag (if (car (nth 3 tokenpart) ) t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1089 :constructor-flag (if constructor t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1090 :pointer (nth 7 tokenpart) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1091 :operator-flag operator |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1092 ;; Even though it is "throw" in C++, we use |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1093 ;; `throws' as a common name for things that toss |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1094 ;; exceptions about. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1095 :throws (nth 5 tokenpart) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1096 ;; Reemtrant is a C++ thingy. Add it here |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1097 :reentrant-flag (if (member "reentrant" (nth 6 tokenpart)) t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1098 ;; A function post-const is funky. Try stuff |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1099 :methodconst-flag (if (member "const" (nth 6 tokenpart)) t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1100 ;; prototypes are functions w/ no body |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1101 :prototype-flag (if (nth 8 tokenpart) t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1102 ;; Pure virtual |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1103 :pure-virtual-flag (if (eq (nth 8 tokenpart) :pure-virtual-flag) t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1104 ;; Template specifier. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1105 :template-specifier (nth 9 tokenpart) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1106 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1107 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1108 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1109 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1110 (defun semantic-c-reconstitute-template (tag specifier) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1111 "Reconstitute the token TAG with the template SPECIFIER." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1112 (semantic-tag-put-attribute tag :template (or specifier "")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1113 tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1114 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1115 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1116 ;;; Override methods & Variables |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1117 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1118 (define-mode-local-override semantic-format-tag-name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1119 c-mode (tag &optional parent color) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1120 "Convert TAG to a string that is the print name for TAG. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1121 Optional PARENT and COLOR are ignored." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1122 (let ((name (semantic-format-tag-name-default tag parent color)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1123 (fnptr (semantic-tag-get-attribute tag :functionpointer-flag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1124 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1125 (if (not fnptr) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1126 name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1127 (concat "(*" name ")")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1128 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1129 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1130 (define-mode-local-override semantic-format-tag-canonical-name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1131 c-mode (tag &optional parent color) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1132 "Create a cannonical name for TAG. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1133 PARENT specifies a parent class. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1134 COLOR indicates that the text should be type colorized. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1135 Enhances the base class to search for the entire parent |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1136 tree to make the name accurate." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1137 (semantic-format-tag-canonical-name-default tag parent color) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1138 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1139 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1140 (define-mode-local-override semantic-format-tag-type c-mode (tag color) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1141 "Convert the data type of TAG to a string usable in tag formatting. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1142 Adds pointer and reference symbols to the default. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1143 Argument COLOR adds color to the text." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1144 (let* ((type (semantic-tag-type tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1145 (defaulttype nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1146 (point (semantic-tag-get-attribute tag :pointer)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1147 (ref (semantic-tag-get-attribute tag :reference)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1148 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1149 (if (semantic-tag-p type) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1150 (let ((typetype (semantic-tag-type type)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1151 (typename (semantic-tag-name type))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1152 ;; Create the string that expresses the type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1153 (if (string= typetype "class") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1154 (setq defaulttype typename) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1155 (setq defaulttype (concat typetype " " typename)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1156 (setq defaulttype (semantic-format-tag-type-default tag color))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1157 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1158 ;; Colorize |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1159 (when color |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1160 (setq defaulttype (semantic--format-colorize-text defaulttype 'type))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1161 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1162 ;; Add refs, ptrs, etc |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1163 (if ref (setq ref "&")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1164 (if point (setq point (make-string point ?*)) "") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1165 (when type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1166 (concat defaulttype ref point)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1167 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1168 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1169 (define-mode-local-override semantic-find-tags-by-scope-protection |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1170 c-mode (scopeprotection parent &optional table) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1171 "Override the usual search for protection. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1172 We can be more effective than the default by scanning through once, |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1173 and collecting tags based on the labels we see along the way." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1174 (if (not table) (setq table (semantic-tag-type-members parent))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1175 (if (null scopeprotection) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1176 table |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1177 (let ((ans nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1178 (curprot 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1179 (targetprot (cond ((eq scopeprotection 'public) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1180 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1181 ((eq scopeprotection 'protected) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1182 2) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1183 (t 3) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1184 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1185 (alist '(("public" . 1) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1186 ("protected" . 2) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1187 ("private" . 3))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1188 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1189 (dolist (tag table) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1190 (cond |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1191 ((semantic-tag-of-class-p tag 'label) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1192 (setq curprot (cdr (assoc (semantic-tag-name tag) alist))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1193 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1194 ((>= targetprot curprot) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1195 (setq ans (cons tag ans))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1196 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1197 ans))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1198 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1199 (define-mode-local-override semantic-tag-protection |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1200 c-mode (tag &optional parent) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1201 "Return the protection of TAG in PARENT. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1202 Override function for `semantic-tag-protection'." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1203 (let ((mods (semantic-tag-modifiers tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1204 (prot nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1205 ;; Check the modifiers for protection if we are not a child |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1206 ;; of some class type. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1207 (when (or (not parent) (not (eq (semantic-tag-class parent) 'type))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1208 (while (and (not prot) mods) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1209 (if (stringp (car mods)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1210 (let ((s (car mods))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1211 ;; A few silly defaults to get things started. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1212 (cond ((or (string= s "extern") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1213 (string= s "export")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1214 'public) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1215 ((string= s "static") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1216 'private)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1217 (setq mods (cdr mods)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1218 ;; If we have a typed parent, look for :public style labels. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1219 (when (and parent (eq (semantic-tag-class parent) 'type)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1220 (let ((pp (semantic-tag-type-members parent))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1221 (while (and pp (not (semantic-equivalent-tag-p (car pp) tag))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1222 (when (eq (semantic-tag-class (car pp)) 'label) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1223 (setq prot |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1224 (cond ((string= (semantic-tag-name (car pp)) "public") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1225 'public) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1226 ((string= (semantic-tag-name (car pp)) "private") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1227 'private) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1228 ((string= (semantic-tag-name (car pp)) "protected") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1229 'protected))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1230 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1231 (setq pp (cdr pp))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1232 (when (and (not prot) (eq (semantic-tag-class parent) 'type)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1233 (setq prot |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1234 (cond ((string= (semantic-tag-type parent) "class") 'private) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1235 ((string= (semantic-tag-type parent) "struct") 'public) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1236 (t 'unknown)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1237 (or prot |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1238 (if (and parent (semantic-tag-of-class-p parent 'type)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1239 'public |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1240 nil)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1241 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1242 (define-mode-local-override semantic-tag-components c-mode (tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1243 "Return components for TAG." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1244 (if (and (eq (semantic-tag-class tag) 'type) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1245 (string= (semantic-tag-type tag) "typedef")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1246 ;; A typedef can contain a parent who has positional children, |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1247 ;; but that parent will not have a position. Do this funny hack |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1248 ;; to make sure we can apply overlays properly. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1249 (let ((sc (semantic-tag-get-attribute tag :typedef))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1250 (when (semantic-tag-p sc) (semantic-tag-components sc))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1251 (semantic-tag-components-default tag))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1252 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1253 (defun semantic-c-tag-template (tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1254 "Return the template specification for TAG, or nil." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1255 (semantic-tag-get-attribute tag :template)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1256 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1257 (defun semantic-c-tag-template-specifier (tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1258 "Return the template specifier specification for TAG, or nil." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1259 (semantic-tag-get-attribute tag :template-specifier)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1260 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1261 (defun semantic-c-template-string-body (templatespec) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1262 "Convert TEMPLATESPEC into a string. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1263 This might be a string, or a list of tokens." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1264 (cond ((stringp templatespec) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1265 templatespec) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1266 ((semantic-tag-p templatespec) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1267 (semantic-format-tag-abbreviate templatespec)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1268 ((listp templatespec) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1269 (mapconcat 'semantic-format-tag-abbreviate templatespec ", ")))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1270 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1271 (defun semantic-c-template-string (token &optional parent color) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1272 "Return a string representing the TEMPLATE attribute of TOKEN. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1273 This string is prefixed with a space, or is the empty string. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1274 Argument PARENT specifies a parent type. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1275 Argument COLOR specifies that the string should be colorized." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1276 (let ((t2 (semantic-c-tag-template-specifier token)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1277 (t1 (semantic-c-tag-template token)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1278 ;; @todo - Need to account for a parent that is a template |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1279 (pt1 (if parent (semantic-c-tag-template parent))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1280 (pt2 (if parent (semantic-c-tag-template-specifier parent))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1281 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1282 (cond (t2 ;; we have a template with specifier |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1283 (concat " <" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1284 ;; Fill in the parts here |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1285 (semantic-c-template-string-body t2) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1286 ">")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1287 (t1 ;; we have a template without specifier |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1288 " <>") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1289 (t |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1290 "")))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1291 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1292 (define-mode-local-override semantic-format-tag-concise-prototype |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1293 c-mode (token &optional parent color) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1294 "Return an abbreviated string describing TOKEN for C and C++. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1295 Optional PARENT and COLOR as specified with |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1296 `semantic-format-tag-abbreviate-default'." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1297 ;; If we have special template things, append. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1298 (concat (semantic-format-tag-concise-prototype-default token parent color) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1299 (semantic-c-template-string token parent color))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1300 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1301 (define-mode-local-override semantic-format-tag-uml-prototype |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1302 c-mode (token &optional parent color) |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
1303 "Return an UML string describing TOKEN for C and C++. |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1304 Optional PARENT and COLOR as specified with |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1305 `semantic-abbreviate-tag-default'." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1306 ;; If we have special template things, append. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1307 (concat (semantic-format-tag-uml-prototype-default token parent color) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1308 (semantic-c-template-string token parent color))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1309 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1310 (define-mode-local-override semantic-tag-abstract-p |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1311 c-mode (tag &optional parent) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1312 "Return non-nil if TAG is considered abstract. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1313 PARENT is tag's parent. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1314 In C, a method is abstract if it is `virtual', which is already |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1315 handled. A class is abstract iff it's destructor is virtual." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1316 (cond |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1317 ((eq (semantic-tag-class tag) 'type) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1318 (require 'semantic/find) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1319 (or (semantic-brute-find-tag-by-attribute :pure-virtual-flag |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1320 (semantic-tag-components tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1321 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1322 (let* ((ds (semantic-brute-find-tag-by-attribute |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1323 :destructor-flag |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1324 (semantic-tag-components tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1325 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1326 (cs (semantic-brute-find-tag-by-attribute |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1327 :constructor-flag |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1328 (semantic-tag-components tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1329 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1330 (and ds (member "virtual" (semantic-tag-modifiers (car ds))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1331 cs (eq 'protected (semantic-tag-protection (car cs) tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1332 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1333 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1334 ((eq (semantic-tag-class tag) 'function) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1335 (or (semantic-tag-get-attribute tag :pure-virtual-flag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1336 (member "virtual" (semantic-tag-modifiers tag)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1337 (t (semantic-tag-abstract-p-default tag parent)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1338 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1339 (defun semantic-c-dereference-typedef (type scope &optional type-declaration) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1340 "If TYPE is a typedef, get TYPE's type by name or tag, and return. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1341 SCOPE is not used, and TYPE-DECLARATION is used only if TYPE is not a typedef." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1342 (if (and (eq (semantic-tag-class type) 'type) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1343 (string= (semantic-tag-type type) "typedef")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1344 (let ((dt (semantic-tag-get-attribute type :typedef))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1345 (cond ((and (semantic-tag-p dt) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1346 (not (semantic-analyze-tag-prototype-p dt))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1347 ;; In this case, DT was declared directly. We need |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1348 ;; to clone DT and apply a filename to it. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1349 (let* ((fname (semantic-tag-file-name type)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1350 (def (semantic-tag-copy dt nil fname))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1351 (list def def))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1352 ((stringp dt) (list dt (semantic-tag dt 'type))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1353 ((consp dt) (list (car dt) dt)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1354 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1355 (list type type-declaration))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1356 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1357 (defun semantic-c--instantiate-template (tag def-list spec-list) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1358 "Replace TAG name according to template specification. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1359 DEF-LIST is the template information. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1360 SPEC-LIST is the template specifier of the datatype instantiated." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1361 (when (and (car def-list) (car spec-list)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1362 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1363 (when (and (string= (semantic-tag-type (car def-list)) "class") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1364 (string= (semantic-tag-name tag) (semantic-tag-name (car def-list)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1365 (semantic-tag-set-name tag (semantic-tag-name (car spec-list)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1366 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1367 (semantic-c--instantiate-template tag (cdr def-list) (cdr spec-list)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1368 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1369 (defun semantic-c--template-name-1 (spec-list) |
105340 | 1370 "Return a string used to compute template class name. |
1371 Based on SPEC-LIST, for ref<Foo,Bar> it will return 'Foo,Bar'." | |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1372 (when (car spec-list) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1373 (let* ((endpart (semantic-c--template-name-1 (cdr spec-list))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1374 (separator (and endpart ","))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1375 (concat (semantic-tag-name (car spec-list)) separator endpart)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1376 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1377 (defun semantic-c--template-name (type spec-list) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1378 "Return a template class name for TYPE based on SPEC-LIST. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1379 For a type `ref' with a template specifier of (Foo Bar) it will |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1380 return 'ref<Foo,Bar>'." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1381 (concat (semantic-tag-name type) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1382 "<" (semantic-c--template-name-1 (cdr spec-list)) ">")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1383 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1384 (defun semantic-c-dereference-template (type scope &optional type-declaration) |
105340 | 1385 "Dereference any template specifiers in TYPE within SCOPE. |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1386 If TYPE is a template, return a TYPE copy with the templates types |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1387 instantiated as specified in TYPE-DECLARATION." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1388 (when (semantic-tag-p type-declaration) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1389 (let ((def-list (semantic-tag-get-attribute type :template)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1390 (spec-list (semantic-tag-get-attribute type-declaration :template-specifier))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1391 (when (and def-list spec-list) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1392 (setq type (semantic-tag-deep-copy-one-tag |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1393 type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1394 (lambda (tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1395 (when (semantic-tag-of-class-p tag 'type) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1396 (semantic-c--instantiate-template |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1397 tag def-list spec-list)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1398 tag) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1399 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1400 (semantic-tag-set-name type (semantic-c--template-name type spec-list)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1401 (semantic-tag-put-attribute type :template nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1402 (semantic-tag-set-faux type)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1403 (list type type-declaration)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1404 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1405 ;;; Patch here by "Raf" for instantiating templates. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1406 (defun semantic-c-dereference-member-of (type scope &optional type-declaration) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1407 "Dereference through the `->' operator of TYPE. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1408 Uses the return type of the '->' operator if it is contained in TYPE. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1409 SCOPE is the current local scope to perform searches in. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1410 TYPE-DECLARATION is passed through." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1411 (if semantic-c-member-of-autocast |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1412 (let ((operator (car (semantic-find-tags-by-name "->" (semantic-analyze-scoped-type-parts type))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1413 (if operator |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1414 (list (semantic-tag-get-attribute operator :type) (semantic-tag-get-attribute operator :type)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1415 (list type type-declaration))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1416 (list type type-declaration))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1417 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1418 ;; David Engster: The following three functions deal with namespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1419 ;; aliases and types which are member of a namespace through a using |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1420 ;; statement. For examples, see the file semantic/tests/testusing.cpp, |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1421 ;; tests 5 and following. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1422 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1423 (defun semantic-c-dereference-namespace (type scope &optional type-declaration) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1424 "Dereference namespace which might hold an 'alias' for TYPE. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1425 Such an alias can be created through 'using' statements in a |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
1426 namespace declaration. This function checks the namespaces in |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1427 SCOPE for such statements." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1428 (let ((scopetypes (oref scope scopetypes)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1429 typename currentns tmp usingname result namespaces) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1430 (when (and (semantic-tag-p type-declaration) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1431 (or (null type) (semantic-tag-prototype-p type))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1432 (setq typename (semantic-analyze-split-name (semantic-tag-name type-declaration))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1433 ;; If we already have that TYPE in SCOPE, we do nothing |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1434 (unless (semantic-deep-find-tags-by-name (or (car-safe typename) typename) scopetypes) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1435 (if (stringp typename) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1436 ;; The type isn't fully qualified, so we have to search in all namespaces in SCOPE. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1437 (setq namespaces (semantic-find-tags-by-type "namespace" scopetypes)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1438 ;; This is a fully qualified name, so we only have to search one namespace. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1439 (setq namespaces (semanticdb-typecache-find (car typename))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1440 ;; Make sure it's really a namespace. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1441 (if (string= (semantic-tag-type namespaces) "namespace") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1442 (setq namespaces (list namespaces)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1443 (setq namespaces nil))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1444 (setq result nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1445 ;; Iterate over all the namespaces we have to check. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1446 (while (and namespaces |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1447 (null result)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1448 (setq currentns (car namespaces)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1449 ;; Check if this is namespace is an alias and dereference it if necessary. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1450 (setq result (semantic-c-dereference-namespace-alias type-declaration currentns)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1451 (unless result |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1452 ;; Otherwise, check if we can reach the type through 'using' statements. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1453 (setq result |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1454 (semantic-c-check-type-namespace-using type-declaration currentns))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1455 (setq namespaces (cdr namespaces))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1456 (if result |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1457 ;; we have found the original type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1458 (list result result) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1459 (list type type-declaration)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1460 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1461 (defun semantic-c-dereference-namespace-alias (type namespace) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1462 "Dereference TYPE in NAMESPACE, given that NAMESPACE is an alias. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1463 Checks if NAMESPACE is an alias and if so, returns a new type |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1464 with a fully qualified name in the original namespace. Returns |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1465 nil if NAMESPACE is not an alias." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1466 (when (eq (semantic-tag-get-attribute namespace :kind) 'alias) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1467 (let ((typename (semantic-analyze-split-name (semantic-tag-name type))) |
104489
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1468 ns nstype originaltype newtype) |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1469 ;; Make typename unqualified |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1470 (if (listp typename) |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1471 (setq typename (last typename)) |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1472 (setq typename (list typename))) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1473 (when |
104489
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1474 (and |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1475 ;; Get original namespace and make sure TYPE exists there. |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1476 (setq ns (semantic-tag-name |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1477 (car (semantic-tag-get-attribute namespace :members)))) |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1478 (setq nstype (semanticdb-typecache-find ns)) |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1479 (setq originaltype (semantic-find-tags-by-name |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1480 (car typename) |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1481 (semantic-tag-get-attribute nstype :members)))) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1482 ;; Construct new type with name in original namespace. |
104489
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1483 (setq ns (semantic-analyze-split-name ns)) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1484 (setq newtype |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1485 (semantic-tag-clone |
104489
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1486 (car originaltype) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1487 (semantic-analyze-unsplit-name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1488 (if (listp ns) |
104489
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1489 (append ns typename) |
25e047f7f6a2
Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents:
104473
diff
changeset
|
1490 (append (list ns) typename))))))))) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1491 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1492 ;; This searches a type in a namespace, following through all using |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1493 ;; statements. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1494 (defun semantic-c-check-type-namespace-using (type namespace) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1495 "Check if TYPE is accessible in NAMESPACE through a using statement. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1496 Returns the original type from the namespace where it is defined, |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1497 or nil if it cannot be found." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1498 (let (usings result usingname usingtype unqualifiedname members shortname tmp) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1499 ;; Get all using statements from NAMESPACE. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1500 (when (and (setq usings (semantic-tag-get-attribute namespace :members)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1501 (setq usings (semantic-find-tags-by-class 'using usings))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1502 ;; Get unqualified typename. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1503 (when (listp (setq unqualifiedname (semantic-analyze-split-name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1504 (semantic-tag-name type)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1505 (setq unqualifiedname (car (last unqualifiedname)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1506 ;; Iterate over all using statements in NAMESPACE. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1507 (while (and usings |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1508 (null result)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1509 (setq usingname (semantic-analyze-split-name |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1510 (semantic-tag-name (car usings))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1511 usingtype (semantic-tag-type (semantic-tag-type (car usings)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1512 (cond |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1513 ((or (string= usingtype "namespace") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1514 (stringp usingname)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1515 ;; We are dealing with a 'using [namespace] NAMESPACE;' |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1516 ;; Search for TYPE in that namespace |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1517 (setq result |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1518 (semanticdb-typecache-find usingname)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1519 (if (and result |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1520 (setq members (semantic-tag-get-attribute result :members)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1521 (setq members (semantic-find-tags-by-name unqualifiedname members))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1522 ;; TYPE is member of that namespace, so we are finished |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1523 (setq result (car members)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1524 ;; otherwise recursively search in that namespace for an alias |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1525 (setq result (semantic-c-check-type-namespace-using type result)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1526 (when result |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1527 (setq result (semantic-tag-type result))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1528 ((and (string= usingtype "class") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1529 (listp usingname)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1530 ;; We are dealing with a 'using TYPE;' |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1531 (when (string= unqualifiedname (car (last usingname))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1532 ;; We have found the correct tag. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1533 (setq result (semantic-tag-type (car usings)))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1534 (setq usings (cdr usings)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1535 result)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1536 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1537 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1538 (define-mode-local-override semantic-analyze-dereference-metatype |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1539 c-mode (type scope &optional type-declaration) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1540 "Dereference TYPE as described in `semantic-analyze-dereference-metatype'. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1541 Handle typedef, template instantiation, and '->' operator." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1542 (let* ((dereferencer-list '(semantic-c-dereference-typedef |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1543 semantic-c-dereference-template |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1544 semantic-c-dereference-member-of |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1545 semantic-c-dereference-namespace)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1546 (dereferencer (pop dereferencer-list)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1547 (type-tuple) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1548 (original-type type)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1549 (while dereferencer |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1550 (setq type-tuple (funcall dereferencer type scope type-declaration) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1551 type (car type-tuple) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1552 type-declaration (cadr type-tuple)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1553 (if (not (eq type original-type)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1554 ;; we found a new type so break the dereferencer loop now ! |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1555 ;; (we will be recalled with the new type expanded by |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1556 ;; semantic-analyze-dereference-metatype-stack). |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1557 (setq dereferencer nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1558 ;; no new type found try the next dereferencer : |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1559 (setq dereferencer (pop dereferencer-list))))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1560 (list type type-declaration)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1561 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1562 (define-mode-local-override semantic-analyze-type-constants c-mode (type) |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
1563 "When TYPE is a tag for an enum, return its parts. |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1564 These are constants which are of type TYPE." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1565 (if (and (eq (semantic-tag-class type) 'type) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1566 (string= (semantic-tag-type type) "enum")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1567 (semantic-tag-type-members type))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1568 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1569 (define-mode-local-override semantic-analyze-unsplit-name c-mode (namelist) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1570 "Assemble the list of names NAMELIST into a namespace name." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1571 (mapconcat 'identity namelist "::")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1572 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1573 (define-mode-local-override semantic-ctxt-scoped-types c++-mode (&optional point) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1574 "Return a list of tags of CLASS type based on POINT. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1575 DO NOT return the list of tags encompassing point." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1576 (when point (goto-char (point))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1577 (let ((tagsaroundpoint (semantic-find-tag-by-overlay)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1578 (tagreturn nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1579 (tmp nil)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1580 ;; In C++, we want to find all the namespaces declared |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1581 ;; locally and add them to the list. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1582 (setq tmp (semantic-find-tags-by-class 'type (current-buffer))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1583 (setq tmp (semantic-find-tags-by-type "namespace" tmp)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1584 (setq tmp (semantic-find-tags-by-name "unnamed" tmp)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1585 (setq tagreturn tmp) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1586 ;; We should also find all "using" type statements and |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1587 ;; accept those entities in as well. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1588 (setq tmp (semanticdb-find-tags-by-class 'using)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1589 (let ((idx 0) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1590 (len (semanticdb-find-result-length tmp))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1591 (while (< idx len) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1592 (setq tagreturn (cons (semantic-tag-type (car (semanticdb-find-result-nth tmp idx))) tagreturn)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1593 (setq idx (1+ idx))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1594 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1595 ;; Use the encompased types around point to also look for using statements. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1596 ;;(setq tagreturn (cons "bread_name" tagreturn)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1597 (while (cdr tagsaroundpoint) ; don't search the last one |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1598 (setq tmp (semantic-find-tags-by-class 'using (semantic-tag-components (car tagsaroundpoint)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1599 (dolist (T tmp) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1600 (setq tagreturn (cons (semantic-tag-type T) tagreturn)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1601 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1602 (setq tagsaroundpoint (cdr tagsaroundpoint)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1603 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1604 ;; If in a function... |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1605 (when (and (semantic-tag-of-class-p (car tagsaroundpoint) 'function) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1606 ;; ...search for using statements in the local scope... |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1607 (setq tmp (semantic-find-tags-by-class |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1608 'using |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1609 (semantic-get-local-variables)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1610 ;; ... and add them. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1611 (setq tagreturn |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1612 (append tagreturn |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1613 (mapcar 'semantic-tag-type tmp)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1614 ;; Return the stuff |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1615 tagreturn |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1616 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1617 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1618 (define-mode-local-override semantic-ctxt-imported-packages c++-mode (&optional point) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1619 "Return the list of using tag types in scope of POINT." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1620 (when point (goto-char (point))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1621 (let ((tagsaroundpoint (semantic-find-tag-by-overlay)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1622 (namereturn nil) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1623 (tmp nil) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1624 ) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1625 ;; Collect using statements from the top level. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1626 (setq tmp (semantic-find-tags-by-class 'using (current-buffer))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1627 (dolist (T tmp) (setq namereturn (cons (semantic-tag-type T) namereturn))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1628 ;; Move through the tags around point looking for more using statements |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1629 (while (cdr tagsaroundpoint) ; don't search the last one |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1630 (setq tmp (semantic-find-tags-by-class 'using (semantic-tag-components (car tagsaroundpoint)))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1631 (dolist (T tmp) (setq namereturn (cons (semantic-tag-type T) namereturn))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1632 (setq tagsaroundpoint (cdr tagsaroundpoint)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1633 ) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1634 namereturn)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1635 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1636 (define-mode-local-override semanticdb-expand-nested-tag c++-mode (tag) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1637 "Expand TAG if it has a fully qualified name. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1638 For types with a :parent, create faux namespaces to put TAG into." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1639 (let ((p (semantic-tag-get-attribute tag :parent))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1640 (if (and p (semantic-tag-of-class-p tag 'type)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1641 ;; Expand the tag |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1642 (let ((s (semantic-analyze-split-name p)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1643 (newtag (semantic-tag-copy tag nil t))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1644 ;; Erase the qualified name. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1645 (semantic-tag-put-attribute newtag :parent nil) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1646 ;; Fixup the namespace name |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1647 (setq s (if (stringp s) (list s) (nreverse s))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1648 ;; Loop over all the parents, creating the nested |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1649 ;; namespace. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1650 (require 'semantic/db-typecache) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1651 (dolist (namespace s) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1652 (setq newtag (semanticdb-typecache-faux-namespace |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1653 namespace (list newtag))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1654 ) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1655 ;; Return the last created namespace. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1656 newtag) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1657 ;; Else, return tag unmodified. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1658 tag))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1659 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1660 (define-mode-local-override semantic-get-local-variables c++-mode () |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1661 "Do what `semantic-get-local-variables' does, plus add `this' if needed." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1662 (let* ((origvar (semantic-get-local-variables-default)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1663 (ct (semantic-current-tag)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1664 (p (semantic-tag-function-parent ct))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1665 ;; If we have a function parent, then that implies we can |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1666 (if (and p (semantic-tag-of-class-p ct 'function)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1667 ;; Append a new tag THIS into our space. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1668 (cons (semantic-tag-new-variable "this" p nil) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1669 origvar) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1670 ;; No parent, just return the usual |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1671 origvar) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1672 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1673 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1674 (define-mode-local-override semantic-idle-summary-current-symbol-info |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1675 c-mode () |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1676 "Handle the SPP keywords, then use the default mechanism." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1677 (let* ((sym (car (semantic-ctxt-current-thing))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1678 (spp-sym (semantic-lex-spp-symbol sym))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1679 (if spp-sym |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1680 (let* ((txt (concat "Macro: " sym)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1681 (sv (symbol-value spp-sym)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1682 (arg (semantic-lex-spp-macro-with-args sv)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1683 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1684 (when arg |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1685 (setq txt (concat txt (format "%S" arg))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1686 (setq sv (cdr sv))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1687 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1688 ;; This is optional, and potentially fraught w/ errors. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1689 (condition-case nil |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1690 (dolist (lt sv) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1691 (setq txt (concat txt " " (semantic-lex-token-text lt)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1692 (error (setq txt (concat txt " #error in summary fcn")))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1693 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1694 txt) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1695 (semantic-idle-summary-current-symbol-info-default)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1696 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1697 (defvar-mode-local c-mode semantic-orphaned-member-metaparent-type "struct" |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
1698 "When lost members are found in the class hierarchy generator, use a struct.") |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1699 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1700 (defvar-mode-local c-mode semantic-symbol->name-assoc-list |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1701 '((type . "Types") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1702 (variable . "Variables") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1703 (function . "Functions") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1704 (include . "Includes") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1705 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1706 "List of tag classes, and strings to describe them.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1707 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1708 (defvar-mode-local c-mode semantic-symbol->name-assoc-list-for-type-parts |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1709 '((type . "Types") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1710 (variable . "Attributes") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1711 (function . "Methods") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1712 (label . "Labels") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1713 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1714 "List of tag classes in a datatype decl, and strings to describe them.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1715 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1716 (defvar-mode-local c-mode imenu-create-index-function 'semantic-create-imenu-index |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1717 "Imenu index function for C.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1718 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1719 (defvar-mode-local c-mode semantic-type-relation-separator-character |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1720 '("." "->" "::") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1721 "Separator characters between something of a given type, and a field.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1722 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1723 (defvar-mode-local c-mode semantic-command-separation-character ";" |
106800
58365d44aeda
Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106431
diff
changeset
|
1724 "Command separation character for C.") |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1725 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1726 (defvar-mode-local c-mode senator-step-at-tag-classes '(function variable) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1727 "Tag classes where senator will stop at the end.") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1728 |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
1729 ;;;###autoload |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1730 (defun semantic-default-c-setup () |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1731 "Set up a buffer for semantic parsing of the C language." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1732 (semantic-c-by--install-parser) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1733 (setq semantic-lex-syntax-modifications '((?> ".") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1734 (?< ".") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1735 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1736 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1737 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1738 (setq semantic-lex-analyzer #'semantic-c-lexer) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1739 (add-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook nil t) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1740 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1741 |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
1742 ;;;###autoload |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1743 (defun semantic-c-add-preprocessor-symbol (sym replacement) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1744 "Add a preprocessor symbol SYM with a REPLACEMENT value." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1745 (interactive "sSymbol: \nsReplacement: ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1746 (let ((SA (assoc sym semantic-lex-c-preprocessor-symbol-map))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1747 (if SA |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1748 ;; Replace if there is one. |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1749 (setcdr SA replacement) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1750 ;; Otherwise, append |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1751 (setq semantic-lex-c-preprocessor-symbol-map |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1752 (cons (cons sym replacement) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1753 semantic-lex-c-preprocessor-symbol-map)))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1754 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1755 (semantic-c-reset-preprocessor-symbol-map) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1756 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1757 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1758 ;;; SETUP QUERY |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1759 ;; |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1760 (defun semantic-c-describe-environment () |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1761 "Describe the Semantic features of the current C environment." |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1762 (interactive) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1763 (if (not (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1764 (error "Not useful to query C mode in %s mode" major-mode)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1765 (let ((gcc (when (boundp 'semantic-gcc-setup-data) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1766 semantic-gcc-setup-data)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1767 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1768 (semantic-fetch-tags) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1769 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1770 (with-output-to-temp-buffer "*Semantic C Environment*" |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1771 (when gcc |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1772 (princ "Calculated GCC Parameters:") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1773 (dolist (P gcc) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1774 (princ "\n ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1775 (princ (car P)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1776 (princ " = ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1777 (princ (cdr P)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1778 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1779 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1780 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1781 (princ "\n\nInclude Path Summary:\n") |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104452
diff
changeset
|
1782 (when (and (boundp 'ede-object) ede-object) |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1783 (princ "\n This file's project include is handled by:\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1784 (princ " ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1785 (princ (object-print ede-object)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1786 (princ "\n with the system path:\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1787 (dolist (dir (ede-system-include-path ede-object)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1788 (princ " ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1789 (princ dir) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1790 (princ "\n")) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1791 ) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1792 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1793 (when semantic-dependency-include-path |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1794 (princ "\n This file's generic include path is:\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1795 (dolist (dir semantic-dependency-include-path) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1796 (princ " ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1797 (princ dir) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1798 (princ "\n"))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1799 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1800 (when semantic-dependency-system-include-path |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1801 (princ "\n This file's system include path is:\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1802 (dolist (dir semantic-dependency-system-include-path) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1803 (princ " ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1804 (princ dir) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1805 (princ "\n"))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1806 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1807 (princ "\n\nMacro Summary:\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1808 (when semantic-lex-c-preprocessor-symbol-file |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1809 (princ "\n Your CPP table is primed from these files:\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1810 (dolist (file semantic-lex-c-preprocessor-symbol-file) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1811 (princ " ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1812 (princ file) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1813 (princ "\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1814 (princ " in table: ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1815 (princ (object-print (semanticdb-file-table-object file))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1816 (princ "\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1817 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1818 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1819 (when semantic-lex-c-preprocessor-symbol-map-builtin |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1820 (princ "\n Built-in symbol map:\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1821 (dolist (S semantic-lex-c-preprocessor-symbol-map-builtin) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1822 (princ " ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1823 (princ (car S)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1824 (princ " = ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1825 (princ (cdr S)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1826 (princ "\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1827 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1828 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1829 (when semantic-lex-c-preprocessor-symbol-map |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1830 (princ "\n User symbol map:\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1831 (dolist (S semantic-lex-c-preprocessor-symbol-map) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1832 (princ " ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1833 (princ (car S)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1834 (princ " = ") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1835 (princ (cdr S)) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1836 (princ "\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1837 )) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1838 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1839 (when (and (boundp 'ede-object) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1840 ede-object |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1841 (arrayp semantic-lex-spp-project-macro-symbol-obarray)) |
106431
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1842 (princ "\n Project symbol map:\n") |
107480
2d31f33b972c
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1843 (when (and (boundp 'ede-object) ede-object) |
2d31f33b972c
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1844 (princ " Your project symbol map is derived from the EDE object:\n ") |
2d31f33b972c
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1845 (princ (object-print ede-object))) |
106431
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1846 (princ "\n\n") |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1847 (let ((macros nil)) |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1848 (mapatoms |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1849 #'(lambda (symbol) |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1850 (setq macros (cons symbol macros))) |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1851 semantic-lex-spp-project-macro-symbol-obarray) |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1852 (dolist (S macros) |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1853 (princ " ") |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1854 (princ (symbol-name S)) |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1855 (princ " = ") |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1856 (princ (symbol-value S)) |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1857 (princ "\n") |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1858 ))) |
4ffa662ec661
* cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents:
106197
diff
changeset
|
1859 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1860 (princ "\n\n Use: M-x semantic-lex-spp-describe RET\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1861 (princ "\n to see the complete macro table.\n") |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1862 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1863 ))) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1864 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1865 (provide 'semantic/bovine/c) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1866 |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1867 (semantic-c-reset-preprocessor-symbol-map) |
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1868 |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
1869 ;; Local variables: |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
1870 ;; generated-autoload-file: "../loaddefs.el" |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
1871 ;; generated-autoload-load-name: "semantic/bovine/c" |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
1872 ;; End: |
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
1873 |
104452
688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1874 ;;; semantic/bovine/c.el ends here |