/[emacs]/emacs/lisp/obsolete/c-mode.el
ViewVC logotype

Diff of /emacs/lisp/obsolete/c-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by monnier, Mon Dec 11 21:33:00 2000 UTC revision 1.2 by sds, Tue Nov 27 15:52:51 2001 UTC
# Line 207  regardless of where in the line point is Line 207  regardless of where in the line point is
207    
208  ;; This is actually the expression for C++ mode, but it's used for C too.  ;; This is actually the expression for C++ mode, but it's used for C too.
209  (defvar c-imenu-generic-expression  (defvar c-imenu-generic-expression
210    (`    `((nil
211     ((nil       ,(concat
212       (,         "^"                      ; beginning of line is required
       (concat  
        "^"                                ; beginning of line is required  
213         "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>"         "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>"
214         "\\([a-zA-Z0-9_:]+[ \t]+\\)?"      ; type specs; there can be no         "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; type specs; there can be no
215         "\\([a-zA-Z0-9_:]+[ \t]+\\)?"      ; more than 3 tokens, right?         "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; more than 3 tokens, right?
216    
217         "\\("                              ; last type spec including */&         "\\("                    ; last type spec including */&
218         "[a-zA-Z0-9_:]+"         "[a-zA-Z0-9_:]+"
219         "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)"         ; either pointer/ref sign or whitespace         "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)" ; either pointer/ref sign or whitespace
220         "\\)?"                             ; if there is a last type spec         "\\)?"                   ; if there is a last type spec
221         "\\("                          ; name; take that into the imenu entry         "\\("                    ; name; take that into the imenu entry
222         "[a-zA-Z0-9_:~]+"                      ; member function, ctor or dtor...         "[a-zA-Z0-9_:~]+"        ; member function, ctor or dtor...
223                                          ; (may not contain * because then                                  ; (may not contain * because then
224                                          ; "a::operator char*" would become "char*"!)                                  ; "a::operator char*" would become "char*"!)
225         "\\|"         "\\|"
226         "\\([a-zA-Z0-9_:~]*::\\)?operator"         "\\([a-zA-Z0-9_:~]*::\\)?operator"
227         "[^a-zA-Z1-9_][^(]*"           ; ...or operator         "[^a-zA-Z1-9_][^(]*"     ; ...or operator
228         " \\)"         " \\)"
229         "[ \t]*([^)]*)[ \t\n]*[^       ;]" ; require something other than a ; after         "[ \t]*([^)]*)[ \t\n]*[^       ;]" ; require something other than a ; after
230                                          ; the (...) to avoid prototypes.  Can't                                  ; the (...) to avoid prototypes.  Can't
231                                          ; catch cases with () inside the parentheses                                  ; catch cases with () inside the parentheses
232                                          ; surrounding the parameters                                  ; surrounding the parameters
233                                          ; (like "int foo(int a=bar()) {...}"                                  ; (like "int foo(int a=bar()) {...}"
234    
235         )) 6)         ) 6)
236      ("Class"      ("Class"
237       (, (concat       ,(concat
238           "^"                               ; beginning of line is required         "^"                      ; beginning of line is required
239           "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>"         "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>"
240           "class[ \t]+"         "class[ \t]+"
241           "\\([a-zA-Z0-9_]+\\)"                ; this is the string we want to get         "\\([a-zA-Z0-9_]+\\)"    ; this is the string we want to get
242           "[ \t]*[:{]"         "[ \t]*[:{]"
243           )) 2)         ) 2)
244  ;; Example of generic expression for finding prototypes, structs, unions, enums.      ;; Example of generic expression for finding prototypes, structs, unions, enums.
245  ;; Uncomment if you want to find these too.  It will be a bit slower gathering      ;; Uncomment if you want to find these too.  It will be a bit slower gathering
246  ;; the indexes.      ;; the indexes.
247  ;    ("Prototypes"                                  ;    ("Prototypes"
248  ;     (,                                  ;     (,
249  ;      (concat                                  ;      (concat
250  ;       "^"                               ; beginning of line is required                                  ;       "^"                               ; beginning of line is required
251  ;       "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>"                                  ;       "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>"
252  ;       "\\([a-zA-Z0-9_:]+[ \t]+\\)?"     ; type specs; there can be no                                  ;       "\\([a-zA-Z0-9_:]+[ \t]+\\)?"     ; type specs; there can be no
253  ;       "\\([a-zA-Z0-9_:]+[ \t]+\\)?"     ; more than 3 tokens, right?                                  ;       "\\([a-zA-Z0-9_:]+[ \t]+\\)?"     ; more than 3 tokens, right?
254    
255  ;       "\\("                             ; last type spec including */&                                  ;       "\\("                             ; last type spec including */&
256  ;       "[a-zA-Z0-9_:]+"                                  ;       "[a-zA-Z0-9_:]+"
257  ;       "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)"        ; either pointer/ref sign or whitespace                                  ;       "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)"        ; either pointer/ref sign or whitespace
258  ;       "\\)?"                            ; if there is a last type spec                                  ;       "\\)?"                            ; if there is a last type spec
259  ;       "\\("                         ; name; take that into the imenu entry                                  ;       "\\("                         ; name; take that into the imenu entry
260  ;       "[a-zA-Z0-9_:~]+"                     ; member function, ctor or dtor...                                  ;       "[a-zA-Z0-9_:~]+"                     ; member function, ctor or dtor...
261  ;                                       ; (may not contain * because then                                  ;                                       ; (may not contain * because then
262  ;                                       ; "a::operator char*" would become "char*"!)                                  ;                                       ; "a::operator char*" would become "char*"!)
263  ;       "\\|"                                  ;       "\\|"
264  ;       "\\([a-zA-Z0-9_:~]*::\\)?operator"                                  ;       "\\([a-zA-Z0-9_:~]*::\\)?operator"
265  ;       "[^a-zA-Z1-9_][^(]*"          ; ...or operator                                  ;       "[^a-zA-Z1-9_][^(]*"          ; ...or operator
266  ;       " \\)"                                  ;       " \\)"
267  ;       "[ \t]*([^)]*)[ \t\n]*;"        ; require ';' after                                  ;       "[ \t]*([^)]*)[ \t\n]*;"        ; require ';' after
268  ;                                       ; the (...) Can't                                  ;                                       ; the (...) Can't
269  ;                                       ; catch cases with () inside the parentheses                                  ;                                       ; catch cases with () inside the parentheses
270  ;                                       ; surrounding the parameters                                  ;                                       ; surrounding the parameters
271  ;                                       ; (like "int foo(int a=bar());"                                  ;                                       ; (like "int foo(int a=bar());"
272  ;       )) 6)                                  ;       )) 6)
273  ;    ("Struct"                                  ;    ("Struct"
274  ;     (, (concat                                  ;     (, (concat
275  ;        "^"                            ; beginning of line is required                                  ;        "^"                            ; beginning of line is required
276  ;        "\\(static[ \t]+\\)?"          ; there may be static or const.                                  ;        "\\(static[ \t]+\\)?"          ; there may be static or const.
277  ;        "\\(const[ \t]+\\)?"                                  ;        "\\(const[ \t]+\\)?"
278  ;        "struct[ \t]+"                                  ;        "struct[ \t]+"
279  ;        "\\([a-zA-Z0-9_]+\\)"          ; this is the string we want to get                                  ;        "\\([a-zA-Z0-9_]+\\)"          ; this is the string we want to get
280  ;        "[ \t]*[{]"                                  ;        "[ \t]*[{]"
281  ;        )) 3)                                  ;        )) 3)
282  ;    ("Enum"                                  ;    ("Enum"
283  ;     (, (concat                                  ;     (, (concat
284  ;        "^"                            ; beginning of line is required                                  ;        "^"                            ; beginning of line is required
285  ;        "\\(static[ \t]+\\)?"          ; there may be static or const.                                  ;        "\\(static[ \t]+\\)?"          ; there may be static or const.
286  ;        "\\(const[ \t]+\\)?"                                  ;        "\\(const[ \t]+\\)?"
287  ;        "enum[ \t]+"                                  ;        "enum[ \t]+"
288  ;        "\\([a-zA-Z0-9_]+\\)"          ; this is the string we want to get                                  ;        "\\([a-zA-Z0-9_]+\\)"          ; this is the string we want to get
289  ;        "[ \t]*[{]"                                  ;        "[ \t]*[{]"
290  ;        )) 3)                                  ;        )) 3)
291  ;    ("Union"                                  ;    ("Union"
292  ;     (, (concat                                  ;     (, (concat
293  ;        "^"                            ; beginning of line is required                                  ;        "^"                            ; beginning of line is required
294  ;        "\\(static[ \t]+\\)?"          ; there may be static or const.                                  ;        "\\(static[ \t]+\\)?"          ; there may be static or const.
295  ;        "\\(const[ \t]+\\)?"                                  ;        "\\(const[ \t]+\\)?"
296  ;        "union[ \t]+"                                  ;        "union[ \t]+"
297  ;        "\\([a-zA-Z0-9_]+\\)"          ; this is the string we want to get                                  ;        "\\([a-zA-Z0-9_]+\\)"          ; this is the string we want to get
298  ;        "[ \t]*[{]"                                  ;        "[ \t]*[{]"
299  ;        )) 3)                                  ;        )) 3)
300      ))      )
301    "Imenu generic expression for C mode.  See `imenu-generic-expression'.")    "Imenu generic expression for C mode.  See `imenu-generic-expression'.")
302    
303  (defun c-mode ()  (defun c-mode ()
# Line 1439  If within a string or comment, move by s Line 1437  If within a string or comment, move by s
1437                                  (parse-partial-sexp beg (point)                                  (parse-partial-sexp beg (point)
1438                                                      nil nil state)))                                                      nil nil state)))
1439                             (and (not (nth 3 new-state)) (not (nth 5 new-state))))                             (and (not (nth 3 new-state)) (not (nth 5 new-state))))
1440                           (indent-for-comment)))))))))))                           (indent-for-comment)))))))))))))
1441    
1442  ;; Look at all comment-start strings in the current line after point.  ;; Look at all comment-start strings in the current line after point.
1443  ;; Return t if one of them starts a real comment.  ;; Return t if one of them starts a real comment.

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26