comparison lisp/progmodes/cc-engine.el @ 96145:598aca8e5d9d

(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 09:00:49 +0000
parents 52b7a8c22af5
children 69a04789c5f0
comparison
equal deleted inserted replaced
96144:814c1811dfe0 96145:598aca8e5d9d
8250 (eq (char-after) ?:)))) 8250 (eq (char-after) ?:))))
8251 (goto-char placeholder) 8251 (goto-char placeholder)
8252 (c-add-syntax 'inher-cont (c-point 'boi))) 8252 (c-add-syntax 'inher-cont (c-point 'boi)))
8253 8253
8254 ;; CASE 5D.5: Continuation of the "expression part" of a 8254 ;; CASE 5D.5: Continuation of the "expression part" of a
8255 ;; top level construct. 8255 ;; top level construct. Or, perhaps, an unrecognised construct.
8256 (t 8256 (t
8257 (while (and (eq (car (c-beginning-of-decl-1 containing-sexp)) 8257 (while (and (setq placeholder (point))
8258 (eq (car (c-beginning-of-decl-1 containing-sexp))
8258 'same) 8259 'same)
8259 (save-excursion 8260 (save-excursion
8260 (c-backward-syntactic-ws) 8261 (c-backward-syntactic-ws)
8261 (eq (char-before) ?})))) 8262 (eq (char-before) ?}))
8263 (< (point) placeholder)))
8262 (c-add-stmt-syntax 8264 (c-add-stmt-syntax
8263 (if (eq char-before-ip ?,) 8265 (cond
8266 ((eq (point) placeholder) 'statement) ; unrecognised construct
8264 ;; A preceding comma at the top level means that a 8267 ;; A preceding comma at the top level means that a
8265 ;; new variable declaration starts here. Use 8268 ;; new variable declaration starts here. Use
8266 ;; topmost-intro-cont for it, for consistency with 8269 ;; topmost-intro-cont for it, for consistency with
8267 ;; the first variable declaration. C.f. case 5N. 8270 ;; the first variable declaration. C.f. case 5N.
8268 'topmost-intro-cont 8271 ((eq char-before-ip ?,) 'topmost-intro-cont)
8269 'statement-cont) 8272 (t 'statement-cont))
8270 nil nil containing-sexp paren-state)) 8273 nil nil containing-sexp paren-state))
8271 )) 8274 ))
8272 8275
8273 ;; CASE 5F: Close of a non-class declaration level block. 8276 ;; CASE 5F: Close of a non-class declaration level block.
8274 ((and (eq char-after-ip ?}) 8277 ((and (eq char-after-ip ?})