Function: c-end-of-literal

c-end-of-literal is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-end-of-literal PT-S PT-SEARCH)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-end-of-literal (pt-s pt-search)
  ;; If a literal is open in the `c-semi-pp-to-literal' state PT-S, return the
  ;; end point of this literal (or point-max) assuming PT-S is valid at
  ;; PT-SEARCH.  Otherwise, return nil.
  (when (car (cddr pt-s))		; Literal start
    (let ((lit-type (cadr pt-s))
	  (lit-beg (car (cddr pt-s)))
	  ml-end-re
	  )
      (save-excursion
	(cond
	 ((eq lit-type 'string)
	  (if (and c-ml-string-opener-re
		   (c-ml-string-opener-at-or-around-point lit-beg))
	      (progn
		(setq ml-end-re
		      (funcall c-make-ml-string-closer-re-function
			       (match-string 1)))
		(goto-char (max (- pt-search (1- (length ml-end-re)))
				(point-min)))
		(re-search-forward ml-end-re nil 'stay))
	    ;; For an ordinary string, we can't use `parse-partial-sexp' since
	    ;; not all syntax-table properties have yet been set.
	    (goto-char pt-search)
	    (re-search-forward
	       "\\(?:\\\\\\(?:.\\|\n\\)\\|[^\"\n\\]\\)*[\"\n]" nil 'stay)))
	 ((memq lit-type '(c c++))
	  ;; To work around a bug in parse-partial-sexp, where effect is given
	  ;; to the syntax of a backslash, even the scan starts with point
	  ;; just after it.
	  (if (and (eq (char-before pt-search) ?\\)
		   (eq (char-after pt-search) ?\n))
	      (progn
		(c-put-char-property (1- pt-search) 'syntax-table '(1))
		(parse-partial-sexp pt-search (point-max) nil nil (car pt-s)
				    'syntax-table)
		(c-clear-char-property (1- pt-search) 'syntax-table))
	  (parse-partial-sexp pt-search (point-max) nil nil (car pt-s)
			      'syntax-table))))
	(point)))))