mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
CC Mode: Fontify a cast type preceding a brace initialization
This fixes bug#81084.
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1):
In the test for a cast near the end of the function, add a test
for a {...} block which isn't a statement block, allowing such
blocks to be recognized as operands of casts.
This commit is contained in:
parent
108710992d
commit
3d9d9be3a1
1 changed files with 31 additions and 28 deletions
|
|
@ -11687,34 +11687,37 @@ This function might do hidden buffer changes."
|
||||||
(forward-char)
|
(forward-char)
|
||||||
(c-forward-syntactic-ws)
|
(c-forward-syntactic-ws)
|
||||||
(setq cast-end (point))
|
(setq cast-end (point))
|
||||||
(and (looking-at c-primary-expr-regexp)
|
(or
|
||||||
(progn
|
(and (looking-at c-primary-expr-regexp)
|
||||||
(setq pos (match-end 0))
|
(progn
|
||||||
(or
|
(setq pos (match-end 0))
|
||||||
;; Check if the expression begins with a prefix keyword.
|
(or
|
||||||
(match-beginning 2)
|
;; Check if the expression begins with a prefix keyword.
|
||||||
(if (match-beginning 1)
|
(match-beginning 2)
|
||||||
;; Expression begins with an ambiguous operator.
|
(if (match-beginning 1)
|
||||||
(cond
|
;; Expression begins with an ambiguous operator.
|
||||||
((match-beginning c-per-&*+--match)
|
(cond
|
||||||
(memq at-type '(t known found)))
|
((match-beginning c-per-&*+--match)
|
||||||
((match-beginning c-per-++---match)
|
(memq at-type '(t known found)))
|
||||||
t)
|
((match-beginning c-per-++---match)
|
||||||
((match-beginning c-per-\(-match)
|
t)
|
||||||
(or
|
((match-beginning c-per-\(-match)
|
||||||
(memq at-type '(t known found))
|
(or
|
||||||
(not inside-macro)))
|
(memq at-type '(t known found))
|
||||||
(t nil))
|
(not inside-macro)))
|
||||||
;; Unless it's a keyword, it's the beginning of a primary
|
(t nil))
|
||||||
;; expression.
|
;; Unless it's a keyword, it's the beginning of a primary
|
||||||
(not (looking-at c-keywords-regexp)))))
|
;; expression.
|
||||||
;; If `c-primary-expr-regexp' matched a nonsymbol token, check
|
(not (looking-at c-keywords-regexp)))))
|
||||||
;; that it matched a whole one so that we don't e.g. confuse
|
;; If `c-primary-expr-regexp' matched a nonsymbol token,
|
||||||
;; the operator '-' with '->'. It's ok if it matches further,
|
;; check that it matched a whole one so that we don't
|
||||||
;; though, since it e.g. can match the float '.5' while the
|
;; e.g. confuse the operator '-' with '->'. It's ok if it
|
||||||
;; operator regexp only matches '.'.
|
;; matches further, though, since it e.g. can match the float
|
||||||
(or (not (looking-at c-nonsymbol-token-regexp))
|
;; '.5' while the operator regexp only matches '.'.
|
||||||
(<= (match-end 0) pos))))
|
(or (not (looking-at c-nonsymbol-token-regexp))
|
||||||
|
(<= (match-end 0) pos)))
|
||||||
|
(and (eq (char-after) ?\{)
|
||||||
|
(not (eq (c-looking-at-statement-block-1) t)))))
|
||||||
|
|
||||||
;; There should either be a cast before it or something that isn't an
|
;; There should either be a cast before it or something that isn't an
|
||||||
;; identifier or close paren.
|
;; identifier or close paren.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue