]> git.eshelyaron.com Git - emacs.git/commit
Adapt CC Mode for C++11 uniform initialization.
authorAlan Mackenzie <acm@muc.de>
Sun, 21 Aug 2016 16:00:15 +0000 (16:00 +0000)
committerAlan Mackenzie <acm@muc.de>
Sun, 21 Aug 2016 16:00:15 +0000 (16:00 +0000)
commit578d9aaf82b386c1a0316dde491d297e18e10636
tree30a22babe6bd420a0462b8c6d227e7239583e0bb
parent1f7302563ae03e20e0a2f90a950c164f8bc17941
Adapt CC Mode for C++11 uniform initialization.

For fontification, introduce a new "context", 'non-decl, to be used for
brace
lists; also a new value for the property 'c-type, called 'c-not-decl.

* lisp/progmodes/cc-engine.el (c-back-over-compound-identifier): Check that
an ostensible symbol we're going to move over isn't a keyword.
(c-forward-decl-or-cast-1): CASE 1: Where we have two consecutive identifiers
(hence a declaration), and an unmatched open paren, perform
c-fdoc-shift-type-backwards to recognize the partial construct correctly.
Whilst checking a type decl expression, check for and handle C++11's "copy
initialization", where we have <type>(<constant>).  Recognize
<id><id>(... (where the paren is unclosed) as a declaration.
(c-looking-at-or-maybe-in-bracelist): New function, extracted from
c-inside-bracelist-p.  Recognize as bracelists "{"s which are preceded by
valid tokens other than "=".  Recognize a bracelist when preceded by a
template declaration.
(c-inside-bracelist-p): Call c-looking-at-or-maybe-in-bracelist in place of
much inline code.
(c-looking-at-inexpr-block): Amend so that it won't wrongly recognise an
initialization starting "({" as an in-expression block, by checking for
semicolons, as opposed to commas, separating elements inside it.
(c-guess-continued-construct): (CASE B-2): Recognize a brace-list-open by
calling c-looking-at-or-maybe-in-bracelist rather than checking for a
preceding "=".  (CASE B-5): New code to recognize new construct "return {
...}".
(c-guess-basic-syntax): (CASE 5A.3): Additionally recognize a "{" preceded by
"return", or "{" preceded by <type><identifier> as a bracelist.

* lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Recognize brace
lists, giving them `context' 'non-decl.  Pass over elements of one by regexp
search for "," rather than calling c-forward-decl-or-cast-1.

* lisp/progmodes/cc-langs.el (c-return-kwds, c-return-key): New lang
constants/variables to recognize "return".
(c-pre-id-bracelist-key): New lang constant/variable to recognize tokens
which, when preceding an identifier followed by a brace, signify the brace as
a bracelist.

* lisp/progmodes/cc-mode.el (c-fl-decl-start): When searching outwards for
the start of a "local" declaration, move out from an enclosing brace when
that is the start of a brace list.
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-langs.el
lisp/progmodes/cc-mode.el