/[emacs]/emacs/lisp/progmodes/cc-langs.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/cc-langs.el

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

revision 1.19 by mast, Mon Apr 22 00:35:36 2002 UTC revision 1.19.2.1 by miles, Fri Apr 4 06:20:32 2003 UTC
# Line 44  Line 44 
44  (cc-require 'cc-defs)  (cc-require 'cc-defs)
45  (cc-require 'cc-vars)  (cc-require 'cc-vars)
46    
 (require 'cl)  
   
47    
48  ;; Some support functions that are used when the language specific  ;; Some support functions that are used when the language specific
49  ;; constants are built.  Since the constants are built during compile  ;; constants are built.  Since the constants are built during compile
# Line 78  Line 76 
76              (setq count (1+ count) start (match-end 0)))              (setq count (1+ count) start (match-end 0)))
77            count))))            count))))
78    
79      (defun c-delete-duplicates (list)
80        (let ((tail list))
81          (while tail
82            (setcdr tail (delete (car tail) (cdr tail)))
83            (setq tail (cdr tail)))
84          list))
85    
86    (defun c-make-keywords-re (adorn &rest lists)    (defun c-make-keywords-re (adorn &rest lists)
87      "Make a regexp that matches all the strings in all the lists.      "Make a regexp that matches all the strings in all the lists.
88  Duplicates in the lists are removed.  The regexp may contain zero or  Duplicates in the lists are removed.  The regexp may contain zero or
# Line 85  more submatch expressions.  If ADORN is Line 90  more submatch expressions.  If ADORN is
90  one submatch which matches the whole keyword, and the regexp will also  one submatch which matches the whole keyword, and the regexp will also
91  not match a prefix of any identifier.  Adorned regexps cannot be  not match a prefix of any identifier.  Adorned regexps cannot be
92  appended."  appended."
93      (setq lists (delete-duplicates (apply 'append (nconc lists '(nil)))      (let ((list (copy-sequence (apply 'append lists))))
94                                     :test 'string-equal))        (setq list (c-delete-duplicates list))
95      (if lists        (if list
96          (let ((re (c-regexp-opt lists)))            (let ((re (c-regexp-opt list)))
97            ;; Add our own grouping parenthesis around re instead of              ;; Add our own grouping parenthesis around re instead of
98            ;; passing adorn to regexp-opt, since it in XEmacs makes the              ;; passing adorn to regexp-opt, since it in XEmacs makes the
99            ;; top level grouping "shy".              ;; top level grouping "shy".
100            (if adorn              (if adorn
101                (concat "\\(" re "\\)\\>\\([^_]\\|$\\)")                  (concat "\\(" re "\\)\\>\\([^_]\\|$\\)")
102              re))                re))
103        "\\<\\>"                          ; Matches nothing.          "\\<\\>"                                ; Matches nothing.
104        ))          )))
105    (put 'c-make-keywords-re 'lisp-indent-function 1)    (put 'c-make-keywords-re 'lisp-indent-function 1)
106    )    )
107    
# Line 432  appended." Line 437  appended."
437    
438  ;; All keywords as a list.  ;; All keywords as a list.
439  (c-lang-defconst c-keywords  (c-lang-defconst c-keywords
440    all (delete-duplicates (append (c-lang-var c-primitive-type-kwds)    all (c-delete-duplicates
441                                   (c-lang-var c-specifier-kwds)         (append (c-lang-var c-primitive-type-kwds)
442                                   (c-lang-var c-class-kwds)                 (c-lang-var c-specifier-kwds)
443                                   (c-lang-var c-other-decl-block-kwds)                 (c-lang-var c-class-kwds)
444                                   (c-lang-var c-block-decls-with-vars)                 (c-lang-var c-other-decl-block-kwds)
445                                   (c-lang-var c-other-decl-kwds)                 (c-lang-var c-block-decls-with-vars)
446                                   (c-lang-var c-decl-spec-kwds)                 (c-lang-var c-other-decl-kwds)
447                                   (c-lang-var c-protection-kwds)                 (c-lang-var c-decl-spec-kwds)
448                                   (c-lang-var c-block-stmt-1-kwds)                 (c-lang-var c-protection-kwds)
449                                   (c-lang-var c-block-stmt-2-kwds)                 (c-lang-var c-block-stmt-1-kwds)
450                                   (c-lang-var c-simple-stmt-kwds)                 (c-lang-var c-block-stmt-2-kwds)
451                                   (c-lang-var c-asm-stmt-kwds)                 (c-lang-var c-simple-stmt-kwds)
452                                   (c-lang-var c-label-kwds)                 (c-lang-var c-asm-stmt-kwds)
453                                   (c-lang-var c-expr-kwds)                 (c-lang-var c-label-kwds)
454                                   (c-lang-var c-lambda-kwds)                 (c-lang-var c-expr-kwds)
455                                   (c-lang-var c-inexpr-block-kwds)                 (c-lang-var c-lambda-kwds)
456                                   (c-lang-var c-inexpr-class-kwds)                 (c-lang-var c-inexpr-block-kwds)
457                                   (c-lang-var c-bitfield-kwds)                 (c-lang-var c-inexpr-class-kwds)
458                                   nil)                 (c-lang-var c-bitfield-kwds)
459                           :test 'string-equal))                 nil)))
460  (c-lang-defvar c-keywords (c-lang-var c-keywords))  (c-lang-defvar c-keywords (c-lang-var c-keywords))
461    
462  ;; All keywords as an adorned regexp.  ;; All keywords as an adorned regexp.

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.19.2.1

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