Mercurial > emacs
changeset 40540:e5cf2302abcd
(java-font-lock-syntactic-face-function): New fun.
(font-lock-defaults-alist): Use it. From David Ponce <david.ponce@wanadoo.fr>
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 31 Oct 2001 02:54:06 +0000 |
parents | 901d871219d0 |
children | b3ba4328511c |
files | lisp/font-lock.el |
diffstat | 1 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/font-lock.el Wed Oct 31 02:42:54 2001 +0000 +++ b/lisp/font-lock.el Wed Oct 31 02:54:06 2001 +0000 @@ -526,7 +526,7 @@ java-font-lock-keywords-2 java-font-lock-keywords-3) nil nil ((?_ . "w") (?$ . "w")) nil (font-lock-syntactic-face-function - . c-font-lock-syntactic-face-function) + . java-font-lock-syntactic-face-function) (font-lock-mark-block-function . mark-defun)))) (list (cons 'c-mode c-mode-defaults) @@ -2986,6 +2986,24 @@ ;; Provide ourselves: +(defun java-font-lock-syntactic-face-function (state) + (save-excursion + (if (nth 3 state) + ;; Check whether the string is properly terminated. + (let ((nstate (parse-partial-sexp (point) (line-end-position) + nil nil state 'syntax-table))) + (if (and (eolp) (nth 3 nstate)) + ;; We're inside a string, at EOL. The JLS says that: + ;; It is a compile-time error for a line terminator to + ;; appear after the opening " and before the closing + ;; matching ". + font-lock-warning-face + font-lock-string-face)) + (goto-char (nth 8 state)) + (if (looking-at "/\\*\\*") + font-lock-doc-face + font-lock-comment-face)))) + (provide 'font-lock) (when (eq font-lock-support-mode 'jit-lock-mode)