]> git.eshelyaron.com Git - emacs.git/commit
CC Mode: Parse C++ lambda functions more correctly
authorAlan Mackenzie <acm@muc.de>
Fri, 27 Sep 2024 13:42:40 +0000 (13:42 +0000)
committerEshel Yaron <me@eshelyaron.com>
Sat, 28 Sep 2024 10:39:30 +0000 (12:39 +0200)
commit47261cb9da1363d9c96da866289c2d1b7812720e
tree1c10b4c0ea79c5710fbb528aaba96390d2c969e4
parent645f8a06d828c34a26fd20e0996517bc19d80c40
CC Mode: Parse C++ lambda functions more correctly

This fixes bug#72695.

* lisp/progmodes/cc-align.el (c-lineup-topmost-intro-cont): Do
not indent further a line following a closing brace of a
requires clause.

* lisp/progmodes/cc-engine.el (c-forward-keyword-clause):
Separate the handling of "any-paren-kwds" into
"type-paren-kwds" and "nontype-paren-kwds", simplifying the
handling of the latter.
(c-forward-primary-expression): Recognize (...) followed by {
as a primary expression.
(c-looking-at-or-maybe-in-bracelist): No longer recognize an
enum list as a brace list.  Remove the handling of enum lists.
(c-looking-at-c++-lambda-expression)
(c-backward-over-lambda-expression): New functions.
(c-c++-vsemi-p): Don't recognize the end of requires clauses as
virtual semicolons.
(c-guess-basic-syntax): CASE 5U - new cond arm to recognize
being after a requires clause.  These lines now get syntax
topmost-intro-cont rather than topmost-intro, and their anchor
positions are now on the topmost-intro line rather than the
previous topmost-intro-cont.
Throughout the file: simplify handling of
c-fun-name-substitute-key, where there is no need to check for
a following _ character, and introduce c-requires-clause-key
for greater accuracy in parsing, even though both of these are
just "requires".

* lisp/progmodes/cc-fonts.el (c-get-fontification-context):
Tidy up the handling of c-fun-name-substitue-key, as in
cc-engine.el.

* lisp/progmodes/cc-langs.el (c-lambda-spec-kwds)
(c-lambda-spec-key): New lang vars.
(c-fun-name-substitute-key): Now an adorned expression.
(c-requires-clause-kwds, c-requires-clause-key): New lang vars.

(cherry picked from commit 0a1628bf69086f85f9b983e2e62660fc90b6d568)
lisp/progmodes/cc-align.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-langs.el