comparison lisp/font-lock.el @ 1428:10738b72057d

[xemacs-hg @ 2003-04-24 05:29:11 by youngs] 2003-04-24 Steve Youngs <youngs@xemacs.org> * font-lock.el (font-lock-match-java-declarations): Move save-restriction, narrow-to-region to beginning of function to avoid going beyond the limit and causing an infloop. From Jin Choi <jsc@orangeimagineering.com>. 2003-04-24 Vasily Korytov <deskpot@myrealbox.com> * lisp-mode.el (emacs-lisp-mode-hook, lisp-mode-hook, lisp-interaction-mode-hook): Add the docstrings.
author youngs
date Thu, 24 Apr 2003 05:29:12 +0000
parents 089f79dae3ab
children a014bbc989c9
comparison
equal deleted inserted replaced
1427:5d62849e7275 1428:10738b72057d
2717 ;; (primitive types and class names, i.e. capitalized words.) 2717 ;; (primitive types and class names, i.e. capitalized words.)
2718 ;; Should the variable name be followed by a comma, we reposition 2718 ;; Should the variable name be followed by a comma, we reposition
2719 ;; the cursor to fontify more identifiers. 2719 ;; the cursor to fontify more identifiers.
2720 (defun font-lock-match-java-declarations (limit) 2720 (defun font-lock-match-java-declarations (limit)
2721 "Match and skip over variable definitions." 2721 "Match and skip over variable definitions."
2722 (if (looking-at "\\s *\\(\\[\\s *\\]\\s *\\)*") 2722 (save-restriction
2723 (goto-char (match-end 0))) 2723 (narrow-to-region (point-min) limit)
2724 (and 2724
2725 (looking-at java-font-lock-identifier-regexp) 2725 (if (looking-at "\\s *\\(\\[\\s *\\]\\s *\\)*")
2726 (save-match-data 2726 (goto-char (match-end 0)))
2727 (not (string-match java-font-lock-type-regexp 2727 (and
2728 (buffer-substring (match-beginning 1) 2728 (looking-at java-font-lock-identifier-regexp)
2729 (match-end 1))))) 2729 (save-match-data
2730 (save-match-data 2730 (not (string-match java-font-lock-type-regexp
2731 (save-excursion 2731 (buffer-substring (match-beginning 1)
2732 (goto-char (match-beginning 1)) 2732 (match-end 1)))))
2733 (not (looking-at 2733 (save-match-data
2734 (concat java-font-lock-class-name-regexp 2734 (save-excursion
2735 "\\s *\\(\\[\\s *\\]\\s *\\)*\\<"))))) 2735 (goto-char (match-beginning 1))
2736 (save-match-data 2736 (not (looking-at
2737 (condition-case nil 2737 (concat java-font-lock-class-name-regexp
2738 (save-restriction 2738 "\\s *\\(\\[\\s *\\]\\s *\\)*\\<")))))
2739 (narrow-to-region (point-min) limit) 2739 (save-match-data
2740 (goto-char (match-end 0)) 2740 (condition-case nil
2741 ;; Note: Both `scan-sexps' and the second goto-char can 2741 (progn
2742 ;; generate an error which is caught by the 2742 (goto-char (match-end 0))
2743 ;; `condition-case' expression. 2743 ;; Note: Both `scan-sexps' and the second goto-char can
2744 (while (not (looking-at "\\s *\\(\\(,\\)\\|;\\|$\\)")) 2744 ;; generate an error which is caught by the
2745 (goto-char (or (scan-sexps (point) 1) (point-max)))) 2745 ;; `condition-case' expression.
2746 (goto-char (match-end 2))) ; non-nil 2746 (while (not (looking-at "\\s *\\(\\(,\\)\\|;\\|$\\)"))
2747 (error t))))) 2747 (goto-char (or (scan-sexps (point) 1) (point-max))))
2748 (goto-char (match-end 2))) ; non-nil
2749 (error t))))))
2748 2750
2749 2751
2750 (defvar tex-font-lock-keywords 2752 (defvar tex-font-lock-keywords
2751 ; ;; Regexps updated with help from Ulrik Dickow <dickow@nbi.dk>. 2753 ; ;; Regexps updated with help from Ulrik Dickow <dickow@nbi.dk>.
2752 ; '(("\\\\\\(begin\\|end\\|newcommand\\){\\([a-zA-Z0-9\\*]+\\)}" 2754 ; '(("\\\\\\(begin\\|end\\|newcommand\\){\\([a-zA-Z0-9\\*]+\\)}"