Any update to cc-mode? I would like to see this patch installed:
From: Martin Stjernholm <mast(a)lysator.liu.se>
Subject: Re: CC Mode 5.28 (C++); contained expression ends prematurely
To: nbecker(a)hns.com (Neal D. Becker)
Cc: bug-cc-mode(a)gnu.org
Date: 25 Jul 2002 18:06:00 +0200
Reply-To: bug-cc-mode(a)gnu.org
nbecker(a)hns.com (Neal D. Becker) wrote:
I can't indent this code on line 15 or 16. It just beeps saying
Containing expression ends prematurely
Here is the code:
/.../
class iPowerNorm {
public:
iPowerNorm (int _targetVoltage, int _shift1, int _shift2, int _init) :
targetVoltage (_targetVoltage),
shift1 (_shift1),
shift2 (_shift2),
sum (_init << _shift1),
voltage (_init),
adj ((_targetVoltage << shift2)/_init)
{}
/.../
CC Mode 5.28 has a bug that causes it to confuse < and > in such
initialization lists with template parentheses. The following patch
corrects that.
*** cc-engine.el 2001/02/21 18:15:14 5.184
--- cc-engine.el 2001/10/24 15:13:36
***************
*** 1024,1054 ****
(if (eq (char-after) ?,)
(forward-char 1)
(c-backward-syntactic-ws limit))
! (c-with-syntax-table (if (c-major-mode-is 'c++-mode)
! c++-template-syntax-table
! (syntax-table))
! (while (and (< limit (point))
! (eq (char-before) ?,))
! ;; this will catch member inits with multiple
! ;; line arglists
! (forward-char -1)
! (c-backward-syntactic-ws)
! (if (eq (char-before) ?\))
! (c-backward-sexp 2)
(c-backward-sexp 1))
! ;; Skip over any template arg to the class.
! (if (eq (char-after) ?<)
! (c-backward-sexp 1))
! ;; Skip backwards over a fully::qualified::name.
! (c-backward-syntactic-ws limit)
! (while (and (eq (char-before) ?:)
! (save-excursion
! (forward-char -1)
! (eq (char-before) ?:)))
! (backward-char 2)
! (c-backward-sexp 1))
! ;; now continue checking
! (c-backward-syntactic-ws limit)))
(and (< limit (point))
(eq (char-before) ?:)))
--- 1024,1053 ----
(if (eq (char-after) ?,)
(forward-char 1)
(c-backward-syntactic-ws limit))
! (while (and (< limit (point))
! (eq (char-before) ?,))
! ;; this will catch member inits with multiple
! ;; line arglists
! (forward-char -1)
! (c-backward-syntactic-ws limit)
! (if (eq (char-before) ?\))
(c-backward-sexp 1))
! (c-backward-syntactic-ws limit)
! ;; Skip over any template arg to the class.
! (if (eq (char-before) ?>)
! (c-with-syntax-table c++-template-syntax-table
! (c-backward-sexp 1)))
! (c-backward-sexp 1)
! (c-backward-syntactic-ws limit)
! ;; Skip backwards over a fully::qualified::name.
! (while (and (eq (char-before) ?:)
! (save-excursion
! (forward-char -1)
! (eq (char-before) ?:)))
! (backward-char 2)
! (c-backward-sexp 1))
! ;; now continue checking
! (c-backward-syntactic-ws limit))
(and (< limit (point))
(eq (char-before) ?:)))