From: Stefan Monnier Date: Wed, 31 Oct 2001 02:54:06 +0000 (+0000) Subject: (java-font-lock-syntactic-face-function): New fun. X-Git-Tag: ttn-vms-21-2-B4~18970 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9aa40401912b3fb44aa062f025bc7bc6962d9571;p=emacs.git (java-font-lock-syntactic-face-function): New fun. (font-lock-defaults-alist): Use it. From David Ponce --- diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 4431fc44258..e5fd64d2e45 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -526,7 +526,7 @@ and those for buffer-specialised fontification functions, 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 @@ See also `java-font-lock-extra-types'.") ;; 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)