comparison lisp/progmodes/cc-engine.el @ 40261:f921ca937b6d

(c-beginning-of-member-init-list): Better handling of C++ template args to avoid confusion with `<' and `>' used as operators in member init expressions. From Martin Stjernholm <bug-cc-mode@gnu.org>.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 24 Oct 2001 16:07:06 +0000
parents 7a94f1c588c4
children 028db5da9d29
comparison
equal deleted inserted replaced
40260:e7be34625fd8 40261:f921ca937b6d
1026 (setq limit (point-min))) 1026 (setq limit (point-min)))
1027 (skip-chars-forward " \t") 1027 (skip-chars-forward " \t")
1028 (if (eq (char-after) ?,) 1028 (if (eq (char-after) ?,)
1029 (forward-char 1) 1029 (forward-char 1)
1030 (c-backward-syntactic-ws limit)) 1030 (c-backward-syntactic-ws limit))
1031 (c-with-syntax-table (if (c-major-mode-is 'c++-mode) 1031 (while (and (< limit (point))
1032 c++-template-syntax-table 1032 (eq (char-before) ?,))
1033 (syntax-table)) 1033 ;; this will catch member inits with multiple
1034 (while (and (< limit (point)) 1034 ;; line arglists
1035 (eq (char-before) ?,)) 1035 (forward-char -1)
1036 ;; this will catch member inits with multiple 1036 (c-backward-syntactic-ws limit)
1037 ;; line arglists 1037 (if (eq (char-before) ?\))
1038 (forward-char -1)
1039 (c-backward-syntactic-ws)
1040 (if (eq (char-before) ?\))
1041 (c-backward-sexp 2)
1042 (c-backward-sexp 1)) 1038 (c-backward-sexp 1))
1043 ;; Skip over any template arg to the class. 1039 (c-backward-syntactic-ws limit)
1044 (if (eq (char-after) ?<) 1040 ;; Skip over any template arg to the class.
1045 (c-backward-sexp 1)) 1041 (if (eq (char-before) ?>)
1046 ;; Skip backwards over a fully::qualified::name. 1042 (c-with-syntax-table c++-template-syntax-table
1047 (c-backward-syntactic-ws limit) 1043 (c-backward-sexp 1)))
1048 (while (and (eq (char-before) ?:) 1044 (c-backward-sexp 1)
1049 (save-excursion 1045 (c-backward-syntactic-ws limit)
1050 (forward-char -1) 1046 ;; Skip backwards over a fully::qualified::name.
1051 (eq (char-before) ?:))) 1047 (while (and (eq (char-before) ?:)
1052 (backward-char 2) 1048 (save-excursion
1053 (c-backward-sexp 1)) 1049 (forward-char -1)
1054 ;; now continue checking 1050 (eq (char-before) ?:)))
1055 (c-backward-syntactic-ws limit))) 1051 (backward-char 2)
1052 (c-backward-sexp 1))
1053 ;; now continue checking
1054 (c-backward-syntactic-ws limit))
1056 (and (< limit (point)) 1055 (and (< limit (point))
1057 (eq (char-before) ?:))) 1056 (eq (char-before) ?:)))
1058 1057
1059 (defun c-skip-case-statement-forward (state &optional lim) 1058 (defun c-skip-case-statement-forward (state &optional lim)
1060 ;; skip forward over case/default bodies, with optional maximal 1059 ;; skip forward over case/default bodies, with optional maximal