Function: c-invalidate-sws-region-before
c-invalidate-sws-region-before is a byte-compiled function defined in
cc-engine.el.gz.
Signature
(c-invalidate-sws-region-before BEG END)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-invalidate-sws-region-before (beg end)
;; Called from c-before-change. BEG and END are the bounds of the change
;; region, the standard parameters given to all before-change-functions.
;;
;; Note whether END is inside a comment, CPP construct, or noise macro, and
;; if so note its bounds in `c-sws-lit-limits' and type in `c-sws-lit-type'.
(setq c-sws-lit-type nil
c-sws-lit-limits nil)
(save-match-data
(save-excursion
(goto-char end)
(let* ((limits (c-literal-limits))
(lit-type (c-literal-type limits)))
(cond
((memq lit-type '(c c++))
(setq c-sws-lit-type lit-type
c-sws-lit-limits limits))
((c-beginning-of-macro)
(setq c-sws-lit-type 'pound
c-sws-lit-limits (cons (point)
(progn (c-end-of-macro) (point)))))
((eq lit-type 'string))
((setq c-sws-lit-limits (c-enclosing-c++-attribute))
(setq c-sws-lit-type 'attribute))
((progn (skip-syntax-backward "w_")
(looking-at c-noise-macro-name-re))
(setq c-sws-lit-type 'noise
c-sws-lit-limits (cons (match-beginning 1) (match-end 1))))
(t))))
(save-excursion
(goto-char beg)
(let ((attr-limits (c-enclosing-c++-attribute)))
(if attr-limits
(if (consp c-sws-lit-limits)
(setcar c-sws-lit-limits (car attr-limits))
(setq c-sws-lit-limits attr-limits))
(skip-syntax-backward "w_")
(when (looking-at c-noise-macro-name-re)
(setq c-sws-lit-type 'noise)
(if (consp c-sws-lit-limits)
(setcar c-sws-lit-limits (match-beginning 1))
(setq c-sws-lit-limits (cons (match-beginning 1)
(match-end 1))))))))))