Function: c-font-lock-invalid-single-quotes

c-font-lock-invalid-single-quotes is a byte-compiled function defined in cc-fonts.el.gz.

Signature

(c-font-lock-invalid-single-quotes LIMIT)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-fonts.el.gz
(defun c-font-lock-invalid-single-quotes (limit)
  ;; This function will be called from font-lock for a region bounded by POINT
  ;; and LIMIT, as though it were to identify a keyword for
  ;; font-lock-keyword-face.  It always returns NIL to inhibit this and
  ;; prevent a repeat invocation.  See elisp/lispref page "Search-based
  ;; Fontification".
  ;;
  ;; This function fontifies invalid single quotes with
  ;; `font-lock-warning-face'.  These are the single quotes which
  ;; o - aren't inside a literal;
  ;; o - are marked with a syntax-table text property value '(1); and
  ;; o - are NOT marked with a non-null c-digit-separator property.
  (let ((limits (c-literal-limits))
	state beg end)
    (if limits
	(goto-char (cdr limits)))	; Even for being in a ' '
    (while (< (point) limit)
      (setq beg (point))
      (setq state (parse-partial-sexp (point) limit nil nil nil 'syntax-table))
      (setq end (point))
      (goto-char beg)
      (while (progn (skip-chars-forward "^'" end)
		    (< (point) end))
	(if (and (equal (c-get-char-property (point) 'syntax-table) '(1))
		 (not (c-get-char-property (point) 'c-digit-separator)))
	    (c-put-font-lock-face (point) (1+ (point)) 'font-lock-warning-face))
	(forward-char))
      (parse-partial-sexp end limit nil nil state 'syntax-table)))
    nil)