Function: c-neutralize-CPP-line

c-neutralize-CPP-line is a byte-compiled function defined in cc-mode.el.gz.

Signature

(c-neutralize-CPP-line BEG END)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-mode.el.gz
(defun c-neutralize-CPP-line (beg end)
  ;; BEG and END bound a region, typically a preprocessor line.  Put a
  ;; "punctuation" syntax-table property on syntactically obtrusive
  ;; characters, ones which would interact syntactically with stuff outside
  ;; this region.
  ;;
  ;; These are unmatched parens/brackets/braces.  An unclosed comment is
  ;; regarded as valid, NOT obtrusive.  Unbalanced strings are handled
  ;; elsewhere.
  (save-excursion
    (let (s)
      (while
	  (progn
	    (setq s (parse-partial-sexp beg end -1))
	    (cond
	     ((< (nth 0 s) 0)		; found an unmated ),},]
	      (c-put-char-property (1- (point)) 'syntax-table '(1))
	      t)
	     ;; Unbalanced strings are now handled by
	     ;; `c-before-change-check-unbalanced-strings', etc.
	     ;; ((nth 3 s)			; In a string
	     ;;  (c-put-char-property (nth 8 s) 'syntax-table '(1))
	     ;;  t)
	     ((> (nth 0 s) 0)		; In a (,{,[
	      (c-put-char-property (nth 1 s) 'syntax-table '(1))
	      t)
	     (t nil)))))))