# HG changeset patch # User Stefan Monnier # Date 1004496846 0 # Node ID e5cf2302abcd5cab0e0b6651db29248cf4609630 # Parent 901d871219d08789c249bc1dc9797a4c634f7663 (java-font-lock-syntactic-face-function): New fun. (font-lock-defaults-alist): Use it. From David Ponce diff -r 901d871219d0 -r e5cf2302abcd lisp/font-lock.el --- 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)