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

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

Signature

(c-awk-set-syntax-table-properties LIM)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-awk.el.gz
            (t nil)))))                 ; Unterminated regexp at EOB

(defun c-awk-set-syntax-table-properties (lim)
;;     Scan the buffer text between point and LIM, setting (and clearing) the
;; syntax-table property where necessary.
;;
;; This function is designed to be called as the FUNCTION in a MATCHER
;; in font-lock-syntactic-keywords, and it always returns NIL (to
;; inhibit repeated calls from font-lock: See elisp info page
;; "Search-based Fontification").  (2015-11-24: CC Mode doesn't use
;; `font-lock-syntactic-keywords' and hasn't done for a very long
;; time, if ever.  ACM.)  This function gets called, with a bit of
;; glue, from after-change-functions whether or not font-lock is
;; active.  Point is left "undefined" after this function exits.  THE
;; BUFFER SHOULD HAVE BEEN WIDENED, AND ANY PRECIOUS MATCH-DATA SAVED
;; BEFORE CALLING THIS ROUTINE.
;;
;; We need to set/clear the syntax-table property on:
;; (i) / - It is set to "string" on a / which is the opening or closing
;;     delimiter of the properly terminated regexp (and left unset on a
;;     division sign).
;; (ii) the opener of an unterminated string/regexp, we set the property
;;    "generic string delimiter" on both the opening " or / and the end of the
;;    line where the closing delimiter is missing.
;; (iii) "s inside strings/regexps (these will all be escaped "s).  They are
;;   given the property "punctuation".  This will later allow other routines
;;   to use the regexp "\\S\"*" to skip over the string innards.
;; (iv) Inside a comment, all syntax-table properties are cleared.
;;
;; This function does hidden buffer changes.
  (let (anchor
	(anchor-state-/div nil)) ; t means a following / would be a div sign.
    (c-awk-beginning-of-logical-line) ; ACM 2002/7/21.  This is probably redundant.
    (c-clear-syntax-table-properties-trim-caches (point) lim)
    ;; Once round the next loop for each string, regexp, or div sign
    (while (progn
             ;; Skip any "harmless" lines before the next tricky one.
             (if (search-forward-regexp c-awk-harmless-lines+-here-re nil t)
                 (setq anchor-state-/div nil))
             (< (point) lim))
      (setq anchor (point))
      (search-forward-regexp c-awk-harmless-string*-here-re nil t)
      ;; We are now looking at either a " or a / or a brace/paren/semicolon.
      ;; Do our thing on the string, regexp or division sign or update
      ;; our state.
      (setq anchor-state-/div
	    (cond
	     ((looking-at "_?\"")
	      (c-awk-syntax-tablify-string))
	     ((eq (char-after) ?/)
	      (c-awk-syntax-tablify-/ anchor anchor-state-/div))
	     ((memq (char-after) '(?{ ?} ?\( ?\;))
	      (forward-char)
	      nil)
	     (t                         ; ?\)
	      (forward-char)
	      t))))
    nil))