diff options
| author | Martin Stjernholm | 2003-03-23 01:58:30 +0000 |
|---|---|---|
| committer | Martin Stjernholm | 2003-03-23 01:58:30 +0000 |
| commit | e33c01bb57a63b0dc4fb31cf7e1e90940ee1df02 (patch) | |
| tree | a80e7d51b5db9088ef87dbfc0f968e80144e7b96 /lisp | |
| parent | 55ba29ee66df015214e3991f2c46a6270792ff49 (diff) | |
| download | emacs-e33c01bb57a63b0dc4fb31cf7e1e90940ee1df02.tar.gz emacs-e33c01bb57a63b0dc4fb31cf7e1e90940ee1df02.zip | |
(c-parse-state): Added kludge to avoid an infinite loop when Emacs'
open-paren-in-column-zero rule kicks in and causes the sexp functions
to misbehave.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 58d61eb2182..c2be72b0043 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -1144,7 +1144,7 @@ you need both the type of a literal and its limits." | |||
| 1144 | (let* ((here (point)) | 1144 | (let* ((here (point)) |
| 1145 | (c-macro-start (c-query-macro-start)) | 1145 | (c-macro-start (c-query-macro-start)) |
| 1146 | (in-macro-start (or c-macro-start (point))) | 1146 | (in-macro-start (or c-macro-start (point))) |
| 1147 | old-state last-pos pairs pos) | 1147 | old-state last-pos pairs pos save-pos) |
| 1148 | ;; Somewhat ugly use of c-check-state-cache to get rid of the | 1148 | ;; Somewhat ugly use of c-check-state-cache to get rid of the |
| 1149 | ;; part of the state cache that is after point. Can't use | 1149 | ;; part of the state cache that is after point. Can't use |
| 1150 | ;; c-whack-state-after for the same reasons as in that function. | 1150 | ;; c-whack-state-after for the same reasons as in that function. |
| @@ -1225,7 +1225,8 @@ you need both the type of a literal and its limits." | |||
| 1225 | (narrow-to-region (point-min) here) | 1225 | (narrow-to-region (point-min) here) |
| 1226 | (while pos | 1226 | (while pos |
| 1227 | ;; Find the balanced brace pairs. | 1227 | ;; Find the balanced brace pairs. |
| 1228 | (setq pairs nil) | 1228 | (setq save-pos pos |
| 1229 | pairs nil) | ||
| 1229 | (while (and (setq last-pos (c-down-list-forward pos)) | 1230 | (while (and (setq last-pos (c-down-list-forward pos)) |
| 1230 | (setq pos (c-up-list-forward last-pos))) | 1231 | (setq pos (c-up-list-forward last-pos))) |
| 1231 | (if (eq (char-before last-pos) ?{) | 1232 | (if (eq (char-before last-pos) ?{) |
| @@ -1269,7 +1270,13 @@ you need both the type of a literal and its limits." | |||
| 1269 | (progn | 1270 | (progn |
| 1270 | (setq pos (c-up-list-backward pos) | 1271 | (setq pos (c-up-list-backward pos) |
| 1271 | c-state-cache nil) | 1272 | c-state-cache nil) |
| 1272 | (unless pos | 1273 | (when (or (not pos) |
| 1274 | ;; Emacs (up to at least 21.2) can get confused by | ||
| 1275 | ;; open parens in column zero inside comments: The | ||
| 1276 | ;; sexp functions can then misbehave and bring us | ||
| 1277 | ;; back to the same point again. Check this so that | ||
| 1278 | ;; we don't get an infinite loop. | ||
| 1279 | (>= pos save-pos)) | ||
| 1273 | (setq pos last-pos | 1280 | (setq pos last-pos |
| 1274 | c-parsing-error | 1281 | c-parsing-error |
| 1275 | (format "Unbalanced close paren at line %d" | 1282 | (format "Unbalanced close paren at line %d" |