(< c-state-old-cpp-beg here))
(c-with-all-but-one-cpps-commented-out
c-state-old-cpp-beg
- (min c-state-old-cpp-end here)
+ c-state-old-cpp-end
(c-invalidate-state-cache-1 here))
(c-with-cpps-commented-out
(c-invalidate-state-cache-1 here))))
c-state-old-cpp-end
c-parse-state-point))))
(defun c-replay-parse-state-state ()
- (message
+ (message "%s"
(concat "(setq "
(mapconcat
(lambda (arg)
;;
;; This macro might do hidden buffer changes.
`(let (res)
+ (setq c-last-identifier-range nil)
(while (if (setq res ,(if (eq type 'type)
`(c-forward-type)
`(c-forward-name)))
(setq got-identifier (c-forward-name))
(setq name-start pos)))
- ;; Skip over type decl suffix operators.
- (while (if (looking-at c-type-decl-suffix-key)
+ ;; Skip over type decl suffix operators and trailing noise macros.
+ (while
+ (cond
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
+ (c-forward-noise-clause))
- (if (eq (char-after) ?\))
- (when (> paren-depth 0)
- (setq paren-depth (1- paren-depth))
- (forward-char)
- t)
- (when (if (save-match-data (looking-at "\\s("))
- (c-safe (c-forward-sexp 1) t)
- (goto-char (match-end 1))
- t)
- (when (and (not got-suffix-after-parens)
- (= paren-depth 0))
- (setq got-suffix-after-parens (match-beginning 0)))
- (setq got-suffix t)))
-
- ;; No suffix matched. We might have matched the
- ;; identifier as a type and the open paren of a
- ;; function arglist as a type decl prefix. In that
- ;; case we should "backtrack": Reinterpret the last
- ;; type as the identifier, move out of the arglist and
- ;; continue searching for suffix operators.
- ;;
- ;; Do this even if there's no preceding type, to cope
- ;; with old style function declarations in K&R C,
- ;; (con|de)structors in C++ and `c-typeless-decl-kwds'
- ;; style declarations. That isn't applicable in an
- ;; arglist context, though.
- (when (and (= paren-depth 1)
+ ((looking-at c-type-decl-suffix-key)
+ (if (eq (char-after) ?\))
+ (when (> paren-depth 0)
+ (setq paren-depth (1- paren-depth))
+ (forward-char)
+ t)
+ (when (if (save-match-data (looking-at "\\s("))
+ (c-safe (c-forward-sexp 1) t)
+ (goto-char (match-end 1))
+ t)
+ (when (and (not got-suffix-after-parens)
+ (= paren-depth 0))
+ (setq got-suffix-after-parens (match-beginning 0)))
+ (setq got-suffix t))))
+
+ (t
+ ;; No suffix matched. We might have matched the
+ ;; identifier as a type and the open paren of a
+ ;; function arglist as a type decl prefix. In that
+ ;; case we should "backtrack": Reinterpret the last
+ ;; type as the identifier, move out of the arglist and
+ ;; continue searching for suffix operators.
+ ;;
+ ;; Do this even if there's no preceding type, to cope
+ ;; with old style function declarations in K&R C,
+ ;; (con|de)structors in C++ and `c-typeless-decl-kwds'
+ ;; style declarations. That isn't applicable in an
+ ;; arglist context, though.
+ (when (and (= paren-depth 1)
(not got-prefix-before-parens)
(not (eq at-type t))
(or backup-at-type
(eq (char-before pos) ?\)))
(c-fdoc-shift-type-backward)
(goto-char pos)
- t))
+ t)))
(c-forward-syntactic-ws))
(not (looking-at "=")))))
b-pos)))
-(defun c-backward-colon-prefixed-type ()
- ;; We're at the token after what might be a type prefixed with a colon. Try
- ;; moving backward over this type and the colon. On success, return t and
- ;; leave point before colon; on failure, leave point unchanged. Will clobber
- ;; match data.
+(defun c-backward-typed-enum-colon ()
+ ;; We're at a "{" which might be the opening brace of a enum which is
+ ;; strongly typed (by a ":" followed by a type). If this is the case, leave
+ ;; point before the colon and return t. Otherwise leave point unchanged and return nil.
+ ;; Match data will be clobbered.
(let ((here (point))
(colon-pos nil))
(save-excursion
(or (not (looking-at "\\s)"))
(c-go-up-list-backward))
(cond
- ((eql (char-after) ?:)
+ ((and (eql (char-after) ?:)
+ (save-excursion
+ (c-backward-syntactic-ws)
+ (c-on-identifier)))
(setq colon-pos (point))
(forward-char)
(c-forward-syntactic-ws)
(let ((here (point))
up-sexp-pos before-identifier)
(when c-recognize-post-brace-list-type-p
- (c-backward-colon-prefixed-type))
+ (c-backward-typed-enum-colon))
(while
(and
(eq (c-backward-token-2) 0)