aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2018-03-28 18:53:32 +0000
committerAlan Mackenzie2018-03-28 18:53:32 +0000
commit3ccbe1f43f8c73b5dbf7051b91cd850959f2a79f (patch)
tree87bdec6856d9264855f735b238ee1e3e25a51f4b
parentc77d9ea0e70e68be4742ed9962058a14f5391f6b (diff)
downloademacs-3ccbe1f43f8c73b5dbf7051b91cd850959f2a79f.tar.gz
emacs-3ccbe1f43f8c73b5dbf7051b91cd850959f2a79f.zip
Replace faulty non-matching regexp "\\<\\>" with "a\\`"
The regexp "\\<\\>", which is supposed never to match, actually matches, for instance, where a Chinese character is directly followed by an ASCII letter. So, replace it with "a\\`". * lisp/progmodes/cc-defs.el (cc-fix, c-make-keywords-re) * lisp/progmodes/cc-engine.el (c-beginning-of-statement-1) (c-forward-<>-arglist-recur, c-forward-decl-or-cast-1) (c-looking-at-decl-block) * lisp/progmodes/cc-langs.el (c-assignment-op-regexp) (c-block-comment-ender-regexp, c-block-comment-start-regexp) (c-line-comment-start-regexp, c-doc-comment-start-regexp) (c-decl-start-colon-kwd-re, c-type-decl-prefix-key) (c-type-decl-operator-prefix-key, c-pre-id-bracelist-key) (c-enum-clause-introduction-re, c-nonlabel-token-2-key) * lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-name-re) (c-make-noise-macro-regexps): Replace "\\<\\>" by "a\\`".
-rw-r--r--lisp/progmodes/cc-defs.el6
-rw-r--r--lisp/progmodes/cc-engine.el8
-rw-r--r--lisp/progmodes/cc-langs.el22
-rw-r--r--lisp/progmodes/cc-vars.el8
4 files changed, 22 insertions, 22 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 613e2b303d9..ad9425a509c 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -81,7 +81,7 @@
81 (progn 81 (progn
82 (require 'font-lock) 82 (require 'font-lock)
83 (let (font-lock-keywords) 83 (let (font-lock-keywords)
84 (font-lock-compile-keywords '("\\<\\>")) 84 (font-lock-compile-keywords '("a\\`"))
85 font-lock-keywords)))) 85 font-lock-keywords))))
86 86
87 87
@@ -1777,8 +1777,8 @@ when it's needed. The default is the current language taken from
1777 1777
1778 ;; Produce a regexp that matches nothing. 1778 ;; Produce a regexp that matches nothing.
1779 (if adorn 1779 (if adorn
1780 "\\(\\<\\>\\)" 1780 "\\(a\\`\\)"
1781 "\\<\\>"))) 1781 "a\\`")))
1782 1782
1783(put 'c-make-keywords-re 'lisp-indent-function 1) 1783(put 'c-make-keywords-re 'lisp-indent-function 1)
1784 1784
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 2290c9cbddf..05926c48b04 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -870,7 +870,7 @@ comment at the start of cc-engine.el for more info."
870 stack 870 stack
871 ;; Regexp which matches "for", "if", etc. 871 ;; Regexp which matches "for", "if", etc.
872 (cond-key (or c-opt-block-stmt-key 872 (cond-key (or c-opt-block-stmt-key
873 "\\<\\>")) ; Matches nothing. 873 "a\\`")) ; Matches nothing.
874 ;; Return value. 874 ;; Return value.
875 (ret 'same) 875 (ret 'same)
876 ;; Positions of the last three sexps or bounds we've stopped at. 876 ;; Positions of the last three sexps or bounds we've stopped at.
@@ -7147,7 +7147,7 @@ comment at the start of cc-engine.el for more info."
7147 (progn 7147 (progn
7148 (c-forward-syntactic-ws) 7148 (c-forward-syntactic-ws)
7149 (when (or (and c-record-type-identifiers all-types) 7149 (when (or (and c-record-type-identifiers all-types)
7150 (not (equal c-inside-<>-type-key "\\(\\<\\>\\)"))) 7150 (not (equal c-inside-<>-type-key "\\(a\\`\\)")))
7151 (c-forward-syntactic-ws) 7151 (c-forward-syntactic-ws)
7152 (cond 7152 (cond
7153 ((eq (char-after) ??) 7153 ((eq (char-after) ??)
@@ -8557,7 +8557,7 @@ comment at the start of cc-engine.el for more info."
8557 ;; Skip over type decl prefix operators. (Note similar code in 8557 ;; Skip over type decl prefix operators. (Note similar code in
8558 ;; `c-forward-declarator'.) 8558 ;; `c-forward-declarator'.)
8559 (if (and c-recognize-typeless-decls 8559 (if (and c-recognize-typeless-decls
8560 (equal c-type-decl-prefix-key "\\<\\>")) 8560 (equal c-type-decl-prefix-key "a\\`"))
8561 (when (eq (char-after) ?\() 8561 (when (eq (char-after) ?\()
8562 (progn 8562 (progn
8563 (setq paren-depth (1+ paren-depth)) 8563 (setq paren-depth (1+ paren-depth))
@@ -10183,7 +10183,7 @@ comment at the start of cc-engine.el for more info."
10183 ;; legal because it's part of a "compound keyword" like 10183 ;; legal because it's part of a "compound keyword" like
10184 ;; "enum class". Of course, if c-after-brace-list-key 10184 ;; "enum class". Of course, if c-after-brace-list-key
10185 ;; is nil, we can skip the test. 10185 ;; is nil, we can skip the test.
10186 (or (equal c-after-brace-list-key "\\<\\>") 10186 (or (equal c-after-brace-list-key "a\\`")
10187 (save-match-data 10187 (save-match-data
10188 (save-excursion 10188 (save-excursion
10189 (not 10189 (not
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 9913c6feb2b..98cfd2073d1 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1280,7 +1280,7 @@ operators."
1280 (c--set-difference (c-lang-const c-assignment-operators) 1280 (c--set-difference (c-lang-const c-assignment-operators)
1281 '("=") 1281 '("=")
1282 :test 'string-equal))) 1282 :test 'string-equal)))
1283 "\\<\\>")) 1283 "a\\`"))
1284(c-lang-defvar c-assignment-op-regexp 1284(c-lang-defvar c-assignment-op-regexp
1285 (c-lang-const c-assignment-op-regexp)) 1285 (c-lang-const c-assignment-op-regexp))
1286 1286
@@ -1503,7 +1503,7 @@ properly."
1503 ;; language) 1503 ;; language)
1504 t (if (c-lang-const c-block-comment-ender) 1504 t (if (c-lang-const c-block-comment-ender)
1505 (regexp-quote (c-lang-const c-block-comment-ender)) 1505 (regexp-quote (c-lang-const c-block-comment-ender))
1506 "\\<\\>")) 1506 "a\\`"))
1507(c-lang-defvar c-block-comment-ender-regexp 1507(c-lang-defvar c-block-comment-ender-regexp
1508 (c-lang-const c-block-comment-ender-regexp)) 1508 (c-lang-const c-block-comment-ender-regexp))
1509 1509
@@ -1522,7 +1522,7 @@ properly."
1522 ;; language) 1522 ;; language)
1523 t (if (c-lang-const c-block-comment-starter) 1523 t (if (c-lang-const c-block-comment-starter)
1524 (regexp-quote (c-lang-const c-block-comment-starter)) 1524 (regexp-quote (c-lang-const c-block-comment-starter))
1525 "\\<\\>")) 1525 "a\\`"))
1526(c-lang-defvar c-block-comment-start-regexp 1526(c-lang-defvar c-block-comment-start-regexp
1527 (c-lang-const c-block-comment-start-regexp)) 1527 (c-lang-const c-block-comment-start-regexp))
1528 1528
@@ -1531,7 +1531,7 @@ properly."
1531 ;; language; it does in all 7 CC Mode languages). 1531 ;; language; it does in all 7 CC Mode languages).
1532 t (if (c-lang-const c-line-comment-starter) 1532 t (if (c-lang-const c-line-comment-starter)
1533 (regexp-quote (c-lang-const c-line-comment-starter)) 1533 (regexp-quote (c-lang-const c-line-comment-starter))
1534 "\\<\\>")) 1534 "a\\`"))
1535(c-lang-defvar c-line-comment-start-regexp 1535(c-lang-defvar c-line-comment-start-regexp
1536 (c-lang-const c-line-comment-start-regexp)) 1536 (c-lang-const c-line-comment-start-regexp))
1537 1537
@@ -1546,7 +1546,7 @@ properly."
1546 1546
1547(c-lang-defconst c-doc-comment-start-regexp 1547(c-lang-defconst c-doc-comment-start-regexp
1548 "Regexp to match the start of documentation comments." 1548 "Regexp to match the start of documentation comments."
1549 t "\\<\\>" 1549 t "a\\`"
1550 ;; From font-lock.el: `doxygen' uses /*! while others use /**. 1550 ;; From font-lock.el: `doxygen' uses /*! while others use /**.
1551 (c c++ objc) "/\\*[*!]" 1551 (c c++ objc) "/\\*[*!]"
1552 java "/\\*\\*" 1552 java "/\\*\\*"
@@ -2990,7 +2990,7 @@ Note that Java specific rules are currently applied to tell this from
2990 "Regexp matching a keyword that is followed by a colon, where 2990 "Regexp matching a keyword that is followed by a colon, where
2991 the whole construct can precede a declaration. 2991 the whole construct can precede a declaration.
2992 E.g. \"public:\" in C++." 2992 E.g. \"public:\" in C++."
2993 t "\\<\\>" 2993 t "a\\`"
2994 c++ (c-make-keywords-re t (c-lang-const c-protection-kwds))) 2994 c++ (c-make-keywords-re t (c-lang-const c-protection-kwds)))
2995(c-lang-defvar c-decl-start-colon-kwd-re 2995(c-lang-defvar c-decl-start-colon-kwd-re
2996 (c-lang-const c-decl-start-colon-kwd-re)) 2996 (c-lang-const c-decl-start-colon-kwd-re))
@@ -3171,7 +3171,7 @@ Identifier syntax is in effect when this is matched \(see
3171 t (if (c-lang-const c-type-modifier-kwds) 3171 t (if (c-lang-const c-type-modifier-kwds)
3172 (concat (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>") 3172 (concat (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>")
3173 ;; Default to a regexp that never matches. 3173 ;; Default to a regexp that never matches.
3174 "\\<\\>") 3174 "a\\`")
3175 ;; Check that there's no "=" afterwards to avoid matching tokens 3175 ;; Check that there's no "=" afterwards to avoid matching tokens
3176 ;; like "*=". 3176 ;; like "*=".
3177 (c objc) (concat "\\(" 3177 (c objc) (concat "\\("
@@ -3209,7 +3209,7 @@ that might precede the identifier in a declaration, e.g. the
3209as the end of the operator. Identifier syntax is in effect when 3209as the end of the operator. Identifier syntax is in effect when
3210this is matched \(see `c-identifier-syntax-table')." 3210this is matched \(see `c-identifier-syntax-table')."
3211 t ;; Default to a regexp that never matches. 3211 t ;; Default to a regexp that never matches.
3212 "\\<\\>" 3212 "a\\`"
3213 ;; Check that there's no "=" afterwards to avoid matching tokens 3213 ;; Check that there's no "=" afterwards to avoid matching tokens
3214 ;; like "*=". 3214 ;; like "*=".
3215 (c objc) (concat "\\(\\*\\)" 3215 (c objc) (concat "\\(\\*\\)"
@@ -3368,7 +3368,7 @@ list."
3368(c-lang-defconst c-pre-id-bracelist-key 3368(c-lang-defconst c-pre-id-bracelist-key
3369 "A regexp matching tokens which, preceding an identifier, signify a bracelist. 3369 "A regexp matching tokens which, preceding an identifier, signify a bracelist.
3370" 3370"
3371 t "\\<\\>" 3371 t "a\\`"
3372 c++ "new\\([^[:alnum:]_$]\\|$\\)\\|&&?\\(\\S.\\|$\\)") 3372 c++ "new\\([^[:alnum:]_$]\\|$\\)\\|&&?\\(\\S.\\|$\\)")
3373(c-lang-defvar c-pre-id-bracelist-key (c-lang-const c-pre-id-bracelist-key)) 3373(c-lang-defvar c-pre-id-bracelist-key (c-lang-const c-pre-id-bracelist-key))
3374 3374
@@ -3424,7 +3424,7 @@ the invalidity of the putative template construct."
3424 ;; before the '{' of the enum list, to avoid searching too far. 3424 ;; before the '{' of the enum list, to avoid searching too far.
3425 "[^][{};/#=]*" 3425 "[^][{};/#=]*"
3426 "{") 3426 "{")
3427 "\\<\\>")) 3427 "a\\`"))
3428(c-lang-defvar c-enum-clause-introduction-re 3428(c-lang-defvar c-enum-clause-introduction-re
3429 (c-lang-const c-enum-clause-introduction-re)) 3429 (c-lang-const c-enum-clause-introduction-re))
3430 3430
@@ -3540,7 +3540,7 @@ i.e. before \":\". Only used if `c-recognize-colon-labels' is set."
3540 "Regexp matching things that can't occur two symbols before a colon in 3540 "Regexp matching things that can't occur two symbols before a colon in
3541a label construct. This catches C++'s inheritance construct \"class foo 3541a label construct. This catches C++'s inheritance construct \"class foo
3542: bar\". Only used if `c-recognize-colon-labels' is set." 3542: bar\". Only used if `c-recognize-colon-labels' is set."
3543 t "\\<\\>" ; matches nothing 3543 t "a\\`" ; matches nothing
3544 c++ (c-make-keywords-re t '("class"))) 3544 c++ (c-make-keywords-re t '("class")))
3545(c-lang-defvar c-nonlabel-token-2-key (c-lang-const c-nonlabel-token-2-key)) 3545(c-lang-defvar c-nonlabel-token-2-key (c-lang-const c-nonlabel-token-2-key))
3546 3546
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index ecf034846bd..fcb1cac0992 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1647,8 +1647,8 @@ white space either before or after the operator, but not both."
1647 :type 'boolean 1647 :type 'boolean
1648 :group 'c) 1648 :group 'c)
1649 1649
1650(defvar c-noise-macro-with-parens-name-re "\\<\\>") 1650(defvar c-noise-macro-with-parens-name-re "a\\`")
1651(defvar c-noise-macro-name-re "\\<\\>") 1651(defvar c-noise-macro-name-re "a\\`")
1652 1652
1653(defcustom c-noise-macro-names nil 1653(defcustom c-noise-macro-names nil
1654 "A list of names of macros which expand to nothing, or compiler extensions 1654 "A list of names of macros which expand to nothing, or compiler extensions
@@ -1677,7 +1677,7 @@ These are recognized by CC Mode only in declarations."
1677 ;; Convert `c-noise-macro-names' and `c-noise-macro-with-parens-names' into 1677 ;; Convert `c-noise-macro-names' and `c-noise-macro-with-parens-names' into
1678 ;; `c-noise-macro-name-re' and `c-noise-macro-with-parens-name-re'. 1678 ;; `c-noise-macro-name-re' and `c-noise-macro-with-parens-name-re'.
1679 (setq c-noise-macro-with-parens-name-re 1679 (setq c-noise-macro-with-parens-name-re
1680 (cond ((null c-noise-macro-with-parens-names) "\\<\\>") 1680 (cond ((null c-noise-macro-with-parens-names) "a\\`")
1681 ((consp c-noise-macro-with-parens-names) 1681 ((consp c-noise-macro-with-parens-names)
1682 (concat (regexp-opt c-noise-macro-with-parens-names t) 1682 (concat (regexp-opt c-noise-macro-with-parens-names t)
1683 "\\([^[:alnum:]_$]\\|$\\)")) 1683 "\\([^[:alnum:]_$]\\|$\\)"))
@@ -1686,7 +1686,7 @@ These are recognized by CC Mode only in declarations."
1686 (t (error "c-make-noise-macro-regexps: \ 1686 (t (error "c-make-noise-macro-regexps: \
1687c-noise-macro-with-parens-names is invalid: %s" c-noise-macro-with-parens-names)))) 1687c-noise-macro-with-parens-names is invalid: %s" c-noise-macro-with-parens-names))))
1688 (setq c-noise-macro-name-re 1688 (setq c-noise-macro-name-re
1689 (cond ((null c-noise-macro-names) "\\<\\>") 1689 (cond ((null c-noise-macro-names) "a\\`")
1690 ((consp c-noise-macro-names) 1690 ((consp c-noise-macro-names)
1691 (concat (regexp-opt c-noise-macro-names t) 1691 (concat (regexp-opt c-noise-macro-names t)
1692 "\\([^[:alnum:]_$]\\|$\\)")) 1692 "\\([^[:alnum:]_$]\\|$\\)"))