aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Marshall1998-09-01 09:01:44 +0000
committerSimon Marshall1998-09-01 09:01:44 +0000
commit4fffc0710edf058579724aa03a3b745c691101ca (patch)
tree8beed7f789679543232468a7814e3dae2a12e06e
parente1d6d5b93f34fbb58e4b9eafbb27c15a915d88f0 (diff)
downloademacs-4fffc0710edf058579724aa03a3b745c691101ca.tar.gz
emacs-4fffc0710edf058579724aa03a3b745c691101ca.zip
(tex-font-lock-keywords-2): Fontify \nocite like \cite.
(lisp-font-lock-keywords-2): Fontify abort, assert, etc., separately. ({c,c++,objc,java}-font-lock-keywords-{2,3}): Fontify only type/class names with font-lock-type-face. Fontify type specs, etc., with font-lock-keyword-face.
-rw-r--r--lisp/font-lock.el277
1 files changed, 176 insertions, 101 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 3a410be453a..4a07a0151be 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -236,7 +236,7 @@
236 236
237;; User variables. 237;; User variables.
238 238
239(defcustom font-lock-maximum-size (* 250 1024) 239(defcustom font-lock-maximum-size 256000
240 "*Maximum size of a buffer for buffer fontification. 240 "*Maximum size of a buffer for buffer fontification.
241Only buffers less than this can be fontified when Font Lock mode is turned on. 241Only buffers less than this can be fontified when Font Lock mode is turned on.
242If nil, means size is irrelevant. 242If nil, means size is irrelevant.
@@ -283,12 +283,12 @@ decoration for buffers in C++ mode, and level 1 decoration otherwise."
283 (integer :tag "level" 1))))) 283 (integer :tag "level" 1)))))
284 :group 'font-lock) 284 :group 'font-lock)
285 285
286(defcustom font-lock-verbose (* 0 1024) 286(defcustom font-lock-verbose 0
287 "*If non-nil, means show status messages for buffer fontification. 287 "*If non-nil, means show status messages for buffer fontification.
288If a number, only buffers greater than this size have fontification messages." 288If a number, only buffers greater than this size have fontification messages."
289 :type '(choice (const :tag "never" nil) 289 :type '(choice (const :tag "never" nil)
290 (integer :tag "size") 290 (other :tag "always" t)
291 (other :tag "always" t)) 291 (integer :tag "size"))
292 :group 'font-lock) 292 :group 'font-lock)
293 293
294;; Fontification variables: 294;; Fontification variables:
@@ -1908,12 +1908,12 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1908 (list (concat "(\\(def\\(" 1908 (list (concat "(\\(def\\("
1909 ;; Function declarations. 1909 ;; Function declarations.
1910 "\\(advice\\|alias\\|generic\\|macro\\*?\\|method\\|" 1910 "\\(advice\\|alias\\|generic\\|macro\\*?\\|method\\|"
1911 "setf\\|subst\\*?\\|un\\*?\\|" 1911 "setf\\|subst\\*?\\|un\\*?\\|"
1912 "ine-\\(derived-mode\\|function\\|condition\\|" 1912 "ine-\\(condition\\|derived-mode\\|function\\|"
1913 "skeleton\\|widget\\|setf-expander\\|method-combination\\|" 1913 "method-combination\\|setf-expander\\|skeleton\\|widget\\|"
1914 "\\(symbol\\|compiler\\|modify\\)-macro\\)\\)\\|" 1914 "\\(compiler\\|modify\\|symbol\\)-macro\\)\\)\\|"
1915 ;; Variable declarations. 1915 ;; Variable declarations.
1916 "\\(const\\(ant\\)?\\|custom\\|face\\|var\\|parameter\\)\\|" 1916 "\\(const\\(ant\\)?\\|custom\\|face\\|parameter\\|var\\)\\|"
1917 ;; Structure declarations. 1917 ;; Structure declarations.
1918 "\\(class\\|group\\|package\\|struct\\|type\\)" 1918 "\\(class\\|group\\|package\\|struct\\|type\\)"
1919 "\\)\\)\\>" 1919 "\\)\\)\\>"
@@ -1939,14 +1939,14 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1939 ;; Control structures. Emacs Lisp forms. 1939 ;; Control structures. Emacs Lisp forms.
1940 (cons (concat 1940 (cons (concat
1941 "(" (regexp-opt 1941 "(" (regexp-opt
1942 '("cond" "if" "while" "catch" "throw" "let" "let*" 1942 '("cond" "if" "while" "let" "let*"
1943 "prog" "progn" "progv" "prog1" "prog2" "prog*" 1943 "prog" "progn" "progv" "prog1" "prog2" "prog*"
1944 "inline" "save-restriction" "save-excursion" 1944 "inline" "lambda" "save-restriction" "save-excursion"
1945 "save-window-excursion" "save-selected-window" 1945 "save-window-excursion" "save-selected-window"
1946 "save-match-data" "save-current-buffer" "unwind-protect" 1946 "save-match-data" "save-current-buffer" "unwind-protect"
1947 "condition-case" "track-mouse" 1947 "condition-case" "track-mouse"
1948 "eval-after-load" "eval-and-compile" "eval-when-compile" 1948 "eval-after-load" "eval-and-compile" "eval-when-compile"
1949 "eval-when" "lambda" 1949 "eval-when"
1950 "with-current-buffer" "with-electric-help" 1950 "with-current-buffer" "with-electric-help"
1951 "with-output-to-string" "with-output-to-temp-buffer" 1951 "with-output-to-string" "with-output-to-temp-buffer"
1952 "with-temp-buffer" "with-temp-file" 1952 "with-temp-buffer" "with-temp-file"
@@ -1960,7 +1960,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1960 '("when" "unless" "case" "ecase" "typecase" "etypecase" 1960 '("when" "unless" "case" "ecase" "typecase" "etypecase"
1961 "ccase" "ctypecase" "handler-case" "handler-bind" 1961 "ccase" "ctypecase" "handler-case" "handler-bind"
1962 "restart-bind" "restart-case" "in-package" 1962 "restart-bind" "restart-case" "in-package"
1963 "assert" "abort" "error" "cerror" "break" "ignore-errors" 1963 "cerror" "break" "ignore-errors"
1964 "loop" "do" "do*" "dotimes" "dolist" "the" "locally" 1964 "loop" "do" "do*" "dotimes" "dolist" "the" "locally"
1965 "proclaim" "declaim" "declare" "symbol-macrolet" 1965 "proclaim" "declaim" "declare" "symbol-macrolet"
1966 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let" 1966 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let"
@@ -1969,9 +1969,14 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1969 "\\>") 1969 "\\>")
1970 1) 1970 1)
1971 ;; 1971 ;;
1972 ;; Feature symbols as constants. 1972 ;; Exit/Feature symbols as constants.
1973 '("(\\(featurep\\|provide\\|require\\)\\>[ \t']*\\(\\sw+\\)?" 1973 (list (concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\>"
1974 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) 1974 "[ \t']*\\(\\sw+\\)?")
1975 '(1 font-lock-keyword-face)
1976 '(2 font-lock-constant-face nil t))
1977 ;;
1978 ;; Erroneous structures.
1979 '("(\\(abort\\|assert\\|error\\|signal\\)\\>" 1 font-lock-warning-face)
1975 ;; 1980 ;;
1976 ;; Words inside \\[] tend to be for `substitute-command-keys'. 1981 ;; Words inside \\[] tend to be for `substitute-command-keys'.
1977 '("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend) 1982 '("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend)
@@ -2103,9 +2108,9 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
2103 '("label" "ref" "pageref" "vref" "eqref") 2108 '("label" "ref" "pageref" "vref" "eqref")
2104 t)) 2109 t))
2105 (citations-opt (regexp-opt 2110 (citations-opt (regexp-opt
2106 '("cite" "caption" "index" "glossary" 2111 '("cite" "nocite" "caption" "index" "glossary"
2107 "footnote" "footnotemark" "footnotetext") 2112 "footnote" "footnotemark" "footnotetext")
2108 t)) 2113 t))
2109 ;; 2114 ;;
2110 ;; Names of commands that should be fontified. 2115 ;; Names of commands that should be fontified.
2111 (specials (regexp-opt 2116 (specials (regexp-opt
@@ -2182,7 +2187,8 @@ The value of this variable is used when Font Lock mode is turned on."
2182 :group 'font-lock-extra-types) 2187 :group 'font-lock-extra-types)
2183 2188
2184(defcustom c++-font-lock-extra-types 2189(defcustom c++-font-lock-extra-types
2185 '("\\([iof]\\|str\\)+stream\\(buf\\)?" "ios" 2190 '("\\sw+_t"
2191 "\\([iof]\\|str\\)+stream\\(buf\\)?" "ios"
2186 "string" "rope" 2192 "string" "rope"
2187 "list" "slist" 2193 "list" "slist"
2188 "deque" "vector" "bit_vector" 2194 "deque" "vector" "bit_vector"
@@ -2190,7 +2196,8 @@ The value of this variable is used when Font Lock mode is turned on."
2190 "map" "multimap" 2196 "map" "multimap"
2191 "hash\\(_\\(m\\(ap\\|ulti\\(map\\|set\\)\\)\\|set\\)\\)?" 2197 "hash\\(_\\(m\\(ap\\|ulti\\(map\\|set\\)\\)\\|set\\)\\)?"
2192 "stack" "queue" "priority_queue" 2198 "stack" "queue" "priority_queue"
2193 "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator") 2199 "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator"
2200 "reference" "const_reference")
2194 "*List of extra types to fontify in C++ mode. 2201 "*List of extra types to fontify in C++ mode.
2195Each list item should be a regexp not containing word-delimiters. 2202Each list item should be a regexp not containing word-delimiters.
2196For example, a value of (\"string\") means the word string is treated as a type 2203For example, a value of (\"string\") means the word string is treated as a type
@@ -2250,18 +2257,26 @@ See also `c-font-lock-extra-types'.")
2250(let* ((c-keywords 2257(let* ((c-keywords
2251 (eval-when-compile 2258 (eval-when-compile
2252 (regexp-opt '("break" "continue" "do" "else" "for" "if" "return" 2259 (regexp-opt '("break" "continue" "do" "else" "for" "if" "return"
2253 "switch" "while" "sizeof") t))) 2260 "switch" "while" "sizeof"
2254 (c-type-types 2261 ;; Type related, but we don't do anything special.
2262 "typedef" "extern" "auto" "register" "static"
2263 "volatile" "const") t)))
2264 (c-type-specs
2265 (eval-when-compile
2266 (regexp-opt '("enum" "struct" "union") t)))
2267 (c-type-specs-depth
2268 (regexp-opt-depth c-type-specs))
2269 (c-type-names
2255 `(mapconcat 'identity 2270 `(mapconcat 'identity
2256 (cons 2271 (cons
2257 (,@ (eval-when-compile 2272 (,@ (eval-when-compile
2258 (regexp-opt 2273 (regexp-opt
2259 '("auto" "extern" "register" "static" "typedef" "struct" 2274 '("char" "short" "int" "long" "signed" "unsigned"
2260 "union" "enum" "signed" "unsigned" "short" "long" 2275 "float" "double" "void"))))
2261 "int" "char" "float" "double" "void" "volatile" "const"))))
2262 c-font-lock-extra-types) 2276 c-font-lock-extra-types)
2263 "\\|")) 2277 "\\|"))
2264 (c-type-depth `(regexp-opt-depth (,@ c-type-types))) 2278 (c-type-names-depth
2279 `(regexp-opt-depth (,@ c-type-names)))
2265 ) 2280 )
2266 (setq c-font-lock-keywords-1 2281 (setq c-font-lock-keywords-1
2267 (list 2282 (list
@@ -2298,12 +2313,12 @@ See also `c-font-lock-extra-types'.")
2298 ;; 2313 ;;
2299 ;; Simple regexps for speed. 2314 ;; Simple regexps for speed.
2300 ;; 2315 ;;
2301 ;; Fontify all type specifiers. 2316 ;; Fontify all type names.
2302 `(eval . 2317 `(eval .
2303 (cons (concat "\\<\\(" (,@ c-type-types) "\\)\\>") 'font-lock-type-face)) 2318 (cons (concat "\\<\\(" (,@ c-type-names) "\\)\\>") 'font-lock-type-face))
2304 ;; 2319 ;;
2305 ;; Fontify all builtin keywords (except case, default and goto; see below). 2320 ;; Fontify all builtin keywords (except case, default and goto; see below).
2306 (concat "\\<" c-keywords "\\>") 2321 (concat "\\<\\(" c-keywords "\\|" c-type-specs "\\)\\>")
2307 ;; 2322 ;;
2308 ;; Fontify case/goto keywords and targets, and case default/goto tags. 2323 ;; Fontify case/goto keywords and targets, and case default/goto tags.
2309 '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?" 2324 '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?"
@@ -2323,15 +2338,16 @@ See also `c-font-lock-extra-types'.")
2323 ;; We still have to fontify type specifiers individually, as C is so hairy. 2338 ;; We still have to fontify type specifiers individually, as C is so hairy.
2324 (list 2339 (list
2325 ;; 2340 ;;
2326 ;; Fontify all storage classes and type specifiers, plus their items. 2341 ;; Fontify all storage types, plus their items.
2327 `(eval . 2342 `(eval .
2328 (list (concat "\\<\\(" (,@ c-type-types) "\\)\\>" 2343 (list (concat "\\<\\(" (,@ c-type-names) "\\)\\>"
2329 "\\([ \t*&]+\\sw+\\>\\)*") 2344 "\\([ \t*&]+\\sw+\\>\\)*")
2330 ;; Fontify each declaration item. 2345 ;; Fontify each declaration item.
2331 (list 'font-lock-match-c-style-declaration-item-and-skip-to-next 2346 (list 'font-lock-match-c-style-declaration-item-and-skip-to-next
2332 ;; Start with point after all type specifiers. 2347 ;; Start with point after all type specifiers.
2333 (list 'goto-char (list 'or (list 'match-beginning 2348 (list 'goto-char (list 'or
2334 (+ (,@ c-type-depth) 2)) 2349 (list 'match-beginning
2350 (+ (,@ c-type-names-depth) 2))
2335 '(match-end 1))) 2351 '(match-end 1)))
2336 ;; Finish with point after first type specifier. 2352 ;; Finish with point after first type specifier.
2337 '(goto-char (match-end 1)) 2353 '(goto-char (match-end 1))
@@ -2340,13 +2356,24 @@ See also `c-font-lock-extra-types'.")
2340 font-lock-function-name-face 2356 font-lock-function-name-face
2341 font-lock-variable-name-face))))) 2357 font-lock-variable-name-face)))))
2342 ;; 2358 ;;
2359 ;; Fontify all storage specs and types, plus their items.
2360 `(eval .
2361 (list (concat "\\<\\(" (,@ c-type-specs) "\\)\\>"
2362 "[ \t]*\\(\\sw+\\)?")
2363 (list 1 'font-lock-keyword-face)
2364 (list (+ (,@ c-type-specs-depth) 2) 'font-lock-type-face nil t)
2365 (list 'font-lock-match-c-style-declaration-item-and-skip-to-next
2366 nil nil
2367 ;; Fontify as a variable or function name.
2368 '(1 (if (match-beginning 2)
2369 font-lock-function-name-face
2370 font-lock-variable-name-face) nil t))))
2371 ;;
2343 ;; Fontify structures, or typedef names, plus their items. 2372 ;; Fontify structures, or typedef names, plus their items.
2344 '("\\(}\\)[ \t*]*\\sw" 2373 '("\\(}\\)[ \t*]*\\sw"
2345 (font-lock-match-c-style-declaration-item-and-skip-to-next 2374 (font-lock-match-c-style-declaration-item-and-skip-to-next
2346 (goto-char (match-end 1)) nil 2375 (goto-char (match-end 1)) nil
2347 (1 (if (match-beginning 2) 2376 (1 font-lock-type-face)))
2348 font-lock-function-name-face
2349 font-lock-variable-name-face))))
2350 ;; 2377 ;;
2351 ;; Fontify anything at beginning of line as a declaration or definition. 2378 ;; Fontify anything at beginning of line as a declaration or definition.
2352 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*" 2379 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*"
@@ -2412,8 +2439,15 @@ See also `c++-font-lock-extra-types'.")
2412 (regexp-opt 2439 (regexp-opt
2413 '("break" "continue" "do" "else" "for" "if" "return" "switch" 2440 '("break" "continue" "do" "else" "for" "if" "return" "switch"
2414 "while" "asm" "catch" "delete" "new" "sizeof" "this" "throw" "try" 2441 "while" "asm" "catch" "delete" "new" "sizeof" "this" "throw" "try"
2415 ;; Eric Hopper <hopper@omnifarious.mn.org> says these are new. 2442 ;; Branko Cibej <branko.cibej@hermes.si> says this is new.
2416 "static_cast" "dynamic_cast" "const_cast" "reinterpret_cast") t))) 2443 "export"
2444 ;; Mark Mitchell <mmitchell@usa.net> says these are new.
2445 "mutable" "explicit"
2446 ;; Alain Picard <ap@abelard.apana.org.au> suggests treating these
2447 ;; as keywords not types.
2448 "typedef" "template"
2449 "extern" "auto" "register" "const" "volatile" "static"
2450 "inline" "friend" "virtual") t)))
2417 (c++-operators 2451 (c++-operators
2418 (eval-when-compile 2452 (eval-when-compile
2419 (regexp-opt 2453 (regexp-opt
@@ -2421,34 +2455,40 @@ See also `c++-font-lock-extra-types'.")
2421 '("+" "-" "*" "/" "%" "^" "&" "|" "~" "!" "=" "<" ">" "+=" "-=" 2455 '("+" "-" "*" "/" "%" "^" "&" "|" "~" "!" "=" "<" ">" "+=" "-="
2422 "*=" "/=" "%=" "^=" "&=" "|=" "<<" ">>" ">>=" "<<=" "==" "!=" 2456 "*=" "/=" "%=" "^=" "&=" "|=" "<<" ">>" ">>=" "<<=" "==" "!="
2423 "<=" ">=" "&&" "||" "++" "--" "->*" "," "->" "[]" "()")))) 2457 "<=" ">=" "&&" "||" "++" "--" "->*" "," "->" "[]" "()"))))
2424 (c++-type-types 2458 (c++-type-specs
2459 (eval-when-compile
2460 (regexp-opt
2461 '("class" "public" "private" "protected" "typename"
2462 "struct" "union" "enum" "namespace" "using"
2463 ;; Eric Hopper <hopper@omnifarious.mn.org> says these are new.
2464 "static_cast" "dynamic_cast" "const_cast" "reinterpret_cast") t)))
2465 (c++-type-specs-depth
2466 (regexp-opt-depth c++-type-specs))
2467 (c++-type-names
2425 `(mapconcat 'identity 2468 `(mapconcat 'identity
2426 (cons 2469 (cons
2427 (,@ (eval-when-compile 2470 (,@ (eval-when-compile
2428 (regexp-opt 2471 (regexp-opt
2429 '("extern" "auto" "register" "static" "typedef" "struct" 2472 '("signed" "unsigned" "short" "long"
2430 "union" "enum" "signed" "unsigned" "short" "long" 2473 "int" "char" "float" "double" "void"
2431 "int" "char" "float" "double" "void" "volatile" "const" 2474 "bool" "complex"))))
2432 "inline" "friend" "bool" "virtual" "complex" "template"
2433 "namespace" "using"
2434 ;; Mark Mitchell <mmitchell@usa.net> says these are new.
2435 "explicit" "mutable"
2436 ;; Branko Cibej <branko.cibej@hermes.si> suggests this.
2437 "export"))))
2438 c++-font-lock-extra-types) 2475 c++-font-lock-extra-types)
2439 "\\|")) 2476 "\\|"))
2477 (c++-type-names-depth `(regexp-opt-depth (,@ c++-type-names)))
2440 ;; 2478 ;;
2441 ;; A brave attempt to match templates following a type and/or match 2479 ;; A brave attempt to match templates following a type and/or match
2442 ;; class membership. See and sync the above function 2480 ;; class membership. See and sync the above function
2443 ;; `font-lock-match-c++-style-declaration-item-and-skip-to-next'. 2481 ;; `font-lock-match-c++-style-declaration-item-and-skip-to-next'.
2444 (c++-type-suffix (concat "\\([ \t]*<\\([^>\n]+\\)[ \t*&]*>\\)?" 2482 (c++-type-suffix (concat "\\([ \t]*<\\([^>\n]+\\)[ \t*&]*>\\)?"
2445 "\\([ \t]*::[ \t*~]*\\(\\sw+\\)\\)*")) 2483 "\\([ \t]*::[ \t*~]*\\(\\sw+\\)\\)*"))
2484 (c++-type-suffix-depth (regexp-opt-depth c++-type-suffix))
2446 ;; If the string is a type, it may be followed by the cruft above. 2485 ;; If the string is a type, it may be followed by the cruft above.
2447 (c++-type-spec (concat "\\(\\sw+\\)\\>" c++-type-suffix)) 2486 (c++-type-spec (concat "\\(\\sw+\\)\\>" c++-type-suffix))
2487 (c++-type-spec-depth (regexp-opt-depth c++-type-spec))
2448 ;; 2488 ;;
2449 ;; Parenthesis depth of user-defined types not forgetting their cruft. 2489 ;; Parenthesis depth of user-defined types not forgetting their cruft.
2450 (c++-type-depth `(regexp-opt-depth 2490 (c++-type-depth `(regexp-opt-depth
2451 (concat (,@ c++-type-types) (,@ c++-type-suffix)))) 2491 (concat (,@ c++-type-names) (,@ c++-type-suffix))))
2452 ) 2492 )
2453 (setq c++-font-lock-keywords-1 2493 (setq c++-font-lock-keywords-1
2454 (append 2494 (append
@@ -2457,23 +2497,12 @@ See also `c++-font-lock-extra-types'.")
2457 (cdr c-font-lock-keywords-1) 2497 (cdr c-font-lock-keywords-1)
2458 (list 2498 (list
2459 ;; 2499 ;;
2460 ;; Class names etc.
2461 (list (concat "\\<\\(class\\|public\\|private\\|protected\\|typename\\)\\>"
2462 "[ \t]*"
2463 "\\(" c++-type-spec "\\)?")
2464 '(1 font-lock-type-face)
2465 '(3 (if (match-beginning 6)
2466 font-lock-type-face
2467 font-lock-function-name-face) nil t)
2468 '(5 font-lock-function-name-face nil t)
2469 '(7 font-lock-function-name-face nil t))
2470 ;;
2471 ;; Fontify function name definitions, possibly incorporating class names. 2500 ;; Fontify function name definitions, possibly incorporating class names.
2472 (list (concat "^" c++-type-spec "[ \t]*(") 2501 (list (concat "^" c++-type-spec "[ \t]*(")
2473 '(1 (if (or (match-beginning 2) (match-beginning 4)) 2502 '(1 (if (or (match-beginning 2) (match-beginning 4))
2474 font-lock-type-face 2503 font-lock-type-face
2475 font-lock-function-name-face)) 2504 font-lock-function-name-face))
2476 '(3 font-lock-function-name-face nil t) 2505 '(3 font-lock-type-face nil t)
2477 '(5 font-lock-function-name-face nil t)) 2506 '(5 font-lock-function-name-face nil t))
2478 ))) 2507 )))
2479 2508
@@ -2483,7 +2512,7 @@ See also `c++-font-lock-extra-types'.")
2483 ;; 2512 ;;
2484 ;; The list `c-font-lock-keywords-2' for C++ plus operator overloading. 2513 ;; The list `c-font-lock-keywords-2' for C++ plus operator overloading.
2485 `(eval . 2514 `(eval .
2486 (cons (concat "\\<\\(" (,@ c++-type-types) "\\)\\>") 2515 (cons (concat "\\<\\(" (,@ c++-type-names) "\\)\\>")
2487 'font-lock-type-face)) 2516 'font-lock-type-face))
2488 ;; 2517 ;;
2489 ;; Fontify operator overloading. 2518 ;; Fontify operator overloading.
@@ -2500,7 +2529,7 @@ See also `c++-font-lock-extra-types'.")
2500 (1 font-lock-constant-face))) 2529 (1 font-lock-constant-face)))
2501 ;; 2530 ;;
2502 ;; Fontify other builtin keywords. 2531 ;; Fontify other builtin keywords.
2503 (concat "\\<" c++-keywords "\\>") 2532 (concat "\\<\\(" c++-keywords "\\|" c++-type-specs "\\)\\>")
2504 ;; 2533 ;;
2505 ;; Eric Hopper <hopper@omnifarious.mn.org> says `true' and `false' are new. 2534 ;; Eric Hopper <hopper@omnifarious.mn.org> says `true' and `false' are new.
2506 '("\\<\\(false\\|true\\)\\>" . font-lock-constant-face) 2535 '("\\<\\(false\\|true\\)\\>" . font-lock-constant-face)
@@ -2514,8 +2543,10 @@ See also `c++-font-lock-extra-types'.")
2514 ;; 2543 ;;
2515 ;; Fontify all storage classes and type specifiers, plus their items. 2544 ;; Fontify all storage classes and type specifiers, plus their items.
2516 `(eval . 2545 `(eval .
2517 (list (concat "\\<\\(" (,@ c++-type-types) "\\)\\>" (,@ c++-type-suffix) 2546 (list (concat "\\<\\(" (,@ c++-type-names) "\\)\\>" (,@ c++-type-suffix)
2518 "\\([ \t*&]+" (,@ c++-type-spec) "\\)*") 2547 "\\([ \t*&]+" (,@ c++-type-spec) "\\)*")
2548 ;; The name of any template type.
2549 (list (+ (,@ c++-type-names-depth) 3) 'font-lock-type-face nil t)
2519 ;; Fontify each declaration item. 2550 ;; Fontify each declaration item.
2520 (list 'font-lock-match-c++-style-declaration-item-and-skip-to-next 2551 (list 'font-lock-match-c++-style-declaration-item-and-skip-to-next
2521 ;; Start with point after all type specifiers. 2552 ;; Start with point after all type specifiers.
@@ -2529,18 +2560,42 @@ See also `c++-font-lock-extra-types'.")
2529 font-lock-type-face) 2560 font-lock-type-face)
2530 ((match-beginning 6) font-lock-function-name-face) 2561 ((match-beginning 6) font-lock-function-name-face)
2531 (t font-lock-variable-name-face))) 2562 (t font-lock-variable-name-face)))
2532 '(3 font-lock-function-name-face nil t) 2563 '(3 font-lock-type-face nil t)
2533 '(5 (if (match-beginning 6) 2564 '(5 (if (match-beginning 6)
2534 font-lock-function-name-face 2565 font-lock-function-name-face
2535 font-lock-variable-name-face) nil t)))) 2566 font-lock-variable-name-face) nil t))))
2536 ;; 2567 ;;
2568 ;; Fontify all storage specs and types, plus their items.
2569 `(eval .
2570 (list (concat "\\<" (,@ c++-type-specs) "\\>" (,@ c++-type-suffix)
2571 "[ \t]*\\(" (,@ c++-type-spec) "\\)?")
2572 ;; The name of any template type.
2573 (list (+ (,@ c++-type-specs-depth) 2) 'font-lock-type-face nil t)
2574 ;; The name of any type.
2575 (list (+ (,@ c++-type-specs-depth) (,@ c++-type-suffix-depth) 2)
2576 'font-lock-type-face nil t)
2577 ;; Fontify each declaration item.
2578 (list 'font-lock-match-c++-style-declaration-item-and-skip-to-next
2579 ;; Start with point after all type specifiers.
2580 nil
2581 ;; Finish with point after first type specifier.
2582 nil
2583 ;; Fontify as a variable or function name.
2584 '(1 (cond ((or (match-beginning 2) (match-beginning 4))
2585 font-lock-type-face)
2586 ((match-beginning 6) font-lock-function-name-face)
2587 (t font-lock-variable-name-face)))
2588 '(3 font-lock-type-face nil t)
2589 '(5 (if (match-beginning 6)
2590 font-lock-function-name-face
2591 font-lock-variable-name-face) nil t))
2592 ))
2593 ;;
2537 ;; Fontify structures, or typedef names, plus their items. 2594 ;; Fontify structures, or typedef names, plus their items.
2538 '("\\(}\\)[ \t*]*\\sw" 2595 '("\\(}\\)[ \t*]*\\sw"
2539 (font-lock-match-c++-style-declaration-item-and-skip-to-next 2596 (font-lock-match-c++-style-declaration-item-and-skip-to-next
2540 (goto-char (match-end 1)) nil 2597 (goto-char (match-end 1)) nil
2541 (1 (if (match-beginning 6) 2598 (1 font-lock-type-face)))
2542 font-lock-function-name-face
2543 font-lock-variable-name-face))))
2544 ;; 2599 ;;
2545 ;; Fontify anything at beginning of line as a declaration or definition. 2600 ;; Fontify anything at beginning of line as a declaration or definition.
2546 (list (concat "^\\(" c++-type-spec "[ \t*&]*\\)+") 2601 (list (concat "^\\(" c++-type-spec "[ \t*&]*\\)+")
@@ -2551,7 +2606,7 @@ See also `c++-font-lock-extra-types'.")
2551 font-lock-type-face) 2606 font-lock-type-face)
2552 ((match-beginning 6) font-lock-function-name-face) 2607 ((match-beginning 6) font-lock-function-name-face)
2553 (t font-lock-variable-name-face))) 2608 (t font-lock-variable-name-face)))
2554 (3 font-lock-function-name-face nil t) 2609 (3 font-lock-type-face nil t)
2555 (5 (if (match-beginning 6) 2610 (5 (if (match-beginning 6)
2556 font-lock-function-name-face 2611 font-lock-function-name-face
2557 font-lock-variable-name-face) nil t))) 2612 font-lock-variable-name-face) nil t)))
@@ -2580,19 +2635,28 @@ See also `objc-font-lock-extra-types'.")
2580(let* ((objc-keywords 2635(let* ((objc-keywords
2581 (eval-when-compile 2636 (eval-when-compile
2582 (regexp-opt '("break" "continue" "do" "else" "for" "if" "return" 2637 (regexp-opt '("break" "continue" "do" "else" "for" "if" "return"
2583 "switch" "while" "sizeof" "self" "super") t))) 2638 "switch" "while" "sizeof" "self" "super"
2584 (objc-type-types 2639 "typedef" "auto" "extern" "static"
2640 "volatile" "const") t)))
2641 (objc-type-specs
2642 (eval-when-compile
2643 (regexp-opt
2644 '("register" "struct" "union" "enum"
2645 "oneway" "in" "out" "inout" "bycopy" "byref") t)))
2646 (objc-type-specs-depth
2647 (regexp-opt-depth objc-type-specs))
2648 (objc-type-names
2585 `(mapconcat 'identity 2649 `(mapconcat 'identity
2586 (cons 2650 (cons
2587 (,@ (eval-when-compile 2651 (,@ (eval-when-compile
2588 (regexp-opt 2652 (regexp-opt
2589 '("auto" "extern" "register" "static" "typedef" "struct" 2653 '("signed" "unsigned" "short" "long"
2590 "union" "enum" "signed" "unsigned" "short" "long" 2654 "int" "char" "float" "double" "void"
2591 "int" "char" "float" "double" "void" "volatile" "const" 2655 "id"))))
2592 "id" "oneway" "in" "out" "inout" "bycopy" "byref"))))
2593 objc-font-lock-extra-types) 2656 objc-font-lock-extra-types)
2594 "\\|")) 2657 "\\|"))
2595 (objc-type-depth `(regexp-opt-depth (,@ objc-type-types))) 2658 (objc-type-names-depth
2659 `(regexp-opt-depth (,@ objc-type-names)))
2596 ) 2660 )
2597 (setq objc-font-lock-keywords-1 2661 (setq objc-font-lock-keywords-1
2598 (append 2662 (append
@@ -2604,26 +2668,23 @@ See also `objc-font-lock-extra-types'.")
2604 ;; Fontify compiler directives. 2668 ;; Fontify compiler directives.
2605 '("@\\(\\sw+\\)\\>" 2669 '("@\\(\\sw+\\)\\>"
2606 (1 font-lock-keyword-face) 2670 (1 font-lock-keyword-face)
2607 ("\\=[ \t:<(,]*\\(\\sw+\\)" nil nil 2671 ("\\=[ \t:<,]*\\(\\sw+\\)" nil nil
2608 (1 font-lock-function-name-face))) 2672 (1 font-lock-type-face)))
2609 ;; 2673 ;;
2610 ;; Fontify method names and arguments. Oh Lordy! 2674 ;; Fontify method names and arguments. Oh Lordy!
2611 ;; First, on the same line as the function declaration. 2675 ;; First, on the same line as the function declaration.
2612 '("^[+-][ \t]*\\(PRIVATE\\)?[ \t]*\\((\\([^)\n]+\\))\\)?[ \t]*\\(\\sw+\\)" 2676 '("^[+-][ \t]*\\(PRIVATE\\>\\)?[ \t]*\\(([^)\n]+)\\)?[ \t]*\\(\\sw+\\)"
2613 (1 font-lock-type-face nil t) 2677 (1 font-lock-keyword-face nil t)
2614 (3 font-lock-type-face nil t) 2678 (3 font-lock-function-name-face)
2615 (4 font-lock-function-name-face) 2679 ("\\=[ \t]*\\(\\sw+\\)?:[ \t]*\\(([^)\n]+)\\)?[ \t]*\\(\\sw+\\)"
2616 ("\\=[ \t]*\\(\\sw+\\)?:[ \t]*\\((\\([^)\n]+\\))\\)?[ \t]*\\(\\sw+\\)"
2617 nil nil 2680 nil nil
2618 (1 font-lock-function-name-face nil t) 2681 (1 font-lock-function-name-face nil t)
2619 (3 font-lock-type-face nil t) 2682 (3 font-lock-variable-name-face)))
2620 (4 font-lock-variable-name-face)))
2621 ;; Second, on lines following the function declaration. 2683 ;; Second, on lines following the function declaration.
2622 '(":" ("^[ \t]*\\(\\sw+\\)?:[ \t]*\\((\\([^)\n]+\\))\\)?[ \t]*\\(\\sw+\\)" 2684 '(":" ("^[ \t]*\\(\\sw+\\)?:[ \t]*\\(([^)\n]+)\\)?[ \t]*\\(\\sw+\\)"
2623 (beginning-of-line) (end-of-line) 2685 (beginning-of-line) (end-of-line)
2624 (1 font-lock-function-name-face nil t) 2686 (1 font-lock-function-name-face nil t)
2625 (3 font-lock-type-face nil t) 2687 (3 font-lock-variable-name-face)))
2626 (4 font-lock-variable-name-face)))
2627 ))) 2688 )))
2628 2689
2629 (setq objc-font-lock-keywords-2 2690 (setq objc-font-lock-keywords-2
@@ -2634,11 +2695,11 @@ See also `objc-font-lock-extra-types'.")
2634 ;; 2695 ;;
2635 ;; Fontify all type specifiers. 2696 ;; Fontify all type specifiers.
2636 `(eval . 2697 `(eval .
2637 (cons (concat "\\<\\(" (,@ objc-type-types) "\\)\\>") 2698 (cons (concat "\\<\\(" (,@ objc-type-names) "\\)\\>")
2638 'font-lock-type-face)) 2699 'font-lock-type-face))
2639 ;; 2700 ;;
2640 ;; Fontify all builtin keywords (except case, default and goto; see below). 2701 ;; Fontify all builtin keywords (except case, default and goto; see below).
2641 (concat "\\<" objc-keywords "\\>") 2702 (concat "\\<\\(" objc-keywords "\\|" objc-type-specs "\\)\\>")
2642 ;; 2703 ;;
2643 ;; Fontify case/goto keywords and targets, and case default/goto tags. 2704 ;; Fontify case/goto keywords and targets, and case default/goto tags.
2644 '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?" 2705 '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?"
@@ -2662,14 +2723,15 @@ See also `objc-font-lock-extra-types'.")
2662 ;; 2723 ;;
2663 ;; Fontify all storage classes and type specifiers, plus their items. 2724 ;; Fontify all storage classes and type specifiers, plus their items.
2664 `(eval . 2725 `(eval .
2665 (list (concat "\\<\\(" (,@ objc-type-types) "\\)\\>" 2726 (list (concat "\\<\\(" (,@ objc-type-names) "\\)\\>"
2666 "\\([ \t*&]+\\sw+\\>\\)*") 2727 "\\([ \t*&]+\\sw+\\>\\)*")
2667 ;; Fontify each declaration item. 2728 ;; Fontify each declaration item.
2668 (list 'font-lock-match-c-style-declaration-item-and-skip-to-next 2729 (list 'font-lock-match-c-style-declaration-item-and-skip-to-next
2669 ;; Start with point after all type specifiers. 2730 ;; Start with point after all type specifiers.
2670 (list 'goto-char (list 'or (list 'match-beginning 2731 (list 'goto-char
2671 (+ (,@ objc-type-depth) 2)) 2732 (list 'or (list 'match-beginning
2672 '(match-end 1))) 2733 (+ (,@ objc-type-names-depth) 2))
2734 '(match-end 1)))
2673 ;; Finish with point after first type specifier. 2735 ;; Finish with point after first type specifier.
2674 '(goto-char (match-end 1)) 2736 '(goto-char (match-end 1))
2675 ;; Fontify as a variable or function name. 2737 ;; Fontify as a variable or function name.
@@ -2677,13 +2739,26 @@ See also `objc-font-lock-extra-types'.")
2677 font-lock-function-name-face 2739 font-lock-function-name-face
2678 font-lock-variable-name-face))))) 2740 font-lock-variable-name-face)))))
2679 ;; 2741 ;;
2742 ;; Fontify all storage specs and types, plus their items.
2743 `(eval .
2744 (list (concat "\\<\\(" (,@ objc-type-specs) "[ \t]*\\)+\\>"
2745 "[ \t]*\\(\\sw+\\)?")
2746 ;; The name of any type.
2747 (list (+ (,@ objc-type-specs-depth) 2) 'font-lock-type-face nil t)
2748 ;; Fontify each declaration item.
2749 (list 'font-lock-match-c++-style-declaration-item-and-skip-to-next
2750 nil nil
2751 ;; Fontify as a variable or function name.
2752 '(1 (if (match-beginning 2)
2753 font-lock-function-name-face
2754 font-lock-variable-name-face)))
2755 ))
2756 ;;
2680 ;; Fontify structures, or typedef names, plus their items. 2757 ;; Fontify structures, or typedef names, plus their items.
2681 '("\\(}\\)[ \t*]*\\sw" 2758 '("\\(}\\)[ \t*]*\\sw"
2682 (font-lock-match-c-style-declaration-item-and-skip-to-next 2759 (font-lock-match-c-style-declaration-item-and-skip-to-next
2683 (goto-char (match-end 1)) nil 2760 (goto-char (match-end 1)) nil
2684 (1 (if (match-beginning 2) 2761 (1 font-lock-type-face)))
2685 font-lock-function-name-face
2686 font-lock-variable-name-face))))
2687 ;; 2762 ;;
2688 ;; Fontify anything at beginning of line as a declaration or definition. 2763 ;; Fontify anything at beginning of line as a declaration or definition.
2689 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*" 2764 '("^\\(\\sw+\\)\\>\\([ \t*]+\\sw+\\>\\)*"
@@ -2743,7 +2818,8 @@ See also `java-font-lock-extra-types'.")
2743 (java-other-types 2818 (java-other-types
2744 '(mapconcat 'identity (cons "\\sw+\\.\\sw+" java-font-lock-extra-types) 2819 '(mapconcat 'identity (cons "\\sw+\\.\\sw+" java-font-lock-extra-types)
2745 "\\|")) 2820 "\\|"))
2746 (java-other-depth `(regexp-opt-depth (,@ java-other-types))) 2821 (java-other-depth
2822 `(regexp-opt-depth (,@ java-other-types)))
2747 ) 2823 )
2748 (setq java-font-lock-keywords-1 2824 (setq java-font-lock-keywords-1
2749 (list 2825 (list
@@ -2762,11 +2838,10 @@ See also `java-font-lock-extra-types'.")
2762 (list 2838 (list
2763 ;; 2839 ;;
2764 ;; Fontify all builtin type specifiers. 2840 ;; Fontify all builtin type specifiers.
2765 (cons (concat "\\<\\(" java-minor-types "\\|" java-major-types "\\)\\>") 2841 (cons (concat "\\<" java-minor-types "\\>") 'font-lock-type-face)
2766 'font-lock-type-face)
2767 ;; 2842 ;;
2768 ;; Fontify all builtin keywords (except below). 2843 ;; Fontify all builtin keywords (except below).
2769 (concat "\\<" java-keywords "\\>") 2844 (concat "\\<\\(" java-keywords "\\|" java-major-types "\\)\\>")
2770 ;; 2845 ;;
2771 ;; Fontify keywords and targets, and case default/goto tags. 2846 ;; Fontify keywords and targets, and case default/goto tags.
2772 (list "\\<\\(break\\|case\\|continue\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?" 2847 (list "\\<\\(break\\|case\\|continue\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?"