Mercurial > emacs
comparison lisp/progmodes/cc-engine.el @ 46983:35f3b5d4f918
(c-forward-syntactic-ws): Fixed a bug that could cause an infinite
loop if something that looks like a macro begins in the middle of a
line.
(c-parse-state): Fixed a bug that could cause `c-state-cache' to
contain two conses in sequence when there's an unbalanced open paren
in a macro.
author | Martin Stjernholm <mast@lysator.liu.se> |
---|---|
date | Tue, 20 Aug 2002 21:58:51 +0000 |
parents | 07e19a2737a1 |
children | 5f47d61ffbdc |
comparison
equal
deleted
inserted
replaced
46982:076f60a8d04b | 46983:35f3b5d4f918 |
---|---|
640 ;; Skip line continuations. | 640 ;; Skip line continuations. |
641 ((looking-at "\\\\$") | 641 ((looking-at "\\\\$") |
642 (forward-char)) | 642 (forward-char)) |
643 ;; Skip preprocessor directives. | 643 ;; Skip preprocessor directives. |
644 ((and (looking-at "#[ \t]*[a-zA-Z0-9!]") | 644 ((and (looking-at "#[ \t]*[a-zA-Z0-9!]") |
645 (progn (skip-chars-backward " \t") | 645 (save-excursion |
646 (bolp))) | 646 (skip-chars-backward " \t") |
647 (bolp))) | |
647 (end-of-line) | 648 (end-of-line) |
648 (while (and (<= (point) lim) | 649 (while (and (<= (point) lim) |
649 (eq (char-before) ?\\) | 650 (eq (char-before) ?\\) |
650 (= (forward-line 1) 0)) | 651 (= (forward-line 1) 0)) |
651 (end-of-line)) | 652 (end-of-line)) |
1243 ;; There's a closed pair on the cached state but we've | 1244 ;; There's a closed pair on the cached state but we've |
1244 ;; found a later one, so remove it. | 1245 ;; found a later one, so remove it. |
1245 (setq c-state-cache (cdr c-state-cache))) | 1246 (setq c-state-cache (cdr c-state-cache))) |
1246 (setq pairs (car pairs)) | 1247 (setq pairs (car pairs)) |
1247 (setcar pairs (1- (car pairs))) | 1248 (setcar pairs (1- (car pairs))) |
1249 (when (consp (car-safe c-state-cache)) | |
1250 ;; There could already be a cons first in `c-state-cache' | |
1251 ;; if we've jumped over an unbalanced open paren in a | |
1252 ;; macro below. | |
1253 (setq c-state-cache (cdr c-state-cache))) | |
1248 (setq c-state-cache (cons pairs c-state-cache))) | 1254 (setq c-state-cache (cons pairs c-state-cache))) |
1249 (if last-pos | 1255 (if last-pos |
1250 ;; Prepare to loop, but record the open paren only if it's | 1256 ;; Prepare to loop, but record the open paren only if it's |
1251 ;; outside a macro or within the same macro as point. | 1257 ;; outside a macro or within the same macro as point. |
1252 (progn | 1258 (progn |