summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/cc-engine.el19
-rw-r--r--lisp/progmodes/cc-langs.el17
2 files changed, 32 insertions, 4 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 4ca440fd84b..9ed4fe3d88c 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6922,7 +6922,15 @@ comment at the start of cc-engine.el for more info."
;;
;; FIXME!!! This routine ignores the possibility of macros entirely.
;; 2010-01-29.
- (when (and (> end beg)
+ (when (and (or (> end beg)
+ (and (> c-<-pseudo-digraph-cont-len 0)
+ (goto-char beg)
+ (progn
+ (skip-chars-backward
+ "^<" (max (- (point) c-<-pseudo-digraph-cont-len)
+ (point-min)))
+ (eq (char-before) ?<))
+ (looking-at c-<-pseudo-digraph-cont-regexp)))
(or
(progn
(goto-char beg)
@@ -7948,7 +7956,8 @@ comment at the start of cc-engine.el for more info."
(forward-char) ; Forward over the opening '<'.
- (unless (looking-at c-<-op-cont-regexp)
+ (unless (and (looking-at c-<-op-cont-regexp)
+ (not (looking-at c-<-pseudo-digraph-cont-regexp)))
;; go forward one non-alphanumeric character (group) per iteration of
;; this loop.
(while (and
@@ -8026,7 +8035,8 @@ comment at the start of cc-engine.el for more info."
(let (id-start id-end subres keyword-match)
(cond
;; The '<' begins a multi-char operator.
- ((looking-at c-<-op-cont-regexp)
+ ((and (looking-at c-<-op-cont-regexp)
+ (not (looking-at c-<-pseudo-digraph-cont-regexp)))
(goto-char (match-end 0)))
;; We're at a nested <.....>
((progn
@@ -12552,7 +12562,8 @@ comment at the start of cc-engine.el for more info."
(/= (char-before placeholder) ?<)
(progn
(goto-char (1+ placeholder))
- (not (looking-at c-<-op-cont-regexp))))))
+ (or (not (looking-at c-<-op-cont-regexp))
+ (looking-at c-<-pseudo-digraph-cont-regexp))))))
(goto-char placeholder)
(c-beginning-of-statement-1 containing-sexp t)
(if (save-excursion
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index d092094817c..a6fdc3ec798 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1406,6 +1406,23 @@ operators."
(lambda (op) (substring op 1)))))
(c-lang-defvar c-<-op-cont-regexp (c-lang-const c-<-op-cont-regexp))
+(c-lang-defconst c-<-pseudo-digraph-cont-regexp
+ "Regexp matching the continuation of a pseudo digraph starting \"<\".
+This is used only in C++ Mode, where \"<::\" is handled as a
+template opener followed by the \"::\" operator - usually."
+ t regexp-unmatchable
+ c++ "::\\([^:>]\\|$\\)")
+(c-lang-defvar c-<-pseudo-digraph-cont-regexp
+ (c-lang-const c-<-pseudo-digraph-cont-regexp))
+
+(c-lang-defconst c-<-pseudo-digraph-cont-len
+ "The maximum length of the main bit of a `c-<pseudp-digraph-cont-regexp' match.
+This doesn't count the merely contextual bits of the regexp match."
+ t 0
+ c++ 2)
+(c-lang-defvar c-<-pseudo-digraph-cont-len
+ (c-lang-const c-<-pseudo-digraph-cont-len))
+
(c-lang-defconst c->-op-cont-tokens
;; A list of second and subsequent characters of all multicharacter tokens
;; that begin with ">".