Function: c-parse-quotes-after-change

c-parse-quotes-after-change is a byte-compiled function defined in cc-mode.el.gz.

Signature

(c-parse-quotes-after-change BEG END OLD-LEN)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-mode.el.gz
(defun c-parse-quotes-after-change (_beg _end _old-len)
  ;; This function applies syntax-table properties (value '(1)) and
  ;; c-digit-separator properties as needed to 's within the range (c-new-BEG
  ;; c-new-END).  This operation is performed even within strings and
  ;; comments.
  ;;
  ;; This function is called exclusively as an after-change function via the
  ;; variable `c-before-font-lock-functions'.
  (c-save-buffer-state (num-beg num-end case-fold-search)
    ;; Apply the needed syntax-table and c-digit-separator text properties to
    ;; quotes.
    (save-restriction
      (goto-char c-new-BEG)
      (while (and (< (point) c-new-END)
		  (search-forward "'" c-new-END 'limit))
	(cond ((c-is-escaped (1- (point)))) ; not a real '.
	      ((c-quoted-number-straddling-point)
	       (setq num-beg (match-beginning 0)
		     num-end (match-end 0))
	       (c-put-syntax-table-properties-on-char-trim-caches
		num-beg num-end '(1) ?')
	       (c-put-char-properties-on-char num-beg num-end
					      'c-digit-separator t ?')
	       (goto-char num-end))
	      ((looking-at
		"\\([^\\']\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][[:xdigit:]]+\\|.\\)\
\\)'") ; balanced quoted expression.
	       (goto-char (match-end 0)))
	      ((looking-at "\\\\'")	; Anomalous construct.
	       (c-truncate-lit-pos/state-cache (1- (point)))
	       (c-put-syntax-table-properties-on-char-trim-caches
		(1- (point)) (+ (point) 2) '(1) ?'))
	      (t
	       (c-put-syntax-table-trim-caches (1- (point)) '(1))))
	;; Prevent the next `c-quoted-number-straddling-point' getting
	;; confused by already processed single quotes.
	(narrow-to-region (point) (point-max))))))