diff options
| author | Chong Yidong | 2012-10-02 02:10:29 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-10-02 02:10:29 +0800 |
| commit | 62a81506f802e4824b718cc30321ee3a0057cdf7 (patch) | |
| tree | d681d7b767b1c3f7e4aee24ce39f6bef0d7f1f7e /lisp/cedet/srecode/cpp.el | |
| parent | b3317662acc0157406c20c8e14c43b7126eaa8a0 (diff) | |
| download | emacs-62a81506f802e4824b718cc30321ee3a0057cdf7.tar.gz emacs-62a81506f802e4824b718cc30321ee3a0057cdf7.zip | |
Update CEDET from upstream.
Diffstat (limited to 'lisp/cedet/srecode/cpp.el')
| -rw-r--r-- | lisp/cedet/srecode/cpp.el | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/lisp/cedet/srecode/cpp.el b/lisp/cedet/srecode/cpp.el index 12bfd3af903..d63e1a7a49f 100644 --- a/lisp/cedet/srecode/cpp.el +++ b/lisp/cedet/srecode/cpp.el | |||
| @@ -47,16 +47,16 @@ buffer contains a using NAMESPACE; statement " | |||
| 47 | :group 'srecode-cpp | 47 | :group 'srecode-cpp |
| 48 | :type '(repeat string)) | 48 | :type '(repeat string)) |
| 49 | 49 | ||
| 50 | ;;; :cpp ARGUMENT HANDLING | 50 | ;;; :c ARGUMENT HANDLING |
| 51 | ;; | 51 | ;; |
| 52 | ;; When a :cpp argument is required, fill the dictionary with | 52 | ;; When a :c argument is required, fill the dictionary with |
| 53 | ;; information about the current C++ file. | 53 | ;; information about the current C file. |
| 54 | ;; | 54 | ;; |
| 55 | ;; Error if not in a C++ mode. | 55 | ;; Error if not in a C mode. |
| 56 | 56 | ||
| 57 | ;;;###autoload | 57 | ;;;###autoload |
| 58 | (defun srecode-semantic-handle-:cpp (dict) | 58 | (defun srecode-semantic-handle-:c (dict) |
| 59 | "Add macros into the dictionary DICT based on the current c++ file. | 59 | "Add macros into the dictionary DICT based on the current c file. |
| 60 | Adds the following: | 60 | Adds the following: |
| 61 | FILENAME_SYMBOL - filename converted into a C compat symbol. | 61 | FILENAME_SYMBOL - filename converted into a C compat symbol. |
| 62 | HEADER - Shown section if in a header file." | 62 | HEADER - Shown section if in a header file." |
| @@ -76,6 +76,21 @@ HEADER - Shown section if in a header file." | |||
| 76 | ) | 76 | ) |
| 77 | ) | 77 | ) |
| 78 | 78 | ||
| 79 | ;;; :cpp ARGUMENT HANDLING | ||
| 80 | ;; | ||
| 81 | ;; When a :cpp argument is required, fill the dictionary with | ||
| 82 | ;; information about the current C++ file. | ||
| 83 | ;; | ||
| 84 | ;; Error if not in a C++ mode. | ||
| 85 | ;;;###autoload | ||
| 86 | (defun srecode-semantic-handle-:cpp (dict) | ||
| 87 | "Add macros into the dictionary DICT based on the current c file. | ||
| 88 | Calls `srecode-semantic-handle-:c. | ||
| 89 | Also adds the following: | ||
| 90 | - nothing -" | ||
| 91 | (srecode-semantic-handle-:c dict) | ||
| 92 | ) | ||
| 93 | |||
| 79 | (defun srecode-semantic-handle-:using-namespaces (dict) | 94 | (defun srecode-semantic-handle-:using-namespaces (dict) |
| 80 | "Add macros into the dictionary DICT based on used namespaces. | 95 | "Add macros into the dictionary DICT based on used namespaces. |
| 81 | Adds the following: | 96 | Adds the following: |
| @@ -94,10 +109,15 @@ PREFIX_NAMESPACE - for each NAMESPACE in `srecode-cpp-namespaces'." | |||
| 94 | ) | 109 | ) |
| 95 | 110 | ||
| 96 | (define-mode-local-override srecode-semantic-apply-tag-to-dict | 111 | (define-mode-local-override srecode-semantic-apply-tag-to-dict |
| 97 | c++-mode (tag-wrapper dict) | 112 | c-mode (tag-wrapper dict) |
| 98 | "Apply C++ specific features from TAG-WRAPPER into DICT. | 113 | "Apply C and C++ specific features from TAG-WRAPPER into DICT. |
| 99 | Calls `srecode-semantic-apply-tag-to-dict-default' first. Adds | 114 | Calls `srecode-semantic-apply-tag-to-dict-default' first. Adds |
| 100 | special behavior for tag of classes include, using and function." | 115 | special behavior for tag of classes include, using and function. |
| 116 | |||
| 117 | This function cannot be split into C and C++ specific variants, as | ||
| 118 | the way the tags are created from the parser does not distinguish | ||
| 119 | either. The side effect is that you could get some C++ tag properties | ||
| 120 | specified in a C file." | ||
| 101 | 121 | ||
| 102 | ;; Use default implementation to fill in the basic properties. | 122 | ;; Use default implementation to fill in the basic properties. |
| 103 | (srecode-semantic-apply-tag-to-dict-default tag-wrapper dict) | 123 | (srecode-semantic-apply-tag-to-dict-default tag-wrapper dict) |
| @@ -150,14 +170,20 @@ special behavior for tag of classes include, using and function." | |||
| 150 | (templates (semantic-tag-get-attribute tag :template)) | 170 | (templates (semantic-tag-get-attribute tag :template)) |
| 151 | (modifiers (semantic-tag-modifiers tag))) | 171 | (modifiers (semantic-tag-modifiers tag))) |
| 152 | 172 | ||
| 153 | ;; Add modifiers into the dictionary | 173 | ;; Mark constructors and destructors as such. |
| 174 | (when (semantic-tag-function-constructor-p tag) | ||
| 175 | (srecode-dictionary-show-section dict "CONSTRUCTOR")) | ||
| 176 | (when (semantic-tag-function-destructor-p tag) | ||
| 177 | (srecode-dictionary-show-section dict "DESTRUCTOR")) | ||
| 178 | |||
| 179 | ;; Add modifiers into the dictionary. | ||
| 154 | (dolist (modifier modifiers) | 180 | (dolist (modifier modifiers) |
| 155 | (let ((modifier-dict (srecode-dictionary-add-section-dictionary | 181 | (let ((modifier-dict (srecode-dictionary-add-section-dictionary |
| 156 | dict "MODIFIERS"))) | 182 | dict "MODIFIERS"))) |
| 157 | (srecode-dictionary-set-value modifier-dict "NAME" modifier))) | 183 | (srecode-dictionary-set-value modifier-dict "NAME" modifier))) |
| 158 | 184 | ||
| 159 | ;; Add templates into child dictionaries. | 185 | ;; Add templates into child dictionaries. |
| 160 | (srecode-cpp-apply-templates dict templates) | 186 | (srecode-c-apply-templates dict templates) |
| 161 | 187 | ||
| 162 | ;; When the function is a member function, it can have | 188 | ;; When the function is a member function, it can have |
| 163 | ;; additional modifiers. | 189 | ;; additional modifiers. |
| @@ -171,8 +197,7 @@ special behavior for tag of classes include, using and function." | |||
| 171 | ;; If the member function is pure virtual, add a dictionary | 197 | ;; If the member function is pure virtual, add a dictionary |
| 172 | ;; entry. | 198 | ;; entry. |
| 173 | (when (semantic-tag-get-attribute tag :pure-virtual-flag) | 199 | (when (semantic-tag-get-attribute tag :pure-virtual-flag) |
| 174 | (srecode-dictionary-show-section dict "PURE")) | 200 | (srecode-dictionary-show-section dict "PURE"))))) |
| 175 | ))) | ||
| 176 | 201 | ||
| 177 | ;; | 202 | ;; |
| 178 | ;; CLASS | 203 | ;; CLASS |
| @@ -184,7 +209,7 @@ special behavior for tag of classes include, using and function." | |||
| 184 | 209 | ||
| 185 | ;; Add templates into child dictionaries. | 210 | ;; Add templates into child dictionaries. |
| 186 | (let ((templates (semantic-tag-get-attribute tag :template))) | 211 | (let ((templates (semantic-tag-get-attribute tag :template))) |
| 187 | (srecode-cpp-apply-templates dict templates)))) | 212 | (srecode-c-apply-templates dict templates)))) |
| 188 | )) | 213 | )) |
| 189 | ) | 214 | ) |
| 190 | 215 | ||
| @@ -192,7 +217,7 @@ special behavior for tag of classes include, using and function." | |||
| 192 | ;;; Helper functions | 217 | ;;; Helper functions |
| 193 | ;; | 218 | ;; |
| 194 | 219 | ||
| 195 | (defun srecode-cpp-apply-templates (dict templates) | 220 | (defun srecode-c-apply-templates (dict templates) |
| 196 | "Add section dictionaries for TEMPLATES to DICT." | 221 | "Add section dictionaries for TEMPLATES to DICT." |
| 197 | (when templates | 222 | (when templates |
| 198 | (let ((templates-dict (srecode-dictionary-add-section-dictionary | 223 | (let ((templates-dict (srecode-dictionary-add-section-dictionary |