Mercurial > emacs
changeset 80599:7a576f7871f5
(c-guess-basic-syntax CASE 5D.5): Fix an infinite loop on invalid syntax.
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Sat, 21 Jun 2008 08:47:10 +0000 |
parents | 7418de833ef7 |
children | 43e764077e68 |
files | lisp/progmodes/cc-engine.el |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/cc-engine.el Sat Jun 21 08:45:03 2008 +0000 +++ b/lisp/progmodes/cc-engine.el Sat Jun 21 08:47:10 2008 +0000 @@ -8251,21 +8251,24 @@ (c-add-syntax 'inher-cont (c-point 'boi))) ;; CASE 5D.5: Continuation of the "expression part" of a - ;; top level construct. + ;; top level construct. Or, perhaps, an unrecognised construct. (t - (while (and (eq (car (c-beginning-of-decl-1 containing-sexp)) + (while (and (setq placeholder (point)) + (eq (car (c-beginning-of-decl-1 containing-sexp)) 'same) (save-excursion (c-backward-syntactic-ws) - (eq (char-before) ?})))) + (eq (char-before) ?})) + (< (point) placeholder))) (c-add-stmt-syntax - (if (eq char-before-ip ?,) + (cond + ((eq (point) placeholder) 'statement) ; unrecognised construct ;; A preceding comma at the top level means that a ;; new variable declaration starts here. Use ;; topmost-intro-cont for it, for consistency with ;; the first variable declaration. C.f. case 5N. - 'topmost-intro-cont - 'statement-cont) + ((eq char-before-ip ?,) 'topmost-intro-cont) + (t 'statement-cont)) nil nil containing-sexp paren-state)) ))