Function: c-awk-set-string-regexp-syntax-table-properties

c-awk-set-string-regexp-syntax-table-properties is a byte-compiled function defined in cc-awk.el.gz.

Signature

(c-awk-set-string-regexp-syntax-table-properties BEG END)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-awk.el.gz
;; ACM, 2002/02/15: The idea of the next function is to put the "Error font"
;; on strings/regexps which are missing their closing delimiter.
;; 2002/4/28.  The default syntax for / has been changed from "string" to
;; "punctuation", to reduce hassle when this character appears within a string
;; or comment.

(defun c-awk-set-string-regexp-syntax-table-properties (beg end)
;; BEG and END bracket a (possibly unterminated) string or regexp.  The
;; opening delimiter is after BEG, and the closing delimiter, IF ANY, is AFTER
;; END.  Set the appropriate syntax-table properties on the delimiters and
;; contents of this string/regex.
;;
;; "String" here can also mean a gawk 3.1 "localizable" string which starts
;; with _".  In this case, we step over the _ and ignore it; It will get it's
;; font from an entry in awk-font-lock-keywords.
;;
;; If the closing delimiter is missing (i.e., there is an EOL there) set the
;; STRING-FENCE property on the opening " or / and closing EOL.
;;
;; This function does hidden buffer changes.
  (if (eq (char-after beg) ?_) (setq beg (1+ beg)))

  ;; First put the properties on the delimiters.
  (cond ((eq end (point-max))		; string/regexp terminated by EOB
	 (c-put-string-fence-trim-caches beg))
	((/= (char-after beg) (char-after end)) ; missing end delimiter
	 (c-put-string-fence-trim-caches beg)
	 (c-put-string-fence end))
	((eq (char-after beg) ?/)	; Properly bracketed regexp
	 (c-put-syntax-table-trim-caches beg '(7)) ; (7) = "string"
	 (c-put-char-property end 'syntax-table '(7)))
	(t))			; Properly bracketed string: Nothing to do.
  ;; Now change the properties of any escaped "s in the string to punctuation.
  (save-excursion
    (goto-char (1+ beg))
    (or (eobp)
	(while (search-forward "\"" end t)
	  (c-put-syntax-table-trim-caches (1- (point)) '(1))))))