;; in XEmacs 21.4.4. acm 2002/9/19.
(defconst awk-font-lock-keywords
(eval-when-compile
- (list
- ;; Function declarations.
- `(,(c-make-font-lock-search-function
+ `(
+ ;; Function declarations.
+ (,(c-make-font-lock-search-function
"^\\s *\\(func\\(tion\\)?\\)\\s +\\(\\(\\sw+\\(::\\sw+\\)?\\)\\s *\\)?\\(([^()]*)\\)?"
'(1 'font-lock-keyword-face t)
;; We can't use LAXMATCH in `c-make-font-lock-search-function', so....
nil))))
;; Variable names.
- (cons
- (concat "\\<"
- (regexp-opt
- '("ARGC" "ARGIND" "ARGV" "BINMODE" "CONVFMT" "ENVIRON"
- "ERRNO" "FIELDWIDTHS" "FILENAME" "FNR" "FPAT" "FS" "FUNCTAB"
- "IGNORECASE" "LINT" "NF" "NR" "OFMT" "OFS" "ORS" "PREC"
- "PROCINFO" "RLENGTH" "ROUNDMODE" "RS" "RSTART" "RT" "SUBSEP"
- "SYMTAB" "TEXTDOMAIN") t) "\\>")
- 'font-lock-variable-name-face)
+ ,(cons
+ (concat "\\<"
+ (regexp-opt
+ '("ARGC" "ARGIND" "ARGV" "BINMODE" "CONVFMT" "ENVIRON"
+ "ERRNO" "FIELDWIDTHS" "FILENAME" "FNR" "FPAT" "FS" "FUNCTAB"
+ "IGNORECASE" "LINT" "NF" "NR" "OFMT" "OFS" "ORS" "PREC"
+ "PROCINFO" "RLENGTH" "ROUNDMODE" "RS" "RSTART" "RT" "SUBSEP"
+ "SYMTAB" "TEXTDOMAIN") t) "\\>")
+ 'font-lock-variable-name-face)
;; Special file names. (acm, 2002/7/22)
;; The following regexp was created by first evaluating this in GNU Emacs 21.1:
;; regexp so that a " must come before, and either a " or heuristic stuff after.
;; The surrounding quotes are fontified along with the filename, since, semantically,
;; they are an indivisible unit.
- '("\\(\"/dev/\\(fd/[0-9]+\\|p\\(\\(\\(gr\\)?p\\)?id\\)\\|\
+ ("\\(\"/dev/\\(fd/[0-9]+\\|p\\(\\(\\(gr\\)?p\\)?id\\)\\|\
std\\(err\\|in\\|out\\)\\|user\\)\\)\\>\
\\(\\(\"\\)\\|\\([^\"/\n\r][^\"\n\r]*\\)?$\\)"
(1 font-lock-variable-name-face t)
;; , replacing "lport", "rhost", and "rport" with "[[:alnum:]]+".
;; This cannot be combined with the above pattern, because the match number
;; for the (optional) closing \" would then exceed 9.
- '("\\(\"/inet[46]?/\\(\\(raw\\|\\(tc\\|ud\\)p\\)/[[:alnum:]]+/[[:alnum:]]+/[[:alnum:]]+\\)\\)\\>\
+ ("\\(\"/inet[46]?/\\(\\(raw\\|\\(tc\\|ud\\)p\\)/[[:alnum:]]+/[[:alnum:]]+/[[:alnum:]]+\\)\\)\\>\
\\(\\(\"\\)\\|\\([^\"/\n\r][^\"\n\r]*\\)?$\\)"
(1 font-lock-variable-name-face t)
(6 font-lock-variable-name-face t t))
;; Keywords.
- (concat "\\<"
- (regexp-opt
- '("BEGIN" "BEGINFILE" "END" "ENDFILE"
- "break" "case" "continue" "default" "delete"
- "do" "else" "exit" "for" "getline" "if" "in" "next"
- "nextfile" "return" "switch" "while")
- t) "\\>")
+ ,(concat "\\<"
+ (regexp-opt
+ '("BEGIN" "BEGINFILE" "END" "ENDFILE"
+ "break" "case" "continue" "default" "delete"
+ "do" "else" "exit" "for" "getline" "if" "in" "next"
+ "nextfile" "return" "switch" "while")
+ t) "\\>")
;; Builtins.
- `(eval . (list
+ (eval . (list
,(concat
"\\<"
(regexp-opt
"\\>")
0 c-preprocessor-face-name))
- ;; Directives
- `(eval . '("@\\(include\\|load\\|namespace\\)\\>" 0 ,c-preprocessor-face-name))
+ ;; Directives
+ (eval . '("@\\(include\\|load\\|namespace\\)\\>" 0 ,c-preprocessor-face-name))
- ;; gawk debugging keywords. (acm, 2002/7/21)
- ;; (Removed, 2003/6/6. These functions are now fontified as built-ins)
- ;; (list (concat "\\<" (regexp-opt '("adump" "stopme") t) "\\>")
- ;; 0 'font-lock-warning-face)
+ ;; gawk debugging keywords. (acm, 2002/7/21)
+ ;; (Removed, 2003/6/6. These functions are now fontified as built-ins)
+ ;; (list (concat "\\<" (regexp-opt '("adump" "stopme") t) "\\>")
+ ;; 0 'font-lock-warning-face)
- ;; User defined functions with an apparent spurious space before the
- ;; opening parenthesis. acm, 2002/5/30.
- `(,(concat "\\(\\w\\|_\\)" c-awk-escaped-nls* "\\s "
+ ;; User defined functions with an apparent spurious space before the
+ ;; opening parenthesis. acm, 2002/5/30.
+ (,(concat "\\(\\w\\|_\\)" c-awk-escaped-nls* "\\s "
c-awk-escaped-nls*-with-space* "(")
(0 'font-lock-warning-face))
- ;; Double :: tokens, or the same with space(s) around them.
- #'c-awk-font-lock-invalid-namespace-separators
+ ;; Double :: tokens, or the same with space(s) around them.
+ c-awk-font-lock-invalid-namespace-separators
- ;; Space after \ in what looks like an escaped newline. 2002/5/31
- '("\\\\\\s +$" 0 font-lock-warning-face t)
+ ;; Space after \ in what looks like an escaped newline. 2002/5/31
+ ("\\\\\\s +$" 0 font-lock-warning-face t)
- ;; Unbalanced string (") or regexp (/) delimiters. 2002/02/16.
- '("\\s|" 0 font-lock-warning-face t nil)
- ;; gawk 3.1 localizable strings ( _"translate me!"). 2002/5/21
- '("\\(_\\)\\s|" 1 font-lock-warning-face)
- '("\\(_\\)\\s\"" 1 font-lock-string-face) ; FIXME! not for XEmacs. 2002/10/6
- ))
+ ;; Unbalanced string (") or regexp (/) delimiters. 2002/02/16.
+ ("\\s|" 0 font-lock-warning-face t nil)
+ ;; gawk 3.1 localizable strings ( _"translate me!"). 2002/5/21
+ ("\\(_\\)\\s|" 1 font-lock-warning-face)
+ ,@(unless (featurep 'xemacs)
+ '(("\\(_\\)\\s\"" 1 font-lock-string-face)))
+ ))
"Default expressions to highlight in AWK mode.")
\f
;; ACM 2002/9/29. Movement functions, e.g. for C-M-a and C-M-e
(subrp (symbol-function 'mapcan)))
;; XEmacs and Emacs >= 26.
`(mapcan ,fun ,liszt))
- ((eq c--cl-library 'cl-lib)
- ;; Emacs >= 24.3, < 26.
- `(cl-mapcan ,fun ,liszt))
+ ;; The following was commented out on 2025-06-02. cl-mapcan fails in an
+ ;; obscure fashion in c-keywords-obarray. See that c-lang-defvar for
+ ;; details.
+ ;; ((eq c--cl-library 'cl-lib)
+ ;; ;; Emacs >= 24.3, < 26.
+ ;; `(cl-mapcan ,fun ,liszt))
(t
;; Emacs <= 24.2. It would be nice to be able to distinguish between
;; compile-time and run-time use here.
(defmacro c--set-difference (liszt1 liszt2 &rest other-args)
;; Macro to smooth out the renaming of `set-difference' in Emacs 24.3.
(declare (debug (form form &rest [symbolp form])))
- (if (eq c--cl-library 'cl-lib)
- `(cl-set-difference ,liszt1 ,liszt2 ,@other-args)
- `(set-difference ,liszt1 ,liszt2 ,@other-args)))
+ (if (fboundp 'set-difference)
+ `(set-difference ,liszt1 ,liszt2 ,@other-args)
+ `(cl-set-difference ,liszt1 ,liszt2 ,@other-args)))
(defmacro c--intersection (liszt1 liszt2 &rest other-args)
;; Macro to smooth out the renaming of `intersection' in Emacs 24.3.
(declare (debug (form form &rest [symbolp form])))
- (if (eq c--cl-library 'cl-lib)
- `(cl-intersection ,liszt1 ,liszt2 ,@other-args)
- `(intersection ,liszt1 ,liszt2 ,@other-args)))
+ (if (fboundp 'intersection)
+ `(intersection ,liszt1 ,liszt2 ,@other-args)
+ `(cl-intersection ,liszt1 ,liszt2 ,@other-args)))
(eval-and-compile
(defmacro c--macroexpand-all (form &optional environment)
(defmacro c--delete-duplicates (cl-seq &rest cl-keys)
;; Macro to smooth out the renaming of `delete-duplicates' in Emacs 24.3.
(declare (debug (form &rest [symbolp form])))
- (if (eq c--cl-library 'cl-lib)
- `(cl-delete-duplicates ,cl-seq ,@cl-keys)
- `(delete-duplicates ,cl-seq ,@cl-keys))))
+ (if (fboundp 'delete-duplicates)
+ `(delete-duplicates ,cl-seq ,@cl-keys)
+ `(cl-delete-duplicates ,cl-seq ,@cl-keys))))
(defmacro c-font-lock-flush (beg end)
"Declare the region BEG...END's fontification as out-of-date.
((and (< -from- -to-)
(get-text-property -from- ,property))
-from-)
- ((< (setq pos (next-single-property-change -from- ,property nil -to-))
+ ((< (setq pos (c-next-single-property-change -from- ,property nil -to-))
-to-)
pos)
(most-positive-fixnum))))
; comment delimiters are 2
; chars long.
(or (get-text-property end 'c-in-sws)
- (next-single-property-change end 'c-in-sws nil
- (cdr c-sws-lit-limits))
+ (c-next-single-property-change end 'c-in-sws nil
+ (cdr c-sws-lit-limits))
(get-text-property end 'c-is-sws)
- (next-single-property-change end 'c-is-sws nil
- (cdr c-sws-lit-limits))))
+ (c-next-single-property-change end 'c-is-sws nil
+ (cdr c-sws-lit-limits))))
(cdr c-sws-lit-limits))))
(defun c-invalidate-sws-region-after-ins (end)
limits (cons (point)
(progn (c-end-of-macro) (point)))))
(when (memq lit-type '(c c++ pound))
- (let ((next-in (next-single-property-change (car limits) 'c-in-sws
- nil (cdr limits)))
- (next-is (next-single-property-change (car limits) 'c-is-sws
- nil (cdr limits))))
+ (let ((next-in (c-next-single-property-change (car limits) 'c-in-sws
+ nil (cdr limits)))
+ (next-is (c-next-single-property-change (car limits) 'c-is-sws
+ nil (cdr limits))))
(and (or next-in next-is)
(cdr limits)))))))
;; Skip simple ws and do a quick check on the following character to see
;; if it's anything that can't start syntactic ws, so we can bail out
;; early in the majority of cases when there just are a few ws chars.
- (c-skip-ws-chars-forward " \t\n\r\f\v")
+ (c-skip-ws-chars-forward " \t\n\r\f\v ")
(when (or (looking-at c-syntactic-ws-start)
(and c-opt-cpp-prefix
(looking-at c-noise-macro-name-re))
'c-is-sws t))
;; Find the last rung position to avoid setting properties in all
;; the cases when the marked rung is complete.
- ;; (`next-single-property-change' is certain to move at least one
+ ;; (`c-next-single-property-change' is certain to move at least one
;; step forward.)
(setq rung-pos (1- (c-next-single-property-change
rung-is-marked 'c-is-sws nil rung-end-pos)))
;; If the `c-in-sws' region extended past the last
;; `c-is-sws' char we have to go back a bit.
(or (get-text-property (1- (point)) 'c-is-sws)
- (goto-char (previous-single-property-change
+ (goto-char (c-previous-single-property-change
(point) 'c-is-sws)))
(backward-char))
rung-pos (point) (point-max))
(setq rung-pos (point))
- (and (> (c-skip-ws-chars-forward " \t\n\r\f\v") 0)
+ (and (> (c-skip-ws-chars-forward " \t\n\r\f\v ") 0)
(not (eobp))))
;; We'll loop here if there is simple ws after the last rung.
(and c-opt-cpp-prefix
(looking-at c-opt-cpp-start)
(setq macro-start (point))
- (progn (c-skip-ws-chars-backward " \t")
+ (progn (c-skip-ws-chars-backward " \t ")
(bolp))
(or (bobp)
(progn (backward-char)
;; We've searched over a piece of non-white syntactic ws. See if this
;; can be cached.
(setq next-rung-pos (point))
- (c-skip-ws-chars-forward " \t\n\r\f\v")
+ (c-skip-ws-chars-forward " \t\n\r\f\v ")
(setq rung-end-pos (min (1+ (point)) (point-max)))
(if (or
;; bail out early in the majority of cases when there just are a few ws
;; chars. Newlines are complicated in the backward direction, so we can't
;; skip over them.
- (c-skip-ws-chars-backward " \t\f")
+ (c-skip-ws-chars-backward " \t\f ")
(when (and (not (bobp))
(save-excursion
(or (and
(setq simple-ws-beg (or attr-end ; After attribute.
(match-end 1) ; Noise macro, etc.
(match-end 0))) ; c-syntactic-ws-end
- (c-skip-ws-chars-backward " \t\n\r\f\v")
+ (c-skip-ws-chars-backward " \t\n\r\f\v ")
(if (setq rung-is-marked (text-property-any
(point) (min (1+ rung-pos) (point-max))
'c-is-sws t))
;; The following search is the main reason that `c-in-sws'
;; and `c-is-sws' aren't combined to one property.
- (goto-char (previous-single-property-change
+ (goto-char (c-previous-single-property-change
(point) 'c-in-sws nil (point-min)))
(unless (get-text-property (point) 'c-is-sws)
;; If the `c-in-sws' region extended past the first
(point) rung-pos (point-min))
(setq rung-pos (point))
- (if (and (< (min (c-skip-ws-chars-backward " \t\f\v")
+ (if (and (< (min (c-skip-ws-chars-backward " \t\f\v ")
(progn
(setq simple-ws-beg (point))
- (c-skip-ws-chars-backward " \t\n\r\f\v")))
+ (c-skip-ws-chars-backward " \t\n\r\f\v ")))
0)
(setq rung-is-marked
(text-property-any (point) rung-pos
;; the macro, and then `simple-ws-beg' must be kept on the
;; same side of those comments.
(goto-char simple-ws-beg)
- (c-skip-ws-chars-backward " \t\n\r\f\v")
+ (c-skip-ws-chars-backward " \t\n\r\f\v ")
(if (eq (char-before) ?\\)
(forward-char))
(forward-line 1)
t)))
((/= (save-excursion
- (c-skip-ws-chars-forward " \t\n\r\f\v" simple-ws-beg)
+ (c-skip-ws-chars-forward " \t\n\r\f\v " simple-ws-beg)
(setq next-rung-pos (point)))
simple-ws-beg)
;; Skipped over comments. Must put point at the end of
;; We've searched over a piece of non-white syntactic ws. See if this
;; can be cached.
(setq next-rung-pos (point))
- (c-skip-ws-chars-backward " \t\f\v")
-
+ (c-skip-ws-chars-backward " \t\f\v ")
+
(if (or
;; Cache if we started either from a marked rung or from a
;; completely uncached position.
;; Cache if there's a marked rung in the encountered simple ws.
(save-excursion
- (c-skip-ws-chars-backward " \t\n\r\f\v")
+ (c-skip-ws-chars-backward " \t\n\r\f\v ")
(text-property-any (point) (min (1+ next-rung-pos) (point-max))
'c-is-sws t)))
;; inside a comment?
(while (and (not (bobp))
(c-got-face-at (1- (point)) c-literal-faces))
- (goto-char (previous-single-property-change
+ (goto-char (c-previous-single-property-change
(point) 'face nil (point-min)))) ; No limit. FIXME, perhaps? 2020-12-07.
;; Don't trust the literal to contain only literal faces
(goto-char start-in-literal)
(goto-char cfd-start-pos)
(while (progn
- (goto-char (previous-single-property-change
+ (goto-char (c-previous-single-property-change
(point) 'c-type nil start-in-literal))
(and (> (point) start-in-literal)
(not (eq (c-get-char-property (point) 'c-type)
(>= (point) (cadar string-delims))
(or (not (cdr string-delims))
(< (point) (cadr string-delims))))
- (if (cdr string-delims)
- (goto-char (cadr string-delims))
- (if (equal (c-get-char-property (1- (cadar string-delims))
- 'syntax-table)
- '(15)) ; "Always" the case.
- ;; The next search should be successful for an unterminated ml
- ;; string inside a macro, but not for any other unterminated
- ;; string.
- (progn
- (or (c-search-forward-char-property 'syntax-table '(15) limit)
- (goto-char limit))
- (setq string-delims nil))
- (c-benign-error "Missing '(15) syntax-table property at %d"
+ (cond
+ ((cdr string-delims)
+ (goto-char (cadr string-delims)))
+ ((equal (c-get-char-property (1- (cadar string-delims))
+ 'syntax-table)
+ '(15)) ; "Always" the case.
+ ;; The next search should be successful for an unterminated ml
+ ;; string inside a macro, but not for any other unterminated
+ ;; string.
+ (or (c-search-forward-char-property 'syntax-table '(15) limit)
+ (goto-char limit))
+ (setq string-delims nil))
+ (t (c-benign-error "Messing '(15) syntax-table property at %d"
(1- (cadar string-delims)))
(setq string-delims nil))))
((and string-delims
(cdr string-delims)
(>= (point) (cadr string-delims)))
- (c-put-font-lock-face (cadr string-delims) (1+ (cadr string-delims))
- 'font-lock-string-face)
- (c-remove-font-lock-face (1+ (cadr string-delims))
- (caddr string-delims))
+ (unless (featurep 'xemacs)
+ (c-put-font-lock-face (cadr string-delims) (1+ (cadr string-delims))
+ 'font-lock-string-face))
+ (c-remove-font-lock-face
+ (if (featurep 'xemacs)
+ (cadr string-delims)
+ (1+ (cadr string-delims)))
+ (caddr string-delims))
(goto-char (caddr string-delims))
(setq string-delims nil))
(if (cdr string-delims)
(progn
(c-remove-font-lock-face (caar string-delims)
- (1- (cadar string-delims)))
- (c-put-font-lock-face (1- (cadar string-delims))
- (cadar string-delims)
- 'font-lock-string-face))
+ (cadar string-delims))
+ (unless (featurep 'xemacs)
+ (c-put-font-lock-face (1- (cadar string-delims))
+ (cadar string-delims)
+ 'font-lock-string-face)))
(c-put-font-lock-face (caar string-delims) (cadar string-delims)
'font-lock-warning-face))
(goto-char (cadar string-delims)))))
(modify-syntax-entry ?& "." table)
(modify-syntax-entry ?| "." table)
(modify-syntax-entry ?\' "\"" table)
- (modify-syntax-entry ?\240 "." table)
+ (modify-syntax-entry ?\240 " " table)
;; Set up block and line oriented comments. The new C
;; standard mandates both comment styles even in C, so since
(end1
(or (and (eq (get-text-property end 'face)
'font-lock-comment-face)
- (previous-single-property-change end 'face))
+ (c-previous-single-property-change end 'face))
end)))
(when (>= end1 beg) ; Don't hassle about changes entirely in
; comments.
(setq type-pos
(if (get-text-property (1- end1) 'c-type)
end1
- (previous-single-property-change end1 'c-type
- nil lim))))
+ (c-previous-single-property-change end1 'c-type
+ nil lim))))
(setq type (get-text-property (max (1- type-pos) lim) 'c-type))
(when (memq type '(c-decl-id-start c-decl-type-start))