Mercurial > hg > xemacs-beta
comparison lisp/packages/font-lock.el @ 10:49a24b4fd526 r19-15b6
Import from CVS: tag r19-15b6
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:47:52 +0200 |
parents | ac2d302a0011 |
children | 0293115a14e9 |
comparison
equal
deleted
inserted
replaced
9:6f2bbbbbe05a | 10:49a24b4fd526 |
---|---|
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
25 ;; General Public License for more details. | 25 ;; General Public License for more details. |
26 | 26 |
27 ;; You should have received a copy of the GNU General Public License | 27 ;; You should have received a copy of the GNU General Public License |
28 ;; along with XEmacs; see the file COPYING. If not, write to the Free | 28 ;; along with XEmacs; see the file COPYING. If not, write to the Free |
29 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 29 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, |
30 ;; Boston, MA 02111-1307, USA. | |
30 | 31 |
31 ;;; Synched up with: FSF 19.30 except for the code to initialize the faces. | 32 ;;; Synched up with: FSF 19.30 except for the code to initialize the faces. |
32 | 33 |
33 ;;; Commentary: | 34 ;;; Commentary: |
34 | 35 |
73 ;; | 74 ;; |
74 ;; The same is true of `c-font-lock-keywords-1' and `c-font-lock-keywords-2'; | 75 ;; The same is true of `c-font-lock-keywords-1' and `c-font-lock-keywords-2'; |
75 ;; the former is subdued, the latter is loud. | 76 ;; the former is subdued, the latter is loud. |
76 ;; | 77 ;; |
77 ;; You can make font-lock default to the gaudier variety of keyword | 78 ;; You can make font-lock default to the gaudier variety of keyword |
78 ;; highlighting by setting the variable `font-lock-use-maximal-decoration' | 79 ;; highlighting by setting the variable `font-lock-maximum-decoration' |
79 ;; before loading font-lock, or by calling the functions | 80 ;; before loading font-lock, or by calling the functions |
80 ;; `font-lock-use-default-maximal-decoration' or | 81 ;; `font-lock-use-default-maximal-decoration' or |
81 ;; `font-lock-use-default-minimal-decoration'. | 82 ;; `font-lock-use-default-minimal-decoration'. |
82 ;; | 83 ;; |
83 ;; On a Sparc10, the initial fontification takes about 6 seconds for a typical | 84 ;; On a Sparc10, the initial fontification takes about 6 seconds for a typical |
136 ;; Don't use it to, say, highlight keywords in commented out code or strings. | 137 ;; Don't use it to, say, highlight keywords in commented out code or strings. |
137 ;; - Err, that's it. | 138 ;; - Err, that's it. |
138 | 139 |
139 | 140 |
140 ;;; Code: | 141 ;;; Code: |
142 | |
143 (require 'fontl-hooks) | |
141 | 144 |
142 ;;;;;;;;;;;;;;;;;;;;;; user variables ;;;;;;;;;;;;;;;;;;;;;; | 145 ;;;;;;;;;;;;;;;;;;;;;; user variables ;;;;;;;;;;;;;;;;;;;;;; |
143 | 146 |
144 (defvar font-lock-verbose t | 147 (defvar font-lock-verbose t |
145 "*If non-nil, means show status messages when fontifying. | 148 "*If non-nil, means show status messages when fontifying. |
1502 c++-font-lock-keywords-3) | 1505 c++-font-lock-keywords-3) |
1503 nil nil ((?_ . "w") (?~ . "w")) beginning-of-defun)) | 1506 nil nil ((?_ . "w") (?~ . "w")) beginning-of-defun)) |
1504 | 1507 |
1505 (put 'java-mode 'font-lock-defaults | 1508 (put 'java-mode 'font-lock-defaults |
1506 '((java-font-lock-keywords | 1509 '((java-font-lock-keywords |
1507 java-font-lock-keywords-1 java-font-lock-keywords-2) | 1510 java-font-lock-keywords-1 java-font-lock-keywords-2 |
1508 nil nil ((?_ . "w")) beginning-of-defun)) | 1511 java-font-lock-keywords-3) |
1512 nil nil ((?_ . "w")) beginning-of-defun | |
1513 (font-lock-mark-block-function . mark-defun))) | |
1509 | 1514 |
1510 (put 'lisp-mode 'font-lock-defaults | 1515 (put 'lisp-mode 'font-lock-defaults |
1511 '((lisp-font-lock-keywords | 1516 '((lisp-font-lock-keywords |
1512 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) | 1517 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) |
1513 nil nil | 1518 nil nil |
2165 ; ) | 2170 ; ) |
2166 ; | 2171 ; |
2167 ;(defconst c++-font-lock-keywords c++-font-lock-keywords-1 | 2172 ;(defconst c++-font-lock-keywords c++-font-lock-keywords-1 |
2168 ; "Additional expressions to highlight in C++ mode.") | 2173 ; "Additional expressions to highlight in C++ mode.") |
2169 | 2174 |
2175 ;; Java support from Anders Lindgren and Bob Weiner | |
2176 | |
2170 (defconst java-font-lock-keywords-1 nil | 2177 (defconst java-font-lock-keywords-1 nil |
2171 "For consideration as a value of `java-font-lock-keywords'. | 2178 "For consideration as a value of `java-font-lock-keywords'. |
2172 This does fairly subdued highlighting.") | 2179 This does fairly subdued highlighting.") |
2173 | 2180 |
2174 (defconst java-font-lock-keywords-2 nil | 2181 (defconst java-font-lock-keywords-2 nil |
2175 "For consideration as a value of `java-font-lock-keywords'. | 2182 "For consideration as a value of `java-font-lock-keywords'. |
2176 This does a lot more highlighting.") | 2183 This adds highlighting of types and identifier names.") |
2177 | 2184 |
2178 (let ((storage (concat "static\\|abstract\\|const\\|final\\|" | 2185 (defconst java-font-lock-keywords-3 nil |
2179 "synchronized\\|threadsafe\\|transient\\|native")) | 2186 "For consideration as a value of `java-font-lock-keywords'. |
2180 (types (concat | 2187 This adds highlighting of Java documentation tags, such as @see.") |
2181 "boolean\\|int\\|char\\|byte\\|short\\|long\\|" | 2188 |
2182 "float\\|double\\|void")) | 2189 (defvar java-font-lock-type-regexp |
2183 (reserved-words | 2190 (concat "\\<\\(boolean\\|byte\\|char\\|double\\|float\\|int" |
2184 '("private" "protected" "public" "break" "byvalue" | 2191 "\\|long\\|short\\|void\\)\\>") |
2185 "case" "catch" "class" | 2192 "Regexp which should match a primitive type.") |
2186 "continue" "default" "do" "else if" | 2193 |
2187 "else" "extends" "false" "finally" | 2194 (let ((capital-letter "A-Z\300-\326\330-\337") |
2188 "for" "if" "implements" "import" | 2195 (letter "a-zA-Z_$\300-\326\330-\366\370-\377") |
2189 "instanceof" "interface" | 2196 (digit "0-9")) |
2190 "new" "null" "package" "return" | 2197 (defvar java-font-lock-identifier-regexp |
2191 "super" "switch" | 2198 (concat "\\<\\([" letter "][" letter digit "]*\\)\\>") |
2192 "this" "throw" "throws" | 2199 "Regexp which should match all Java identifiers.") |
2193 "true" "try" "synchronize" "while")) | 2200 |
2194 | 2201 (defvar java-font-lock-class-name-regexp |
2195 ; (java-token "\\w+") | 2202 (concat "\\<\\([" capital-letter "][" letter digit "]*\\)\\>") |
2196 (java-token "[a-zA-Z0-9_\.]+") | 2203 "Regexp which should match a class or an interface name. |
2197 (java-modifying-token "[a-zA-Z0-9_\.]+\\([ \t]*\\[\\]\\)?") | 2204 The name is assumed to begin with a capital letter.") |
2198 ) | 2205 ) |
2206 | |
2207 | |
2208 (let ((java-modifier-regexp | |
2209 (concat "\\<\\(abstract\\|const\\|final\\|native\\|" | |
2210 "private\\|protected\\|public\\|" | |
2211 "static\\|synchronized\\|transient\\|volatile\\)\\>"))) | |
2212 | |
2213 ;; Basic font-lock support: | |
2199 (setq java-font-lock-keywords-1 | 2214 (setq java-font-lock-keywords-1 |
2200 (list | 2215 (list |
2201 ;;------------------------------------------------------------------ | 2216 ;; Keywords: |
2202 ;; fontify C++-style comments as comments. | 2217 (list |
2203 ;;------------------------------------------------------------------ | 2218 (concat |
2204 | 2219 "\\<\\(" |
2205 '("//.*" . font-lock-comment-face) | 2220 "break\\|byvalue\\|" |
2206 | 2221 "case\\|cast\\|catch\\|class\\|continue\\|" |
2207 ;;------------------------------------------------------------------ | 2222 "do\\|else\\|extends\\|" |
2208 ;; I think static deserves special attention | 2223 "finally\\|for\\|future\\|" |
2209 ;;------------------------------------------------------------------ | 2224 "generic\\|goto\\|" |
2210 | 2225 "if\\|implements\\|import\\|" |
2211 '("static" . font-lock-keyword-face) | 2226 "instanceof\\|interface\\|" |
2212 | 2227 "new\\|package\\|return\\|switch\\|" |
2213 ;;------------------------------------------------------------------ | 2228 "throws?\\|try\\|while\\)\\>") |
2214 ;; Make the "public" keyword standout (should we do private instead?) | 2229 1 'font-lock-keyword-face) |
2215 ;;------------------------------------------------------------------ | 2230 |
2216 | 2231 ;; Modifiers: |
2217 ;; these depend on some personal SMF faces | 2232 (list java-modifier-regexp 1 font-lock-type-face) |
2218 | 2233 |
2219 ;; I wish I knew elisp, etc enough to know if it's | 2234 ;; Special constants: |
2220 ;; faster to use 1 regex for n words, or n | 2235 '("\\<\\(this\\|super\\)\\>" (1 font-lock-reference-face)) |
2221 ;; unglobbed entries in this list... | 2236 '("\\<\\(false\\|null\\|true\\)\\>" (1 font-lock-keyword-face)) |
2222 | 2237 |
2223 ;; '("private" . font-lock-pale-face) | 2238 ;; Class names: |
2224 ;; '("protected" . font-lock-pale-face) | 2239 (list (concat "\\<class\\>\\s *" java-font-lock-identifier-regexp) |
2225 | 2240 1 'font-lock-function-name-face) |
2226 ;;------------------------------------------------------------------ | 2241 |
2227 ;; special case so "new Foo();" doesn't map to method declaration | 2242 ;; Package declarations: |
2228 ;;------------------------------------------------------------------ | 2243 (list (concat "\\<\\(package\\|import\\)\\>\\s *" |
2229 | 2244 java-font-lock-identifier-regexp) |
2230 (list (concat | 2245 '(2 font-lock-reference-face) |
2231 "^.*[ \t]+\\(new\\|return\\)[ \t]+" | 2246 (list (concat |
2232 "\\(" java-token "\\)") | 2247 "\\=\\.\\(" java-font-lock-identifier-regexp "\\)") |
2233 2 'default) | 2248 nil nil '(1 (if (= (char-after (match-end 0)) ?.) |
2234 | 2249 'font-lock-reference-face |
2235 ;;------------------------------------------------------------------ | 2250 'font-lock-type-face)))) |
2236 ;; special case so "else if();" doesn't map to method declaration | 2251 |
2237 ;;------------------------------------------------------------------ | 2252 ;; Constructors: |
2238 | 2253 (list (concat |
2239 (list "^.*[ \t]+else[ \t]+\\(if\\)" | 2254 "^\\s *\\(" java-modifier-regexp "\\s +\\)*" |
2240 1 'default) | 2255 java-font-lock-class-name-regexp "\\s *\(") |
2241 | 2256 (list 3 |
2242 ;;------------------------------------------------------------------ | 2257 '(condition-case nil |
2243 ;; METHOD IDENTIFICATION | 2258 (save-excursion |
2244 ;; | 2259 (goto-char (scan-sexps (- (match-end 0) 1) 1)) |
2245 ;; fontify the (first word of) names of methods being defined. | 2260 (parse-partial-sexp (point) (point-max) nil t) |
2246 ;;------------------------------------------------------------------ | 2261 (and (looking-at "\\($\\|\\<throws\\>\\|{\\)") |
2247 | 2262 'font-lock-function-name-face)) |
2248 (list (concat | 2263 (error 'font-lock-function-name-face)))) |
2249 "^[ \t]+" ;; indent of line | 2264 |
2250 | 2265 ;; Methods: |
2251 ;;------------------------------------------------------- | 2266 (list (concat "\\(" java-font-lock-type-regexp "\\|" |
2252 ;; Demanding a token 1st doesn't recognize constructors | 2267 java-font-lock-class-name-regexp "\\)" |
2253 ;; w/out any access specifiers. Unfortunately, that also | 2268 "\\s *\\(\\[\\s *\\]\\s *\\)*" |
2254 ;; looks like many other things, including "if (foo) {", | 2269 java-font-lock-identifier-regexp "\\s *\(") |
2255 ;; so it's not an easy case to detect -- I'm just going | 2270 5 |
2256 ;; to live w/out it for now... | 2271 'font-lock-function-name-face) |
2257 ;;------------------------------------------------------- | 2272 |
2258 | 2273 ;; Labels: |
2259 "\\(" java-modifying-token "[ \t]+\\)" | 2274 (list ":" |
2260 | 2275 (list |
2261 ; "\\(" | 2276 (concat "^\\s *" java-font-lock-identifier-regexp "\\s *:") |
2262 ; "\\(^[ \t]+\\(" java-token "[ \t]+\\)\\)" | 2277 '(beginning-of-line) '(end-of-line) |
2263 ; "\\|" | 2278 '(1 font-lock-reference-face))) |
2264 ; "\\( \\)" | 2279 |
2265 ; "\\)" | 2280 ;; `break' and continue' destination labels: |
2266 ; failed attempt to hack in ^ followed by exactly 4 spaces allowance to | 2281 (list (concat "\\<\\(break\\|continue\\)\\>\\s *" |
2267 ; recognize constructions with no access specified | 2282 java-font-lock-identifier-regexp) |
2268 | 2283 2 'font-lock-reference-face) |
2269 "\\(" java-modifying-token "[ \t]+\\)?" | 2284 |
2270 "\\(" java-modifying-token "[ \t]+\\)?" | 2285 ;; Case statements: |
2271 "\\(" java-modifying-token "[ \t]+\\)?" | 2286 ;; In Java, any constant expression is allowed. |
2272 "\\(" java-modifying-token "[ \t]+\\)?" | 2287 '("\\<case\\>\\s *\\(.*\\):" 1 font-lock-reference-face))) |
2273 "\\(" java-modifying-token "[ \t]+\\)?" | 2288 |
2274 "\\(" java-token "\\)[ \t]*(") | 2289 ;; Types and declared variable names: |
2275 | |
2276 ; "\\(" java-token "\\)[ \t]*(.*{") | |
2277 | |
2278 ;; SMF: while demanding { at EOL is stylistic, | |
2279 ;; it DOESN'T hilite the likes of: | |
2280 ;; return new Dimension() | |
2281 ;; "\\(" java-token "\\)[ \t]*(") | |
2282 ;; PROBLEM -- it leaves out abstract and native methods! | |
2283 | |
2284 13 'font-lock-function-name-face) | |
2285 | |
2286 ;;------------------------------------------------------------------ | |
2287 ;; Fontify class names ... | |
2288 ;; (info-node is another personal SMF face) | |
2289 ;;------------------------------------------------------------------ | |
2290 | |
2291 (list (concat | |
2292 "^[ \t]*\\([a-z]+[ \t]+\\)?\\([a-z]+[ \t]+\\)?class[ \t]+\\(" | |
2293 java-token "\\)") | |
2294 3 'font-lock-reference-face) | |
2295 | |
2296 ;;------------------------------------------------------------------ | |
2297 ;; Package names | |
2298 ;;------------------------------------------------------------------ | |
2299 | |
2300 (list (concat | |
2301 "package[ \t]+\\(" java-token "\\)") | |
2302 1 'font-lock-reference-face) | |
2303 | |
2304 ;; | |
2305 ;; Fontify case clauses. This is fast because its anchored on the left. | |
2306 | |
2307 '("case[ \t]+\\(\\(\\sw\\|\\s_\\)+\\):". 1) | |
2308 '("\\<\\(default\\):". 1) | |
2309 )) | |
2310 | |
2311 (setq java-font-lock-keywords-2 | 2290 (setq java-font-lock-keywords-2 |
2312 (append java-font-lock-keywords-1 | 2291 (append |
2313 (list | 2292 |
2314 ;; | 2293 java-font-lock-keywords-1 |
2315 ;; fontify all storage classes and type specifiers | 2294 (list |
2316 (cons (concat "\\<\\(" storage "\\)\\>") 'font-lock-type-face) | 2295 ;; Keywords followed by a type: |
2317 (cons (concat "\\<\\(" types "\\)\\>") 'font-lock-type-face) | 2296 (list (concat "\\<\\(extends\\|instanceof\\|new\\)\\>\\s *" |
2318 | 2297 java-font-lock-identifier-regexp) |
2319 ;; | 2298 '(2 (if (= (char-after (match-end 0)) ?.) |
2320 ;; fontify all builtin tokens | 2299 'font-lock-reference-face 'font-lock-type-face)) |
2321 (cons (concat | 2300 (list (concat "\\=\\." java-font-lock-identifier-regexp) |
2322 "[ \t]\\(" | 2301 '(goto-char (match-end 0)) nil |
2323 (mapconcat 'identity reserved-words "\\|") | 2302 '(1 (if (= (char-after (match-end 0)) ?.) |
2324 "\\)[ \t\n(){};,]") | 2303 'font-lock-reference-face 'font-lock-type-face)))) |
2325 1) | 2304 |
2326 (cons (concat | 2305 ;; Keywords followed by a type list: |
2327 "^\\(" | 2306 (list (concat "\\<\\(implements\\|throws\\)\\>\\ s*" |
2328 (mapconcat 'identity reserved-words "\\|") | 2307 java-font-lock-identifier-regexp) |
2329 "\\)[ \t\n(){};,]") | 2308 '(2 (if (= (char-after (match-end 0)) ?.) |
2330 1) | 2309 font-lock-reference-face font-lock-type-face)) |
2331 ))) | 2310 (list (concat "\\=\\(\\.\\|\\s *\\(,\\)\\s *\\)" |
2311 java-font-lock-identifier-regexp) | |
2312 '(goto-char (match-end 0)) nil | |
2313 '(3 (if (= (char-after (match-end 0)) ?.) | |
2314 font-lock-reference-face font-lock-type-face)))) | |
2315 | |
2316 ;; primitive types, can't be confused with anything else. | |
2317 (list java-font-lock-type-regexp | |
2318 '(1 font-lock-type-face) | |
2319 '(font-lock-match-java-declarations | |
2320 (goto-char (match-end 0)) | |
2321 (goto-char (match-end 0)) | |
2322 (0 font-lock-variable-name-face))) | |
2323 | |
2324 ;; Declarations, class types and capitalized variables: | |
2325 ;; | |
2326 ;; Declarations are easy to recognize. Capitalized words | |
2327 ;; followed by a closing parenthesis are treated as casts if they | |
2328 ;; also are followed by an expression. Expressions beginning with | |
2329 ;; a unary numerical operator, e.g. +, can't be cast to an object | |
2330 ;; type. | |
2331 ;; | |
2332 ;; The path of a fully qualified type, e.g. java.lang.Foo, is | |
2333 ;; fontified in the reference face. | |
2334 ;; | |
2335 ;; An access to a static field, e.g. System.out.println, is | |
2336 ;; not fontified since it can't be distinguished from the | |
2337 ;; usage of a capitalized variable, e.g. Foo.out.println. | |
2338 | |
2339 (list (concat java-font-lock-class-name-regexp | |
2340 "\\s *\\(\\[\\s *\\]\\s *\\)*" | |
2341 "\\(\\<\\|$\\|)\\s *\\([\(\"]\\|\\<\\)\\)") | |
2342 '(1 (save-match-data | |
2343 (save-excursion | |
2344 (goto-char | |
2345 (match-beginning 3)) | |
2346 (if (not (looking-at "\\<instanceof\\>")) | |
2347 'font-lock-type-face)))) | |
2348 (list (concat "\\=" java-font-lock-identifier-regexp "\\.") | |
2349 '(progn | |
2350 (goto-char (match-beginning 0)) | |
2351 (while (or (= (preceding-char) ?.) | |
2352 (= (char-syntax (preceding-char)) ?w)) | |
2353 (backward-char))) | |
2354 '(goto-char (match-end 0)) | |
2355 '(1 font-lock-reference-face) | |
2356 '(0 nil)) ; Workaround for bug in XEmacs. | |
2357 '(font-lock-match-java-declarations | |
2358 (goto-char (match-end 1)) | |
2359 (goto-char (match-end 0)) | |
2360 (1 font-lock-variable-name-face)))))) | |
2361 | |
2362 ;; Modifier keywords and Java doc tags | |
2363 (setq java-font-lock-keywords-3 | |
2364 (append | |
2365 | |
2366 '( | |
2367 ;; Feature scoping: | |
2368 ;; These must come first or the Modifiers from keywords-1 will | |
2369 ;; catch them. We don't want to use override fontification here | |
2370 ;; because then these terms will be fontified within comments. | |
2371 ("\\<private\\>" 0 font-lock-string-face) | |
2372 ("\\<protected\\>" 0 font-lock-preprocessor-face) | |
2373 ("\\<public\\>" 0 font-lock-reference-face)) | |
2374 | |
2375 java-font-lock-keywords-2 | |
2376 | |
2377 (list | |
2378 | |
2379 ;; Java doc tags | |
2380 '("@\\(author\\|exception\\|param\\|return\\|see\\|version\\)\\s " | |
2381 0 font-lock-keyword-face t) | |
2382 | |
2383 ;; Doc tag - Parameter identifiers | |
2384 (list (concat "@param\\s +" java-font-lock-identifier-regexp) | |
2385 1 'font-lock-variable-name-face t) | |
2386 | |
2387 ;; Doc tag - Exception types | |
2388 (list (concat "@exception\\ s*" | |
2389 java-font-lock-identifier-regexp) | |
2390 '(1 (if (= (char-after (match-end 0)) ?.) | |
2391 font-lock-reference-face font-lock-type-face) t) | |
2392 (list (concat "\\=\\." java-font-lock-identifier-regexp) | |
2393 '(goto-char (match-end 0)) nil | |
2394 '(1 (if (= (char-after (match-end 0)) ?.) | |
2395 'font-lock-reference-face 'font-lock-type-face) t))) | |
2396 | |
2397 ;; Doc tag - Cross-references, usually to methods | |
2398 '("@see\\s +\\(\\S *[^][ \t\n\r\f(){},.;:]\\)" | |
2399 1 font-lock-function-name-face t) | |
2400 | |
2401 ))) | |
2332 ) | 2402 ) |
2333 | 2403 |
2334 (defvar java-font-lock-keywords java-font-lock-keywords-1 | 2404 (defvar java-font-lock-keywords java-font-lock-keywords-1 |
2335 "Additional expressions to highlight in Java mode.") | 2405 "Additional expressions to highlight in Java mode.") |
2406 | |
2407 ;; Match and move over any declaration/definition item after | |
2408 ;; point. Does not match items which look like a type declaration | |
2409 ;; (primitive types and class names, i.e. capitalized words.) | |
2410 ;; Should the variable name be followed by a comma, we reposition | |
2411 ;; the cursor to fontify more identifiers. | |
2412 (defun font-lock-match-java-declarations (limit) | |
2413 "Match and skip over variable definitions." | |
2414 (if (looking-at "\\s *\\(\\[\\s *\\]\\s *\\)*") | |
2415 (goto-char (match-end 0))) | |
2416 (and | |
2417 (looking-at java-font-lock-identifier-regexp) | |
2418 (save-match-data | |
2419 (not (string-match java-font-lock-type-regexp | |
2420 (buffer-substring (match-beginning 1) | |
2421 (match-end 1))))) | |
2422 (save-match-data | |
2423 (save-excursion | |
2424 (goto-char (match-beginning 1)) | |
2425 (not (looking-at | |
2426 (concat java-font-lock-class-name-regexp | |
2427 "\\s *\\(\\[\\s *\\]\\s *\\)*\\<"))))) | |
2428 (save-match-data | |
2429 (condition-case nil | |
2430 (save-restriction | |
2431 (narrow-to-region (point-min) limit) | |
2432 (goto-char (match-end 0)) | |
2433 ;; Note: Both `scan-sexps' and the second goto-char can | |
2434 ;; generate an error which is caught by the | |
2435 ;; `condition-case' expression. | |
2436 (while (not (looking-at "\\s *\\(\\(,\\)\\|;\\|$\\)")) | |
2437 (goto-char (or (scan-sexps (point) 1) (point-max)))) | |
2438 (goto-char (match-end 2))) ; non-nil | |
2439 (error t))))) | |
2440 | |
2336 | 2441 |
2337 (defvar tex-font-lock-keywords | 2442 (defvar tex-font-lock-keywords |
2338 ; ;; Regexps updated with help from Ulrik Dickow <dickow@nbi.dk>. | 2443 ; ;; Regexps updated with help from Ulrik Dickow <dickow@nbi.dk>. |
2339 ; '(("\\\\\\(begin\\|end\\|newcommand\\){\\([a-zA-Z0-9\\*]+\\)}" | 2444 ; '(("\\\\\\(begin\\|end\\|newcommand\\){\\([a-zA-Z0-9\\*]+\\)}" |
2340 ; 2 font-lock-function-name-face) | 2445 ; 2 font-lock-function-name-face) |