diff options
Diffstat (limited to 'lisp/progmodes/cc-engine.el')
-rw-r--r-- | lisp/progmodes/cc-engine.el | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index cc9833a434e..622d9516e16 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -1,4 +1,4 @@ -;;; cc-engine.el --- core syntax guessing engine for CC mode -*- coding: utf-8 -*- +;;; cc-engine.el --- core syntax guessing engine for CC mode -*- lexical-binding:t; coding: utf-8 -*- ;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc. @@ -163,6 +163,8 @@ (defvar c-doc-line-join-re) (defvar c-doc-bright-comment-start-re) (defvar c-doc-line-join-end-ch) +(defvar c-syntactic-context) +(defvar c-syntactic-element) (cc-bytecomp-defvar c-min-syn-tab-mkr) (cc-bytecomp-defvar c-max-syn-tab-mkr) (cc-bytecomp-defun c-clear-syn-tab) @@ -735,6 +737,7 @@ comment at the start of cc-engine.el for more info." '(setq stack (cons (cons state saved-pos) stack))) (defmacro c-bos-pop-state (&optional do-if-done) + (declare (debug t)) `(if (setq state (car (car stack)) saved-pos (cdr (car stack)) stack (cdr stack)) @@ -759,6 +762,7 @@ comment at the start of cc-engine.el for more info." (goto-char pos) (setq sym nil))) (defmacro c-bos-save-error-info (missing got) + (declare (debug t)) `(setq saved-pos (vector pos ,missing ,got))) (defmacro c-bos-report-error () '(unless noerror @@ -1869,51 +1873,51 @@ comment at the start of cc-engine.el for more info." ; (setq in-face (point))) ; (not (eobp))))))) -(defmacro c-debug-sws-msg (&rest args) - (ignore args) +(defmacro c-debug-sws-msg (&rest _args) + ;; (declare (debug t)) ;;`(message ,@args) ) (defmacro c-put-is-sws (beg end) ;; This macro does a hidden buffer change. + (declare (debug t)) `(let ((beg ,beg) (end ,end)) (put-text-property beg end 'c-is-sws t) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-add-face beg end 'c-debug-is-sws-face))))) -(def-edebug-spec c-put-is-sws t) (defmacro c-put-in-sws (beg end) ;; This macro does a hidden buffer change. + (declare (debug t)) `(let ((beg ,beg) (end ,end)) (put-text-property beg end 'c-in-sws t) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-add-face beg end 'c-debug-in-sws-face))))) -(def-edebug-spec c-put-in-sws t) (defmacro c-remove-is-sws (beg end) ;; This macro does a hidden buffer change. + (declare (debug t)) `(let ((beg ,beg) (end ,end)) (remove-text-properties beg end '(c-is-sws nil)) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-remove-face beg end 'c-debug-is-sws-face))))) -(def-edebug-spec c-remove-is-sws t) (defmacro c-remove-in-sws (beg end) ;; This macro does a hidden buffer change. + (declare (debug t)) `(let ((beg ,beg) (end ,end)) (remove-text-properties beg end '(c-in-sws nil)) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-remove-face beg end 'c-debug-in-sws-face))))) -(def-edebug-spec c-remove-in-sws t) (defmacro c-remove-is-and-in-sws (beg end) ;; This macro does a hidden buffer change. + (declare (debug t)) `(let ((beg ,beg) (end ,end)) (remove-text-properties beg end '(c-is-sws nil c-in-sws nil)) ,@(when (facep 'c-debug-is-sws-face) '((c-debug-remove-face beg end 'c-debug-is-sws-face) (c-debug-remove-face beg end 'c-debug-in-sws-face))))) -(def-edebug-spec c-remove-is-and-in-sws t) ;; The type of literal position `end' is in a `before-change-functions' ;; function - one of `c', `c++', `pound', `noise', `attribute' or nil (but NOT @@ -2717,9 +2721,9 @@ comment at the start of cc-engine.el for more info." ;; two char construct (such as a comment opener or an escaped character).) (if (and (consp elt) (>= (length elt) 3)) ;; Inside a string or comment - (let ((depth 0) (containing nil) (last nil) + (let ((depth 0) (containing nil) in-string in-comment - (min-depth 0) com-style com-str-start (intermediate nil) + (min-depth 0) com-style com-str-start (char-1 (nth 3 elt)) ; first char of poss. 2-char construct (pos (car elt)) (type (cadr elt))) @@ -2736,14 +2740,13 @@ comment at the start of cc-engine.el for more info." (1- pos) pos)) (if (memq 'pps-extended-state c-emacs-features) - (list depth containing last + (list depth containing nil in-string in-comment nil min-depth com-style com-str-start - intermediate nil) - (list depth containing last + nil nil) + (list depth containing nil in-string in-comment nil - min-depth com-style com-str-start - intermediate))) + min-depth com-style com-str-start nil))) ;; Not in a string or comment. (if (memq 'pps-extended-state c-emacs-features) @@ -3516,6 +3519,7 @@ mhtml-mode." (defmacro c-state-cache-top-lparen (&optional cache) ;; Return the address of the top left brace/bracket/paren recorded in CACHE ;; (default `c-state-cache') (or nil). + (declare (debug t)) (let ((cash (or cache 'c-state-cache))) `(if (consp (car ,cash)) (caar ,cash) @@ -3524,6 +3528,7 @@ mhtml-mode." (defmacro c-state-cache-top-paren (&optional cache) ;; Return the address of the latest brace/bracket/paren (whether left or ;; right) recorded in CACHE (default `c-state-cache') or nil. + (declare (debug t)) (let ((cash (or cache 'c-state-cache))) `(if (consp (car ,cash)) (cdar ,cash) @@ -3532,6 +3537,7 @@ mhtml-mode." (defmacro c-state-cache-after-top-paren (&optional cache) ;; Return the position just after the latest brace/bracket/paren (whether ;; left or right) recorded in CACHE (default `c-state-cache') or nil. + (declare (debug t)) (let ((cash (or cache 'c-state-cache))) `(if (consp (car ,cash)) (cdar ,cash) @@ -4486,6 +4492,7 @@ mhtml-mode." (defmacro c-state-maybe-marker (place marker) ;; If PLACE is non-nil, return a marker marking it, otherwise nil. ;; We (re)use MARKER. + (declare (debug (form symbolp))) `(let ((-place- ,place)) (and -place- (or ,marker (setq ,marker (make-marker))) @@ -5972,6 +5979,7 @@ comment at the start of cc-engine.el for more info." ; spots and the preceding token end.") (defmacro c-debug-put-decl-spot-faces (match-pos decl-pos) + (declare (debug t)) (when (facep 'c-debug-decl-spot-face) `(c-save-buffer-state ((match-pos ,match-pos) (decl-pos ,decl-pos)) (c-debug-add-face (max match-pos (point-min)) decl-pos @@ -5979,6 +5987,7 @@ comment at the start of cc-engine.el for more info." (c-debug-add-face decl-pos (min (1+ decl-pos) (point-max)) 'c-debug-decl-spot-face)))) (defmacro c-debug-remove-decl-spot-faces (beg end) + (declare (debug t)) (when (facep 'c-debug-decl-spot-face) `(c-save-buffer-state () (c-debug-remove-face ,beg ,end 'c-debug-decl-spot-face) @@ -7773,6 +7782,7 @@ comment at the start of cc-engine.el for more info." (defvar c-last-identifier-range nil) (defmacro c-record-type-id (range) + (declare (debug t)) (if (eq (car-safe range) 'cons) ;; Always true. `(setq c-record-type-identifiers @@ -7783,6 +7793,7 @@ comment at the start of cc-engine.el for more info." (cons range c-record-type-identifiers)))))) (defmacro c-record-ref-id (range) + (declare (debug t)) (if (eq (car-safe range) 'cons) ;; Always true. `(setq c-record-ref-identifiers @@ -7808,6 +7819,7 @@ comment at the start of cc-engine.el for more info." ;; if TYPE is 'type or as a reference if TYPE is 'ref. ;; ;; This macro might do hidden buffer changes. + (declare (debug t)) `(let (res) (setq c-last-identifier-range nil) (while (if (setq res ,(if (eq type 'type) @@ -7832,6 +7844,7 @@ comment at the start of cc-engine.el for more info." ;; `c-forward-keyword-prefixed-id'. ;; ;; This macro might do hidden buffer changes. + (declare (debug t)) `(while (and (progn ,(when update-safe-pos '(setq safe-pos (point))) @@ -8775,6 +8788,7 @@ comment at the start of cc-engine.el for more info." (defmacro c-pull-open-brace (ps) ;; Pull the next open brace from PS (which has the form of paren-state), ;; skipping over any brace pairs. Returns NIL when PS is exhausted. + (declare (debug (symbolp))) `(progn (while (consp (car ,ps)) (setq ,ps (cdr ,ps))) @@ -8890,6 +8904,7 @@ comment at the start of cc-engine.el for more info." ;; a comma. If either of <symbol> or bracketed <expression> is missing, ;; throw nil to 'level. If the terminating } or ) is unmatched, throw nil ;; to 'done. This is not a general purpose macro! + (declare (debug t)) `(while (eq (char-before) ?,) (backward-char) (c-backward-syntactic-ws ,limit) @@ -9283,6 +9298,7 @@ This function might do hidden buffer changes." ;; sometimes consumes the identifier in the declaration as a type. ;; This is used to "backtrack" and make the last type be treated as ;; an identifier instead. + (declare (debug nil)) `(progn ,(unless short ;; These identifiers are bound only in the inner let. @@ -14686,18 +14702,6 @@ Cannot combine absolute offsets %S and %S in `add' method" indent))) -(def-edebug-spec c-bos-pop-state t) -(def-edebug-spec c-bos-save-error-info t) -(def-edebug-spec c-state-cache-top-lparen t) -(def-edebug-spec c-state-cache-top-paren t) -(def-edebug-spec c-state-cache-after-top-paren t) -(def-edebug-spec c-state-maybe-marker (form symbolp)) -(def-edebug-spec c-record-type-id t) -(def-edebug-spec c-record-ref-id t) -(def-edebug-spec c-forward-keyword-prefixed-id t) -(def-edebug-spec c-forward-id-comma-list t) -(def-edebug-spec c-pull-open-brace (symbolp)) - (cc-provide 'cc-engine) ;; Local Variables: |