(make-variable-buffer-local 'c-parse-state-state)
(defun c-record-parse-state-state ()
(setq c-parse-state-point (point))
+ (when (markerp (cdr (assq 'c-state-old-cpp-beg c-parse-state-state)))
+ (move-marker (cdr (assq 'c-state-old-cpp-beg c-parse-state-state)) nil)
+ (move-marker (cdr (assq 'c-state-old-cpp-end c-parse-state-state)) nil))
(setq c-parse-state-state
(mapcar
(lambda (arg)
nil
(cond ((looking-at c-keywords-regexp)
(c-forward-keyword-clause 1))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause)))))
- (when (memq res '(t known found prefix))
- ,(when (eq type 'ref)
- `(when c-record-type-identifiers
- (c-record-ref-id c-last-identifier-range)))
+ (when (memq res '(t known found prefix maybe))
+ (when c-record-type-identifiers
+ ,(if (eq type 'type)
+ `(c-record-type-id c-last-identifier-range)
+ `(c-record-ref-id c-last-identifier-range)))
t)))
(defmacro c-forward-id-comma-list (type update-safe-pos)
(eq (char-after) ?<))
;; Maybe an angle bracket arglist.
(when (let ((c-record-type-identifiers t)
- (c-record-found-types t))
+ (c-record-found-types t)
+ (c-last-identifier-range))
(c-forward-<>-arglist nil))
- (c-add-type start (1+ pos))
(c-forward-syntactic-ws)
- (setq pos (point)
- c-last-identifier-range nil)
+ (unless (eq (char-after) ?\()
+ (setq c-last-identifier-range nil)
+ (c-add-type start (1+ pos)))
+ (setq pos (point))
(if (and c-opt-identifier-concat-key
(looking-at c-opt-identifier-concat-key))
(c-forward-syntactic-ws)
t)
- (when (and c-record-type-identifiers id-start)
+ (when (and c-record-type-identifiers id-start
+ (not (eq (char-after) ?\()))
(c-record-type-id (cons id-start id-end)))
(setq res 'template)
nil)))
(while (cond
((looking-at c-decl-hangon-key)
(c-forward-keyword-clause 1))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(setq pos (point))
;; It's an identifier that might be a type.
'maybe))))
((eq name-res 'template)
- ;; A template is a type.
+ ;; A template is sometimes a type.
(goto-char id-end)
- (setq res t))
+ (c-forward-syntactic-ws)
+ (setq res
+ (if (eq (char-after) ?\()
+ (if (c-check-type id-start id-end)
+ ;; It's an identifier that has been used as
+ ;; a type somewhere else.
+ 'found
+ ;; It's an identifier that might be a type.
+ 'maybe)
+ t)))
(t
;; Otherwise it's an operator identifier, which is not a type.
(goto-char start)
(cond
((looking-at c-decl-hangon-key)
(c-forward-keyword-clause 1))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))
((and (looking-at c-type-decl-prefix-key)
(if (and (c-major-mode-is 'c++-mode)
(while (cond
((looking-at c-decl-hangon-key)
(c-forward-keyword-clause 1))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(<= (point) limit))
(save-excursion
(c-forward-keyword-clause 1)
(setq kwd-clause-end (point))))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(setq noise-start (point))
(c-forward-noise-clause)
(setq kwd-clause-end (point))))
(while
(cond ((looking-at c-decl-hangon-key)
(c-forward-keyword-clause 1))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(setq id-start (point)))
((eq (char-after) ?\()
(and (eq (c-backward-token-2) 0)
(or (looking-at c-decl-hangon-key)
- (looking-at c-noise-macro-with-parens-name-re))))
+ (and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re)))))
((and c-recognize-<>-arglists
(eq (char-after) ?<)
(while (cond
((looking-at c-specifier-key)
(c-forward-keyword-clause 1))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(setq placeholder (c-point 'boi))
(or (consp special-brace-list)
(while (cond
((looking-at c-specifier-key)
(c-forward-keyword-clause 1))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(c-add-syntax 'defun-open (c-point 'boi))
;; Bogus to use bol here, but it's the legacy. (Resolved,
(while (cond
((looking-at c-specifier-key)
(c-forward-keyword-clause 1))
- ((looking-at c-noise-macro-with-parens-name-re)
+ ((and c-opt-cpp-prefix
+ (looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(c-add-syntax 'brace-list-open (c-point 'boi))))